Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Apr 2009 23:15:51 +0100
From:      Max Laier <max@love2party.net>
To:        freebsd-pf@freebsd.org
Subject:   Re: building pftop from source fails
Message-ID:  <200904110015.51410.max@love2party.net>
In-Reply-To: <126000990904101420p66082c12o50d1da6c1a0b8ebb@mail.gmail.com>
References:  <126000990904101420p66082c12o50d1da6c1a0b8ebb@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Friday 10 April 2009 23:20:12 Shaddi Hasan wrote:
> I'm trying to get pftop-0.6 to compile from source on a FreeBSD 6.0
> machine. I downloaded pftop-0.6.tar.gz from the author's website,

Okay ... I got a couple of questions about this:
1) Why? There is sysutils/pftop ready for the taking
2) Why 6.0?  It's EOL'ed (esp. in the pf department)
3) Why?!?

> extracted the contents to the machine, and ran "make" as root.
> However, the build fails. The output is as follows:
> ----------------
> # make
> cc -O2 -fno-strict-aliasing -pipe  -Wall -DOS_LEVEL=  -c

There's your problem right there.  You need to set the OS_LEVEL in the 
Makefile in order to compile successfully.  See the aforementioned port's 
Makefile for sensible values depending on __FreeBSD_version.

> I got similar output trying to compile pftop-0.7 (the most recent
> version), as well as both packages on a FreeBSD 7.0 machine. Any
> thoughts on why the build fails?

^ ... simply use the port.  Be advised, however, that the port fails to build 
on recent CURRENT due to the libpcap 1.0 update - workaround patch for that 
problem is attached, a proper solution should hit the tree over the weekend.

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

[-- Attachment #2 --]
Index: Makefile
===================================================================
RCS file: /usr/store/mlaier/fcvs/ports/sysutils/pftop/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- Makefile	6 Jan 2009 17:59:29 -0000	1.14
+++ Makefile	9 Apr 2009 20:15:41 -0000
@@ -29,6 +29,12 @@
 CFLAGS+=	-DHAVE_ALTQ=1
 .endif
 
+.if ${OSVERSION} >= 800074
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-bpf_dump.c	\
+		${FILESDIR}/extra-patch-bpf_image.c	\
+		${FILESDIR}/extra-patch-sf-gencode.h
+.endif
+
 MAKE_ENV+=	__MAKE_CONF=/dev/null
 
 PLIST_FILES=	sbin/pftop
Index: files/extra-patch-bpf_dump.c
===================================================================
RCS file: files/extra-patch-bpf_dump.c
diff -N files/extra-patch-bpf_dump.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/extra-patch-bpf_dump.c	9 Apr 2009 20:02:26 -0000
@@ -0,0 +1,15 @@
+--- bpf_dump.c.orig	2007-11-07 06:34:18.000000000 +0000
++++ bpf_dump.c	2009-04-09 19:59:03.986485991 +0000
+@@ -33,10 +33,10 @@
+ #include <stdio.h>
+ 
+ 
+-extern void bpf_dump(struct bpf_program *, int);
++extern void bpf_dump(const struct bpf_program *, int);
+ 
+ void
+-bpf_dump(struct bpf_program *p, int option)
++bpf_dump(const struct bpf_program *p, int option)
+ {
+ 	struct bpf_insn *insn;
+ 	int i;
Index: files/extra-patch-bpf_image.c
===================================================================
RCS file: files/extra-patch-bpf_image.c
diff -N files/extra-patch-bpf_image.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/extra-patch-bpf_image.c	9 Apr 2009 20:02:57 -0000
@@ -0,0 +1,11 @@
+--- bpf_image.c.orig	2007-11-07 06:34:18.000000000 +0000
++++ bpf_image.c	2009-04-09 19:59:03.986485991 +0000
+@@ -36,7 +36,7 @@
+ 
+ char *
+ bpf_image(p, n)
+-	struct bpf_insn *p;
++	const struct bpf_insn *p;
+ 	int n;
+ {
+ 	int v;
Index: files/extra-patch-sf-gencode.h
===================================================================
RCS file: files/extra-patch-sf-gencode.h
diff -N files/extra-patch-sf-gencode.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/extra-patch-sf-gencode.h	9 Apr 2009 20:18:09 -0000
@@ -0,0 +1,12 @@
+--- sf-gencode.h.orig	2009-04-09 20:00:14.850928399 +0000
++++ sf-gencode.h	2009-04-09 20:03:39.399099396 +0000
+@@ -188,7 +188,8 @@
+ const char *sf_get_error(void);
+ int sf_compile(struct bpf_program *, char *, int, bpf_u_int32);
+ void sf_freecode(struct bpf_program *);
+-void bpf_dump(struct bpf_program *, int);
++/* void bpf_dump(struct bpf_program *, int); */
++u_int bpf_filter(struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen);
+ 
+ extern int no_optimize;
+ 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904110015.51410.max>