Date: Thu, 3 Oct 2002 13:22:39 -0700 From: Luigi Rizzo <rizzo@icir.org> To: Andrey Simonenko <simon@simon.org.ua> Cc: freebsd-net@FreeBSD.ORG Subject: Re: Q about sbin/ipfw2.c:list() Message-ID: <20021003132239.B64754@carp.icir.org> In-Reply-To: <20021003215546.M7110-100000@lion.com.ua>; from simon@simon.org.ua on Thu, Oct 03, 2002 at 10:04:41PM %2B0300 References: <20021002062546.C22163@iguana.icir.org> <20021003215546.M7110-100000@lion.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021003132239.B64754>