From nobody@FreeBSD.org  Mon Oct 28 07:12:49 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4209337B401
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Oct 2002 07:12:49 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D7F5343E75
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Oct 2002 07:12:48 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9SFCl7R048126
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Oct 2002 07:12:47 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g9SFCl23048125;
	Mon, 28 Oct 2002 07:12:47 -0800 (PST)
Message-Id: <200210281512.g9SFCl23048125@www.freebsd.org>
Date: Mon, 28 Oct 2002 07:12:47 -0800 (PST)
From: FUKAUMI Naoki <naoki@fukaumi.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ipfstat does not show IPv6 accounting info
X-Send-Pr-Version: www-1.0

>Number:         44567
>Category:       bin
>Synopsis:       ipfstat does not show IPv6 accounting info
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    darrenr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 28 07:20:01 PST 2002
>Closed-Date:    Mon Jul 05 16:57:18 GMT 2004
>Last-Modified:  Mon Jul 05 16:57:18 GMT 2004
>Originator:     FUKAUMI Naoki
>Release:        5-CURRENT
>Organization:
FUKAUMI Naoki
>Environment:
5-CURRENT
>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/contrib/ipfilter/fils.c.orig	Wed Oct  2 10:39:17 2002
+++ src/contrib/ipfilter/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:
Responsible-Changed-From-To: freebsd-bugs->darrenr 
Responsible-Changed-By: kris 
Responsible-Changed-When: Mon Jul 14 04:42:22 PDT 2003 
Responsible-Changed-Why:  
Assign to ipfilter author 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44567 
State-Changed-From-To: open->feedback 
State-Changed-By: darrenr 
State-Changed-When: Tue Apr 20 05:57:35 PDT 2004 
State-Changed-Why:  
patch is in ipfilter, will be brought in with next update if not already. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44567 
State-Changed-From-To: feedback->closed 
State-Changed-By: darrenr 
State-Changed-When: Mon Jul 5 16:56:22 GMT 2004 
State-Changed-Why:  
patch now in -current 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44567 
>Unformatted:
