From c880778a6e9a78703483cb99b571694c5703ac46 Mon Sep 17 00:00:00 2001
From: Pav Lucistnik <pav@FreeBSD.org>
Date: Sat, 14 Jul 2007 16:57:27 +0000
Subject: - Fix build with pf 4.1

Submitted by:	mlaier (maintainer)
---
 sysutils/pfstat/Makefile               |  4 ++++
 sysutils/pfstat/files/patch-pf.c       | 29 -----------------------------
 sysutils/pfstat/files/pre41-patch-pf.c | 31 +++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 29 deletions(-)
 create mode 100644 sysutils/pfstat/files/pre41-patch-pf.c

diff --git a/sysutils/pfstat/Makefile b/sysutils/pfstat/Makefile
index 2f133d327b08..ae22d525bd9d 100644
--- a/sysutils/pfstat/Makefile
+++ b/sysutils/pfstat/Makefile
@@ -33,6 +33,10 @@ PLIST_FILES=	bin/pfstat \
 IGNORE=		is only for 5.3 and above
 .endif
 
+.if ${OSVERSION} < 700048
+EXTRA_PATCHES=	${PATCHDIR}/pre41-patch-pf.c
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e 's|-lgd|-l$${LD_GD}|; s| -lttf||' \
 		${WRKSRC}/Makefile
diff --git a/sysutils/pfstat/files/patch-pf.c b/sysutils/pfstat/files/patch-pf.c
index 92abe2b69e40..54ca88490d52 100644
--- a/sysutils/pfstat/files/patch-pf.c
+++ b/sysutils/pfstat/files/patch-pf.c
@@ -13,32 +13,3 @@
  	mnr = pa.nr;
  
  	/* fetch each of those queues */
-@@ -144,23 +142,24 @@
- query_ifaces(int fd, void (*cb)(int, const char *, int, double))
- {
- 	struct pfioc_iface io;
--	struct pfi_kif ifs[256];
-+	struct pfi_if ifs[256];
- 	int i, j;
- 
- 	memset(&io, 0, sizeof(io));
- 	io.pfiio_buffer = ifs;
- 	io.pfiio_esize = sizeof(ifs[0]);
- 	io.pfiio_size = sizeof(ifs) / sizeof(ifs[0]);
-+	io.pfiio_flags = PFI_FLAG_ALLMASK;
- 	if (ioctl(fd, DIOCIGETIFACES, &io)) {
- 		fprintf(stderr, "ioctl: DIOCIGETIFACES: %s\n", strerror(errno));
- 		return (1);
- 	}
- 	for (i = 0; i < io.pfiio_size; ++i)
- 		for (j = 0; j < 16; ++j)
--			(*cb)(COL_TYPE_IFACE, ifs[i].pfik_name,
-+			(*cb)(COL_TYPE_IFACE, ifs[i].pfif_name,
- 			    j, j & 4 ?
--			    ifs[i].pfik_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
--			    ifs[i].pfik_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
-+			    ifs[i].pfif_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
-+			    ifs[i].pfif_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
- 	/* bytes/packets[af][dir][op] */
- 	return (0);
- }
diff --git a/sysutils/pfstat/files/pre41-patch-pf.c b/sysutils/pfstat/files/pre41-patch-pf.c
new file mode 100644
index 000000000000..a77a306530a5
--- /dev/null
+++ b/sysutils/pfstat/files/pre41-patch-pf.c
@@ -0,0 +1,31 @@
+--- pf.c.orig	Thu May 11 23:41:07 2006
++++ pf.c	Mon Dec 11 21:08:31 2006
+@@ -144,23 +142,24 @@
+ query_ifaces(int fd, void (*cb)(int, const char *, int, double))
+ {
+ 	struct pfioc_iface io;
+-	struct pfi_kif ifs[256];
++	struct pfi_if ifs[256];
+ 	int i, j;
+ 
+ 	memset(&io, 0, sizeof(io));
+ 	io.pfiio_buffer = ifs;
+ 	io.pfiio_esize = sizeof(ifs[0]);
+ 	io.pfiio_size = sizeof(ifs) / sizeof(ifs[0]);
++	io.pfiio_flags = PFI_FLAG_ALLMASK;
+ 	if (ioctl(fd, DIOCIGETIFACES, &io)) {
+ 		fprintf(stderr, "ioctl: DIOCIGETIFACES: %s\n", strerror(errno));
+ 		return (1);
+ 	}
+ 	for (i = 0; i < io.pfiio_size; ++i)
+ 		for (j = 0; j < 16; ++j)
+-			(*cb)(COL_TYPE_IFACE, ifs[i].pfik_name,
++			(*cb)(COL_TYPE_IFACE, ifs[i].pfif_name,
+ 			    j, j & 4 ?
+-			    ifs[i].pfik_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
+-			    ifs[i].pfik_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
++			    ifs[i].pfif_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
++			    ifs[i].pfif_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
+ 	/* bytes/packets[af][dir][op] */
+ 	return (0);
+ }
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0