From owner-freebsd-current@FreeBSD.ORG Tue Aug 17 06:42:07 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B032C16A4CE; Tue, 17 Aug 2004 06:42:07 +0000 (GMT) Received: from mp2.macomnet.net (mp2.macomnet.net [195.128.64.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id C003343D2D; Tue, 17 Aug 2004 06:42:06 +0000 (GMT) (envelope-from maxim@macomnet.ru) Received-SPF: pass (mp2.macomnet.net: domain of maxim@macomnet.ru designates 127.0.0.1 as permitted sender) receiver=mp2.macomnet.net; client_ip=127.0.0.1; envelope-from=maxim@macomnet.ru; Received: from localhost (s9hnicfe@localhost [127.0.0.1]) by mp2.macomnet.net (8.12.11/8.12.11) with ESMTP id i7H6g4ep005212; Tue, 17 Aug 2004 10:42:04 +0400 (MSD) (envelope-from maxim@macomnet.ru) Date: Tue, 17 Aug 2004 10:42:04 +0400 (MSD) From: Maxim Konovalov To: Jeremy Chadwick In-Reply-To: <20040817060556.GA7458@parodius.com> Message-ID: <20040817102003.P5098@mp2.macomnet.net> References: <20040817060556.GA7458@parodius.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: luigi@freebsd.org cc: freebsd-current@freebsd.org Subject: Re: ipfw2 net.inet.ip.fw.verbose_limit broken X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2004 06:42:07 -0000 [ CC: Luigi ] On Mon, 16 Aug 2004, 23:05-0700, Jeremy Chadwick wrote: > Just wanted to toss this one up here. Also, apologies for not > cross-posting this to freebsd-ipfw, but I'm not on the list; although > they seem to be aware of it: > > http://lists.freebsd.org/mailman/htdig/freebsd-ipfw/2004-July/001239.html > > Seems that ipfw2's support for net.inet.ip.fw.verbose_limit is, to > put it bluntly, broken. This applies to both -STABLE and -CURRENT. > The following PR has been sitting around for quite some time... > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/46080 > > I've managed to confirm this still exists even as of an August 5th build > of -CURRENT. Using `logamount' directives per rule works properly as > a workaround. > > I've also looked at the patch, although I'm not sure about the performance > implications of looking up a sysctl value per packet with a matching > ipfw2 `log' directive. > > The ipfw2 code isn't something I feel even remotely comfortable tinkering > with, so if someone could take a poke at this (or contact the correct > people), that'd be great. I discussed that patch with Luigi almost two years ago but Luigi was against it because a changing net.inet.ip.fw.verbose_limit does not affect the existent rules. While I more or less agree with Luigi I think we should commit this code until we find a more correct or more logic solution. The current version of the patch is below. Index: ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.54 diff -u -r1.54 ipfw2.c --- ipfw2.c 12 Aug 2004 22:06:55 -0000 1.54 +++ ipfw2.c 17 Aug 2004 06:37:48 -0000 @@ -2775,6 +2775,7 @@ * various flags used to record that we entered some fields. */ ipfw_insn *have_state = NULL; /* check-state or keep-state */ + size_t len; int i; @@ -2956,6 +2957,12 @@ errx(EX_DATAERR, "logamount must be positive"); c->max_log = l; ac--; av++; + } else { + len = sizeof(c->max_log); + if (sysctlbyname("net.inet.ip.fw.verbose_limit", + &c->max_log, &len, NULL, 0) == -1) + errx(1, "sysctlbyname(\"%s\")", + "net.inet.ip.fw.verbose_limit"); } cmd = next_cmd(cmd); } %%% -- Maxim Konovalov