Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 01:28:48 -0800
From:      Bill Fumerola <billf@mu.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        net@freebsd.org, hackers@freebsd.org
Subject:   Re: in_pcblookup_hash() called multiple times
Message-ID:  <20020307092848.GX803@elvis.mu.org>
In-Reply-To: <3C86BD6B.3ADCB4F0@mindspring.com>
References:  <3C86BD6B.3ADCB4F0@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 06, 2002 at 05:07:55PM -0800, Terry Lambert wrote:

> There are redundant calls to the in_pcblookup_hash() in the
> ip_fw_chk() function called via (*ip_fw_chk_ptr)() in the
> ip_input path.

in addition to what you're talking about, ipfw will repeat the hash
lookup for every rule it goes through that has a uid or gid keyword.

http://people.freebsd.org/~billf/bsdcon2000/presentation/graphics/countudpfromanytoanyuidbillf.png
http://people.freebsd.org/~billf/bsdcon2000/presentation/graphics/counttcpfromanytoanyuidbillf.png

'old ipfw' = ipfw as of oct 2000
'new ipfw' = ipfw w/pcb cache + uid cache (as part of a compiled ruleset)

in the compiled case, in_pcblookup_hash() is called the first time a uid
needs compared. after that, uid lookups become a integer compare and not
another call to in_pcblookup_hash(). gid lookups still use groupmember()
each rule, but also don't have to do a pcb lookup each time.

> Right now, I'm just talking about a way ip_input could pass
> the already looked up input inpcb to tcp_input, udp_input,
> or udp_ctlinput -- all of which repeat the lookup operation.

my results are with a cached lookup just in the ipfw code, but if
ip_input() did the lookup and passed it to both ipfw and the protocol
handler that would be nice.

-- 
- bill fumerola / fumerola@yahoo-inc.com / billf@FreeBSD.org / billf@mu.org



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?20020307092848.GX803>