From owner-freebsd-net Thu Oct 3 13:22:41 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 55C1F37B401 for ; Thu, 3 Oct 2002 13:22:40 -0700 (PDT) Received: from carp.icir.org (carp.icir.org [192.150.187.71]) by mx1.FreeBSD.org (Postfix) with ESMTP id 02C6243E42 for ; Thu, 3 Oct 2002 13:22:40 -0700 (PDT) (envelope-from rizzo@carp.icir.org) Received: from carp.icir.org (localhost [127.0.0.1]) by carp.icir.org (8.12.3/8.11.3) with ESMTP id g93KMdvv064844; Thu, 3 Oct 2002 13:22:39 -0700 (PDT) (envelope-from rizzo@carp.icir.org) Received: (from rizzo@localhost) by carp.icir.org (8.12.3/8.12.3/Submit) id g93KMdFB064843; Thu, 3 Oct 2002 13:22:39 -0700 (PDT) (envelope-from rizzo) Date: Thu, 3 Oct 2002 13:22:39 -0700 From: Luigi Rizzo To: Andrey Simonenko Cc: freebsd-net@FreeBSD.ORG Subject: Re: Q about sbin/ipfw2.c:list() Message-ID: <20021003132239.B64754@carp.icir.org> References: <20021002062546.C22163@iguana.icir.org> <20021003215546.M7110-100000@lion.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20021003215546.M7110-100000@lion.com.ua>; from simon@simon.org.ua on Thu, Oct 03, 2002 at 10:04:41PM +0300 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org indeed you are right -- then one can probably remove the additional check. cheers luigi On Thu, Oct 03, 2002 at 10:04:41PM +0300, Andrey Simonenko wrote: ... > Why is it possible that getsockopt(IP_FW_GET) can return not all IPFW2 > rules? According to ipfw(8) manual page there is always a rule 65535, so > this rule should be always present after getsockopt(IP_FW_GET) call (of > course there should be enought memory in a buffer, but it is checked in > the code of list() function): > > /* get rules or pipes from kernel, resizing array as necessary */ > nbytes = nalloc; > > while (nbytes >= nalloc) { > nalloc = nalloc * 2 + 200; > nbytes = nalloc; > if ((data = realloc(data, nbytes)) == NULL) > err(EX_OSERR, "realloc"); > if (getsockopt(s, IPPROTO_IP, ocmd, data, &nbytes) < 0) > err(EX_OSERR, "getsockopt(IP_%s_GET)", > do_pipe ? "DUMMYNET" : "FW"); > } > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message