svn commit: r197954 - in user/eri/pf45/head/contrib/pf: authpf ftp-proxy pflogd tftp-proxy

Ermal Luçi eri at FreeBSD.org
Sun Oct 11 11:00:15 UTC 2009


Author: eri
Date: Sun Oct 11 11:00:14 2009
New Revision: 197954
URL: http://svn.freebsd.org/changeset/base/197954

Log:
  Fix compilation of all userland utilities of pf(4).

Modified:
  user/eri/pf45/head/contrib/pf/authpf/authpf.c
  user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c
  user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c
  user/eri/pf45/head/contrib/pf/pflogd/pflogd.c
  user/eri/pf45/head/contrib/pf/pflogd/privsep.c
  user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c
  user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c
  user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c

Modified: user/eri/pf45/head/contrib/pf/authpf/authpf.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/authpf/authpf.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/authpf/authpf.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -16,6 +16,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/types.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
@@ -68,7 +73,11 @@ struct timeval	Tstart, Tend;	/* start an
 
 volatile sig_atomic_t	want_death;
 static void		need_death(int signo);
+#ifdef __FreeBSD__
+static void		do_death(int);
+#else
 static __dead void	do_death(int);
+#endif
 extern char *__progname;	/* program name */
 
 /*
@@ -912,7 +921,11 @@ need_death(int signo)
 /*
  * function that removes our stuff when we go away.
  */
+#ifdef __FreeBSD__
+static void
+#else
 static __dead void
+#endif
 do_death(int active)
 {
 	int	ret = 0;

Modified: user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -16,6 +16,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>

Modified: user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -16,6 +16,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/queue.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -44,6 +49,10 @@
 
 #include "filter.h"
 
+#ifdef __FreeBSD__
+#define LIST_END(s)	NULL
+#endif
+
 #define CONNECT_TIMEOUT	30
 #define MIN_PORT	1024
 #define MAX_LINE	500
@@ -574,7 +583,11 @@ logmsg(int pri, const char *message, ...
 
 		/* We don't care about truncation. */
 		vsnprintf(buf, sizeof buf, message, ap);
+#ifdef __FreeBSD__
+		strvis(visbuf, buf, VIS_CSTYLE | VIS_NL);
+#else
 		strnvis(visbuf, buf, sizeof visbuf, VIS_CSTYLE | VIS_NL);
+#endif
 		fprintf(stderr, "%s\n", visbuf);
 	}
 

Modified: user/eri/pf45/head/contrib/pf/pflogd/pflogd.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/pflogd/pflogd.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/pflogd/pflogd.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -30,12 +30,21 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#endif
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#ifdef __FreeBSD__
+#include <net/pfvar.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -48,7 +57,11 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <fcntl.h>
+#ifdef __FreeBSD__
+#include "pidfile.h"
+#else
 #include <util.h>
+#endif
 #include "pflogd.h"
 
 pcap_t *hpcap;
@@ -153,7 +166,11 @@ logmsg(int pri, const char *message, ...
 	va_end(ap);
 }
 
+#ifdef __FreeBSD__
+void
+#else
 __dead void
+#endif
 usage(void)
 {
 	fprintf(stderr, "usage: pflogd [-Dx] [-d delay] [-f filename]");
@@ -214,7 +231,11 @@ if_exists(char *ifname)
 		sizeof(ifr.ifr_name))
 			errx(1, "main ifr_name: strlcpy");
 	ifr.ifr_data = (caddr_t)&ifrdat;
+#ifdef __FreeBSD__
+	if (ioctl(s, DIOCGIFSPEED, (caddr_t)&ifr) == -1)
+#else
 	if (ioctl(s, SIOCGIFDATA, (caddr_t)&ifr) == -1)
+#endif
 		return (0);
 	if (close(s))
 		err(1, "close");

Modified: user/eri/pf45/head/contrib/pf/pflogd/privsep.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/pflogd/privsep.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/pflogd/privsep.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -16,6 +16,12 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
@@ -28,13 +34,20 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#ifndef __FreeBSD__
 #include <pcap.h>
 #include <pcap-int.h>
+#endif
 #include <pwd.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __FreeBSD__
+/* XXX: pcap pollutes namespace with strlcpy if not present previously */
+#include <pcap.h>
+#include <pcap-int.h>
+#endif
 #include <syslog.h>
 #include <unistd.h>
 #include "pflogd.h"
@@ -69,7 +82,11 @@ priv_init(void)
 	int snaplen, ret, olderrno;
 	struct passwd *pw;
 
+#ifdef __FreeBSD__
+	for (i = 1; i < NSIG; i++)
+#else
 	for (i = 1; i < _NSIG; i++)
+#endif
 		signal(i, SIG_DFL);
 
 	/* Create sockets */

Modified: user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -31,6 +31,12 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/param.h>
 #include <sys/uio.h>
 #include <sys/types.h>

Modified: user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -16,6 +16,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <syslog.h>
 
 #include <sys/ioctl.h>

Modified: user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c
==============================================================================
--- user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c	Sun Oct 11 07:03:56 2009	(r197953)
+++ user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c	Sun Oct 11 11:00:14 2009	(r197954)
@@ -27,6 +27,11 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/uio.h>


More information about the svn-src-user mailing list