Subject: bin/18839: ipfstat does not show IPv6 accounting info
To: None <gnats-bugs@gnats.netbsd.org>
From: None <naoki@fukaumi.org>
List: netbsd-bugs
Date: 10/29/2002 00:03:41
>Number:         18839
>Category:       bin
>Synopsis:       ipfstat does not show IPv6 accounting info
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 28 07:04:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6I
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD firewire.naobsd.org 1.6I NetBSD 1.6I (GENERIC) #0: Fri Oct 18 17:31:18 JST 2002 fun@nforce.naobsd.org:/usr/obj/i386/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	ipf supports accounting rule for IPv6. But ipfstat can't show
	accounting information for IPv6.
>How-To-Repeat:
	# echo 'count in all' | ipf -6 -f -
	# echo 'count out all' | ipf -f -
	# ipfstat -6 -aio
	0 count out from any to any
	empty list for ipacct(in)

	(This is accounting rule for IPv4)
>Fix:
	This is patch (which was sent to author of IP Filter)

--- src/dist/ipf/fils.c.orig	Wed Oct  2 10:39:17 2002
+++ src/dist/ipf/fils.c	Mon Oct 28 16:35:30 2002
@@ -113,7 +113,8 @@
 #define	FPRINTF	(void)fprintf
 #define	F_IN	0
 #define	F_OUT	1
-#define	F_AC	2
+#define	F_ACIN	2
+#define	F_ACOUT	3
 static	char	*filters[4] = { "ipfilter(in)", "ipfilter(out)",
 				"ipacct(in)", "ipacct(out)" };
 
@@ -782,13 +783,22 @@
 	if (opts & OPT_INACTIVE)
 		set = 1 - set;
 	if (opts & OPT_ACCNT) {
-		i = F_AC;
+#ifdef USE_INET6
+		if ((use_inet6) && (opts & OPT_OUTQUE)) {
+			i = F_ACOUT;
+			fp = (struct frentry *)fiop->f_acctout6[set];
+		} else if ((use_inet6) && (opts & OPT_INQUE)) {
+			i = F_ACIN;
+			fp = (struct frentry *)fiop->f_acctin6[set];
+		} else
+#endif
 		if (opts & OPT_OUTQUE) {
+			i = F_ACOUT;
 			fp = (struct frentry *)fiop->f_acctout[set];
-			i++;
-		} else if (opts & OPT_INQUE)
+		} else if (opts & OPT_INQUE) {
+			i = F_ACIN;
 			fp = (struct frentry *)fiop->f_acctin[set];
-		else {
+		} else {
 			FPRINTF(stderr, "No -i or -o given with -a\n");
 			return;
 		}
>Release-Note:
>Audit-Trail:
>Unformatted: