Message ID | 1350409047.3954.1295.camel@edumazet-glaptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
2012/10/16 Eric Dumazet <eric.dumazet@gmail.com>: > From: Eric Dumazet <edumazet@google.com> > > Commit 1d5783030a1 (ipv6/addrconf: speedup /proc/net/if_inet6 filling) > added bugs hiding some devices from if_inet6 and breaking applications. > > "ip -6 addr" could still display all IPv6 addresses, while "ifconfig -a" > couldnt. > > One way to reproduce the bug is by starting in a shell : > > unshare -n /bin/bash > ifconfig lo up > > And in original net namespace, lo device disappeared from if_inet6 > > Reported-by: Jan Hinnerk Stosch <janhinnerk.stosch@gmail.com> > Signed-off-by: Eric Dumazet <edumazet@google.com> > Cc: Mihai Maruseac <mihai.maruseac@gmail.com> > --- > Please Jan test following fix, thanks ! > > net/ipv6/addrconf.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c > index d7c56f8..0424e4e 100644 > --- a/net/ipv6/addrconf.c > +++ b/net/ipv6/addrconf.c > @@ -3064,14 +3064,15 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos) > struct hlist_node *n; > hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], > addr_lst) { > + if (!net_eq(dev_net(ifa->idev->dev), net)) > + continue; > /* sync with offset */ > if (p < state->offset) { > p++; > continue; > } > state->offset++; > - if (net_eq(dev_net(ifa->idev->dev), net)) > - return ifa; > + return ifa; > } > > /* prepare for next bucket */ > @@ -3089,18 +3090,20 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, > struct hlist_node *n = &ifa->addr_lst; > > hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) { > + if (!net_eq(dev_net(ifa->idev->dev), net)) > + continue; > state->offset++; > - if (net_eq(dev_net(ifa->idev->dev), net)) > - return ifa; > + return ifa; > } > > while (++state->bucket < IN6_ADDR_HSIZE) { > state->offset = 0; > hlist_for_each_entry_rcu_bh(ifa, n, > &inet6_addr_lst[state->bucket], addr_lst) { > + if (!net_eq(dev_net(ifa->idev->dev), net)) > + continue; > state->offset++; > - if (net_eq(dev_net(ifa->idev->dev), net)) > - return ifa; > + return ifa; > } > } > > > Yes, everything works fine again. Thank you very much! -- 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
From: Jan Hinnerk Stosch <janhinnerk.stosch@gmail.com> Date: Tue, 16 Oct 2012 20:30:19 +0200 > 2012/10/16 Eric Dumazet <eric.dumazet@gmail.com>: >> From: Eric Dumazet <edumazet@google.com> >> >> Commit 1d5783030a1 (ipv6/addrconf: speedup /proc/net/if_inet6 filling) >> added bugs hiding some devices from if_inet6 and breaking applications. >> >> "ip -6 addr" could still display all IPv6 addresses, while "ifconfig -a" >> couldnt. >> >> One way to reproduce the bug is by starting in a shell : >> >> unshare -n /bin/bash >> ifconfig lo up >> >> And in original net namespace, lo device disappeared from if_inet6 >> >> Reported-by: Jan Hinnerk Stosch <janhinnerk.stosch@gmail.com> >> Signed-off-by: Eric Dumazet <edumazet@google.com> >> Cc: Mihai Maruseac <mihai.maruseac@gmail.com> ... > Yes, everything works fine again. Thank you very much! Thanks for testing. -- 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
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Tue, 16 Oct 2012 19:37:27 +0200 > From: Eric Dumazet <edumazet@google.com> > > Commit 1d5783030a1 (ipv6/addrconf: speedup /proc/net/if_inet6 filling) > added bugs hiding some devices from if_inet6 and breaking applications. > > "ip -6 addr" could still display all IPv6 addresses, while "ifconfig -a" > couldnt. > > One way to reproduce the bug is by starting in a shell : > > unshare -n /bin/bash > ifconfig lo up > > And in original net namespace, lo device disappeared from if_inet6 > > Reported-by: Jan Hinnerk Stosch <janhinnerk.stosch@gmail.com> > Signed-off-by: Eric Dumazet <edumazet@google.com> > Cc: Mihai Maruseac <mihai.maruseac@gmail.com> Applied and queued up for -stable, thanks. -- 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
On Tue, 2012-10-16 at 20:30 +0200, Jan Hinnerk Stosch wrote: > 2012/10/16 Eric Dumazet <eric.dumazet@gmail.com>: > > From: Eric Dumazet <edumazet@google.com> > > > > Commit 1d5783030a1 (ipv6/addrconf: speedup /proc/net/if_inet6 filling) > > added bugs hiding some devices from if_inet6 and breaking applications. > > > > "ip -6 addr" could still display all IPv6 addresses, while "ifconfig -a" > > couldnt. Thanks Eric and Jan. Well done. -- 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
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d7c56f8..0424e4e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3064,14 +3064,15 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos) struct hlist_node *n; hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], addr_lst) { + if (!net_eq(dev_net(ifa->idev->dev), net)) + continue; /* sync with offset */ if (p < state->offset) { p++; continue; } state->offset++; - if (net_eq(dev_net(ifa->idev->dev), net)) - return ifa; + return ifa; } /* prepare for next bucket */ @@ -3089,18 +3090,20 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct hlist_node *n = &ifa->addr_lst; hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) { + if (!net_eq(dev_net(ifa->idev->dev), net)) + continue; state->offset++; - if (net_eq(dev_net(ifa->idev->dev), net)) - return ifa; + return ifa; } while (++state->bucket < IN6_ADDR_HSIZE) { state->offset = 0; hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], addr_lst) { + if (!net_eq(dev_net(ifa->idev->dev), net)) + continue; state->offset++; - if (net_eq(dev_net(ifa->idev->dev), net)) - return ifa; + return ifa; } }