diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-01-11 01:43:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:45 -0500 |
commit | 06bfe655e7db7719c0eb51eb420fb9c2a6aa1e00 (patch) | |
tree | 6343c97d6004f9153c1f367bd4e23095ec612d4f /net/ipv6/addrconf.c | |
parent | bfeade087005278fc8cafe230b7658a4f40c5acb (diff) |
[NETNS][IPV6]: inet6_addr - ipv6_chk_same_addr namespace aware
This patch makes ipv6_chk_same_addr function to be aware of the
network namespace. The addresses not belonging to the network
namespace are discarded.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f35c3df410df..41cc31ee297e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -149,7 +149,8 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); | |||
149 | 149 | ||
150 | static void inet6_prefix_notify(int event, struct inet6_dev *idev, | 150 | static void inet6_prefix_notify(int event, struct inet6_dev *idev, |
151 | struct prefix_info *pinfo); | 151 | struct prefix_info *pinfo); |
152 | static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); | 152 | static int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, |
153 | struct net_device *dev); | ||
153 | 154 | ||
154 | static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); | 155 | static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); |
155 | 156 | ||
@@ -560,7 +561,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
560 | write_lock(&addrconf_hash_lock); | 561 | write_lock(&addrconf_hash_lock); |
561 | 562 | ||
562 | /* Ignore adding duplicate addresses on an interface */ | 563 | /* Ignore adding duplicate addresses on an interface */ |
563 | if (ipv6_chk_same_addr(addr, idev->dev)) { | 564 | if (ipv6_chk_same_addr(&init_net, addr, idev->dev)) { |
564 | ADBG(("ipv6_add_addr: already assigned\n")); | 565 | ADBG(("ipv6_add_addr: already assigned\n")); |
565 | err = -EEXIST; | 566 | err = -EEXIST; |
566 | goto out; | 567 | goto out; |
@@ -1229,12 +1230,15 @@ int ipv6_chk_addr(struct net *net, struct in6_addr *addr, | |||
1229 | EXPORT_SYMBOL(ipv6_chk_addr); | 1230 | EXPORT_SYMBOL(ipv6_chk_addr); |
1230 | 1231 | ||
1231 | static | 1232 | static |
1232 | int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev) | 1233 | int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, |
1234 | struct net_device *dev) | ||
1233 | { | 1235 | { |
1234 | struct inet6_ifaddr * ifp; | 1236 | struct inet6_ifaddr * ifp; |
1235 | u8 hash = ipv6_addr_hash(addr); | 1237 | u8 hash = ipv6_addr_hash(addr); |
1236 | 1238 | ||
1237 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { | 1239 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { |
1240 | if (ifp->idev->dev->nd_net != net) | ||
1241 | continue; | ||
1238 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1242 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
1239 | if (dev == NULL || ifp->idev->dev == dev) | 1243 | if (dev == NULL || ifp->idev->dev == dev) |
1240 | break; | 1244 | break; |