From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: hannes@stressinduktion.org
Subject: Re: ipv6 addrconfg warn_on hit: WARN_ON(ifp->idev->valid_ll_addr_cnt < 0);
Date: Thu, 16 Jan 2014 18:27:06 +0100 [thread overview]
Message-ID: <20140116172706.GC7961@minipsycho.orion> (raw)
In-Reply-To: <20140116151812.GI7436@order.stressinduktion.org>
Thu, Jan 16, 2014 at 04:18:12PM CET, hannes@stressinduktion.org wrote:
>On Thu, Jan 16, 2014 at 03:38:17PM +0100, Hannes Frederic Sowa wrote:
>> On Thu, Jan 16, 2014 at 03:07:01PM +0100, Jiri Pirko wrote:
>> > Thu, Jan 16, 2014 at 02:53:23PM CET, jiri@resnulli.us wrote:
>> > >Hi Hannes.
>> > >
>> > >WARN_ON(ifp->idev->valid_ll_addr_cnt < 0);
>> > >
>> > >We did hit once this warning during the tests. The person who hit this
>> > >says that it was during the setup of many macvlan devices.
>> > >
>> > >I examined the code but I'm not sure how this could happen. Looks like a
>> > >race condition between addrconf_dad_completed() and addrconf_ifdown().
>> > >Not sure how to easily resolve that though.
>>
>> That seems to be the case. Actually we don't need to count precisiely
>> here, we just must precisiely identify the situation where the first
>> LL address comes into operational state. Maybe we can implement this
>> somehow differently. I'll play with the code soon.
>
>Maybe something like this and then throw out the whole ll counting stuff:
>
>diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>index 6913a82..105105a 100644
>--- a/net/ipv6/addrconf.c
>+++ b/net/ipv6/addrconf.c
>@@ -3233,6 +3233,19 @@ out:
> in6_ifa_put(ifp);
> }
>
>+/* idev must be at least read locked */
>+static bool ipv6_lonely_lladdr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
>+{
>+ bool ret = true;
>+ struct inet6_ifaddr *ifpiter;
>+
>+ list_for_each_entry(ifpiter, &idev->addr_list, if_list) {
>+ if (ifp != ifpiter && ifpiter->scope == IFA_LINK)
>+ ret = false;
>+ }
>+ return ret;
>+}
>+
> static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
> {
> struct net_device *dev = ifp->idev->dev;
>@@ -3253,8 +3266,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
>
> read_lock_bh(&ifp->idev->lock);
> spin_lock(&ifp->lock);
>- send_mld = ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL &&
>- ifp->idev->valid_ll_addr_cnt == 1;
>+ send_mld = ifp->scope == IFA_LINK && ipv6_lonely_lladdr(ifp->idev, ifp);
> send_rs = send_mld &&
> ipv6_accept_ra(ifp->idev) &&
> ifp->idev->cnf.rtr_solicits > 0 &&
Sounds sane to me. Would you care to submit this please?
Do not forget to remove all the valid_ll_addr_cnt stuff :)
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-01-16 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 13:53 ipv6 addrconfg warn_on hit: WARN_ON(ifp->idev->valid_ll_addr_cnt < 0); Jiri Pirko
2014-01-16 14:07 ` Jiri Pirko
2014-01-16 14:38 ` Hannes Frederic Sowa
2014-01-16 15:18 ` Hannes Frederic Sowa
2014-01-16 17:27 ` Jiri Pirko [this message]
2014-01-16 17:31 ` Hannes Frederic Sowa
2014-01-16 19:13 ` [PATCH net] ipv6: simplify detection of first operational link-local address on interface Hannes Frederic Sowa
2014-01-16 20:15 ` Brian Haley
2014-01-16 20:27 ` Hannes Frederic Sowa
2014-01-16 21:20 ` Flavio Leitner
2014-01-16 21:47 ` Jiri Pirko
2014-01-18 2:10 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140116172706.GC7961@minipsycho.orion \
--to=jiri@resnulli.us \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).