Date: Sat, 24 Dec 2011 19:58:20 -0500 From: John Baldwin <jhb@FreeBSD.org> To: Sergey Kandaurov <pluknet@gmail.com> Cc: Bjoern Zeeb <bz@freebsd.org>, net@freebsd.org Subject: Re: [PATCH] Minor fixes to netinet6/icmp6.c Message-ID: <4EF6752C.4040109@FreeBSD.org> In-Reply-To: <CAE-mSOLryQb6n0RcxM=LHFCLN=25Tfk5bLnLjK1e5XbU5ncmWw@mail.gmail.com> References: <201112231446.38057.jhb@freebsd.org> <CAE-mSOLryQb6n0RcxM=LHFCLN=25Tfk5bLnLjK1e5XbU5ncmWw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/23/11 6:38 PM, Sergey Kandaurov wrote:
> On 23 December 2011 23:46, John Baldwin<jhb@freebsd.org> wrote:
>> I found these nits while working on the patches to convert if_addr_mtx to an
>> rwlock. The first change is cosmetic, it just un-inlines a TAILQ_FOREACH().
>> The second change is an actual bug. The code is currently reading
>> TAILQ_FIRST(&V_ifnet) without holding the appropriate lock.
>>
>> Index: icmp6.c
>> ===================================================================
>> --- icmp6.c (revision 228777)
>> +++ icmp6.c (working copy)
>> @@ -1780,7 +1780,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf
>> }
>>
>> IFNET_RLOCK_NOSLEEP();
>> - for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
>> + TAILQ_FOREACH(ifp,&V_ifnet, if_list) {
>> addrsofif = 0;
>> IF_ADDR_LOCK(ifp);
>> TAILQ_FOREACH(ifa,&ifp->if_addrhead, ifa_link) {
>
> FWIW, there are much more of them in netinet6.
> Some time ago I started to un-expand them to queue(3).
> [not unfinished yet..]
I went ahead and did a sweep for queue(3) changes in netinet6. I went a
bit further and removed things like the ndpr_next hack, etc. This only
includes queue(3) changes though, not your other fixes like moving
common code out of blocks. I also fixed a few places to use *_EMPTY()
instead of checking *_FIRST() against NULL. There should be no
functional change.
http://www.FreeBSD.org/~jhb/patches/inet6_queue.patch
--
John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EF6752C.4040109>
