From owner-cvs-all Fri Sep 28 11:32:16 2001 Delivered-To: cvs-all@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 4883037B40F; Fri, 28 Sep 2001 11:32:04 -0700 (PDT) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id UAA18086; Fri, 28 Sep 2001 20:32:03 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Luigi Rizzo Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/netinet ip_dummynet.c ip_dummynet.h ip_fw.c ip_fw.h ip_input.c ip_output.c src/sys/net bridge.c src/sbin/ipfw ipfw.8 ipfw.c References: <200109272344.f8RNiSV40274@freefall.freebsd.org> From: Dag-Erling Smorgrav Date: 28 Sep 2001 20:32:02 +0200 In-Reply-To: Message-ID: Lines: 17 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-=-= Dag-Erling Smorgrav writes: > 1) with these patches, installing the rule "pass ip from any to any > via lo0" (#2 in my ruleset) causes an immediate panic in > add_entry() (no core dump yet, but I'm working on it) Actually, from reading the code, any attempt to install an unnumbered (i.e. automatically numbered) rule will panic, because the loop (starting on line 1657 of ip_fw.c) that tries to find the highest existing rule number trashes the pointer to the rule you're about to install. See the attached (untested) patch. DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ipfw.diff Index: ip_fw.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_fw.c,v retrieving revision 1.170 diff -u -r1.170 ip_fw.c --- ip_fw.c 27 Sep 2001 23:44:26 -0000 1.170 +++ ip_fw.c 28 Sep 2001 18:27:58 -0000 @@ -1654,9 +1654,13 @@ /* If entry number is 0, find highest numbered rule and add 100 */ if (ftmp->fw_number == 0) { - LIST_FOREACH(ftmp, head, next) { - if (ftmp->fw_number != IPFW_DEFAULT_RULE) - nbr = ftmp->fw_number; + /* + * This works because the list is ordered, so the last + * non-default rule is also the highest-numbered one. + */ + LIST_FOREACH(fcp, head, next) { + if (fcp->fw_number != IPFW_DEFAULT_RULE) + nbr = fcp->fw_number; else break; } --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message