From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 14 08:10:14 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 BFD1737B404 for ; Mon, 14 Apr 2003 08:10:14 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2841643FBF for ; Mon, 14 Apr 2003 08:10:12 -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 h3EFABUp094899 for ; Mon, 14 Apr 2003 08:10:11 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3EFABlS094898; Mon, 14 Apr 2003 08:10:11 -0700 (PDT) Resent-Date: Mon, 14 Apr 2003 08:10:11 -0700 (PDT) Resent-Message-Id: <200304141510.h3EFABlS094898@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, Rene de Vries Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CC6837B401; Mon, 14 Apr 2003 08:09:38 -0700 (PDT) Received: from bastix.tunix.nl (bastix.tunix.nl [193.79.201.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8496343F3F; Mon, 14 Apr 2003 08:09:36 -0700 (PDT) (envelope-from rene@tunix.nl) Received: (from root@localhost) by bastix.tunix.nl (8.9.3c/8.6.12) id RAA31501; Mon, 14 Apr 2003 17:09:48 +0200 (CEST) Received: by bastix.tunix.nl (TUNIX txp2/smap) id sma030908; Mon, 14 Apr 03 17:08:09 +0200 Received: from upsilix.tunix.nl (upsilix.tunix.nl [172.16.2.22]) by fix.tunix.nl (8.10.2+Sun/8.10.2) with ESMTP id h3EF7u901892; Mon, 14 Apr 2003 17:07:56 +0200 (MEST) Received: from upsilix.tunix.nl (localhost.tunix.nl [127.0.0.1]) by upsilix.tunix.nl (8.12.6/8.12.6) with ESMTP id h3EF7rc5072817; Mon, 14 Apr 2003 17:07:53 +0200 (CEST) (envelope-from rene@upsilix.tunix.nl) Received: (from rene@localhost) by upsilix.tunix.nl (8.12.6/8.12.6/Submit) id h3EF7rd1072816; Mon, 14 Apr 2003 17:07:53 +0200 (CEST) (envelope-from rene) Message-Id: <200304141507.h3EF7rd1072816@upsilix.tunix.nl> Date: Mon, 14 Apr 2003 17:07:53 +0200 (CEST) From: Rene de Vries To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: darrenr@FreeBSD.org Subject: kern/50948: BUG: @0 does not insert at the beginning of the list X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Rene de Vries List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2003 15:10:15 -0000 >Number: 50948 >Category: kern >Synopsis: BUG: @0 does not insert at the beginning of the list >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Apr 14 08:10:11 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Rene de Vries >Release: FreeBSD 4.7-RELEASE-p3 i386/FreeBSD 5.0-20030414 i386 >Organization: Tunix Internet Security & Training >Environment: FreeBSD 4.7-RELEASE-p3 i386/FreeBSD 5.0-20030414 i386 IPFilter 3.4.29/3.4.31 >Description: In previous versions of ip_filter "@0" used to insert a line at the beginning of the set. The current version simply leaves the line as it would have been without "@0". The bug is triggered by the fact that fr_hist is used both as a counter and as a boolean. >How-To-Repeat: Filter rules: log in on lo0 from any to 192.168.1.1 log in on lo0 from any to 192.168.1.2 log in on lo0 from any to 192.168.1.3 @0 log in on lo0 from any to 192.168.2.1 @0 log in on lo0 from any to 192.168.2.2 @0 log in on lo0 from any to 192.168.2.3 ipfstat -i (before fix): log in on lo0 from any to 192.168.1.1 log in on lo0 from any to 192.168.1.2 log in on lo0 from any to 192.168.1.3 log in on lo0 from any to 192.168.2.1 log in on lo0 from any to 192.168.2.2 log in on lo0 from any to 192.168.2.3 ipfstat -i should then be: log in on lo0 from any to 192.168.2.3 log in on lo0 from any to 192.168.2.2 log in on lo0 from any to 192.168.2.1 log in on lo0 from any to 192.168.1.1 log in on lo0 from any to 192.168.1.2 log in on lo0 from any to 192.168.1.3 >Fix: Diff against FreeBSD 5 (current as of 14 Apr 2003) Index: sys/contrib/ipfilter/netinet/ip_fil.c =================================================================== RCS file: /home/fbsd-cvsrepo/src/sys/contrib/ipfilter/netinet/ip_fil.c,v retrieving revision 1.38 diff -u -r1.38 ip_fil.c --- sys/contrib/ipfilter/netinet/ip_fil.c 19 Feb 2003 05:47:00 -0000 1.38 +++ sys/contrib/ipfilter/netinet/ip_fil.c 14 Apr 2003 13:39:40 -0000 @@ -1025,8 +1025,8 @@ while ((f = *ftail)) ftail = &f->fr_next; else { + ftail = fprev; if (fp->fr_hits) { - ftail = fprev; while (--fp->fr_hits && (f = *ftail)) ftail = &f->fr_next; } >Release-Note: >Audit-Trail: >Unformatted: