Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2002 14:15:42 +0300 (EEST)
From:      Andrey Simonenko <simon@simon.org.ua>
To:        freebsd-net@freebsd.org
Subject:   Q about sbin/ipfw2.c:list()
Message-ID:  <20021002141006.A1093-100000@lion.com.ua>

next in thread | raw e-mail | index | archive | help
Hello,

Why is it needed to check both r->rulenum and (void *)r < lim in
sbin/ipfw2.c:list() ?

	/*
	 * Count static rules. They have variable size so we
	 * need to scan the list to count them.
	 */
	for (nstat = 1, r = data, lim = data + nbytes;
		    r->rulenum < 65535 && (void *)r < lim;
		    ++nstat, r = (void *)r + RULESIZE(r) )
		; /* nothing */

Can I simply check r->rulenum < 65535 as it is done in sbin/ipfw.c:list()
?

TIA

ps: please CC to my email.


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?20021002141006.A1093-100000>