The inet6_addr_lst is browsed taking into account the network namespace specified as parameter. If an address does not belong to the specified namespace, it is ignored. In order to reduce the scope of the patch, a wrapper has been created to not impact all the callers. The next patch will remove this wrapper and change all the wrappers to take into account this new parameter. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery --- include/net/addrconf.h | 15 ++++++++++++--- net/ipv6/addrconf.c | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) Index: linux-2.6-netns/include/net/addrconf.h =================================================================== --- linux-2.6-netns.orig/include/net/addrconf.h +++ linux-2.6-netns/include/net/addrconf.h @@ -66,9 +66,18 @@ extern int ipv6_chk_addr(struct net *n #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) extern int ipv6_chk_home_addr(struct in6_addr *addr); #endif -extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, - struct net_device *dev, - int strict); +extern struct inet6_ifaddr *__ipv6_get_ifaddr(struct net *net, + struct in6_addr *addr, + struct net_device *dev, + int strict); + +static inline struct inet6_ifaddr *ipv6_get_ifaddr(struct in6_addr *addr, + struct net_device *dev, + int strict) +{ + return __ipv6_get_ifaddr(&init_net, addr, dev, strict); +} + extern int ipv6_get_saddr(struct dst_entry *dst, struct in6_addr *daddr, struct in6_addr *saddr); Index: linux-2.6-netns/net/ipv6/addrconf.c =================================================================== --- linux-2.6-netns.orig/net/ipv6/addrconf.c +++ linux-2.6-netns/net/ipv6/addrconf.c @@ -1223,13 +1223,16 @@ int ipv6_chk_same_addr(struct net *net, return ifp != NULL; } -struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, struct net_device *dev, int strict) +struct inet6_ifaddr * __ipv6_get_ifaddr(struct net *net, struct in6_addr *addr, + struct net_device *dev, int strict) { struct inet6_ifaddr * ifp; u8 hash = ipv6_addr_hash(addr); read_lock_bh(&addrconf_hash_lock); for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { + if (ifp->idev->dev->nd_net != net) + continue; if (ipv6_addr_equal(&ifp->addr, addr)) { if (dev == NULL || ifp->idev->dev == dev || !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)) { -- _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers