From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 8 04:00:34 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AEF7C16A4B3 for ; Wed, 8 Oct 2003 04:00:34 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2FE043FE3 for ; Wed, 8 Oct 2003 04:00:25 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h98B0PFY093057 for ; Wed, 8 Oct 2003 04:00:25 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h98B0Pai093051; Wed, 8 Oct 2003 04:00:25 -0700 (PDT) (envelope-from gnats) Resent-Date: Wed, 8 Oct 2003 04:00:25 -0700 (PDT) Resent-Message-Id: <200310081100.h98B0Pai093051@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, FUKAUMI Naoki Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF4E316A4BF for ; Wed, 8 Oct 2003 03:51:00 -0700 (PDT) Received: from gate.soum.co.jp (gate.soum.co.jp [202.221.40.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34C7943FDF for ; Wed, 8 Oct 2003 03:50:58 -0700 (PDT) (envelope-from fukaumi@soum.co.jp) Received: from force.soum.co.jp (force.soum.co.jp [IPv6:2001:240:c4:1:a00:20ff:fef0:4c9c]) by gate.soum.co.jp (8.12.9/8.12.9) with ESMTP id h98AotS3022162 for ; Wed, 8 Oct 2003 19:50:55 +0900 (JST) (envelope-from fukaumi@soum.co.jp) Received: from fun.soum.co.jp ([2001:240:c4:1:2e0:18ff:fe00:d8ee]) h98Aosf13065 for ; Wed, 8 Oct 2003 19:50:54 +0900 (JST) Message-Id: <1xwubgc8a9.wl@fun.soum.co.jp> Date: Wed, 08 Oct 2003 19:50:54 +0900 From: FUKAUMI Naoki To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/57736: IP Filter IPv6 accounting bug X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: FUKAUMI Naoki List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2003 11:00:34 -0000 X-List-Received-Date: Wed, 08 Oct 2003 11:00:34 -0000 >Number: 57736 >Category: kern >Synopsis: IP Filter IPv6 accounting bug >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 08 04:00:25 PDT 2003 >Closed-Date: >Last-Modified: >Originator: FUKAUMI Naoki >Release: FreeBSD 4.9-PRERELEASE i386 >Organization: SOUM Corporation >Environment: >Description: IP Filter IPv6 accounting (packet byte count) is broken. >How-To-Repeat: # echo count in all | ipf -6 -f - # echo count out all | ipf -6 -f - (some IPv6 communication) # ipfstat -6 -aio (count is incorrect) >Fix: This PR and patch was sent to author few minutes ago. --- fil.c.orig 2003-06-28 00:29:37.000000000 +0900 +++ fil.c 2003-10-08 19:15:03.000000000 +0900 @@ -630,7 +630,7 @@ { register struct frentry *fr; register fr_ip_t *fi = &fin->fin_fi; - int rulen, portcmp = 0, off, skip = 0, logged = 0; + int rulen, portcmp = 0, off, skip = 0, logged = 0, len, v = ip->ip_v; u_32_t pass, passt, passl; frentry_t *frl; @@ -809,10 +809,20 @@ } #endif /* IPFILTER_LOG */ ATOMIC_INCL(fr->fr_hits); - if (passt & FR_ACCOUNT) - fr->fr_bytes += (U_QUAD_T)ip->ip_len; - else + if (passt & FR_ACCOUNT) { +#ifdef USE_INET6 + if (v == 6) { + len = ntohs(((ip6_t*)ip)->ip6_plen); + len += sizeof(ip6_t); + } else +#endif + { + len = ip->ip_len; + } + fr->fr_bytes += (U_QUAD_T)len; + } else { fin->fin_icode = fr->fr_icode; + } fin->fin_rule = rulen; fin->fin_group = fr->fr_group; if (fr->fr_grp != NULL) { >Release-Note: >Audit-Trail: >Unformatted: