Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2012 21:22:16 +0000
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        freebsd-net@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org>, John Baldwin <jhb@FreeBSD.org>
Subject:   Re: Transitioning if_addr_lock to an rwlock
Message-ID:  <1AA3AF93-E622-4B3F-B882-9F0439364A91@FreeBSD.org>
In-Reply-To: <20111229225539.GD12721@FreeBSD.org>
References:  <201112221130.01823.jhb@freebsd.org> <201112291527.26763.jhb@freebsd.org> <20111229225539.GD12721@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29. Dec 2011, at 22:55 , Gleb Smirnoff wrote:

> 3) I've found that in6_ifawithifp() doesn't do what it is supposed
> to, as well as uses incorrect locking during this. As last resort
> it should run through global list of addresses, not run throgh the
> ifp one again. Patch attached.

the first half of the patch is simple style which either goes on its own
or not at all please.

I think the second half of the patch is wrong.  Mislead by either the
KAME rev 1.1 comment or the locking.  The locking sneaked in at
http://svnweb.freebsd.org/base?view=revision&revision=194971
and I am not sure why reading it now.  I guess an oversight by both
Robert and I.

The difference between the first and 2nd loop is the scope check and it's
an "withifp" function, meaning we want an address of that interface and
if you look at the highly expensive part in ip6_output() where we call it
we expect the address to be on the given interface or to not be returned.

So I'd say fix the locking and be done (and don't do the besta -> ia) change.

If we want to optimize all this we might ponder to cache the first non-scope
matching address and the 1st non-scope matching deprecated address and
return that saving the 2nd loop.  However not sure if the 2nd loop or the
ifa_ref()s would be more expensive...

Also wonder that for Apple...
http://fxr.watson.org/fxr/source/bsd/netinet6/in6.c?v=xnu-1699.24.8#L3042

/bz

-- 
Bjoern A. Zeeb                                 You have to have visions!
   It does not matter how good you are. It matters what good you do!




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1AA3AF93-E622-4B3F-B882-9F0439364A91>