diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-01-11 01:43:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:44 -0500 |
commit | bfeade087005278fc8cafe230b7658a4f40c5acb (patch) | |
tree | d9bbacab07552cc6c33f9f022a34af2391d9ecc1 /net/ipv6/addrconf.c | |
parent | 3c40090a0f5b69deecc5ca615f994957f949333d (diff) |
[NETNS][IPV6]: inet6_addr - check ipv6 address per namespace
When a new address is added, we must check if the new address does not
already exists. This patch makes this check to be aware of a network
namespace, so the check will look if the address already exists for
the specified network namespace. While the addresses are browsed, the
addresses which do not belong to the 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 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d7b440343e97..f35c3df410df 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1206,13 +1206,16 @@ static int ipv6_count_addresses(struct inet6_dev *idev) | |||
1206 | return cnt; | 1206 | return cnt; |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | int ipv6_chk_addr(struct in6_addr *addr, struct net_device *dev, int strict) | 1209 | int ipv6_chk_addr(struct net *net, struct in6_addr *addr, |
1210 | struct net_device *dev, int strict) | ||
1210 | { | 1211 | { |
1211 | struct inet6_ifaddr * ifp; | 1212 | struct inet6_ifaddr * ifp; |
1212 | u8 hash = ipv6_addr_hash(addr); | 1213 | u8 hash = ipv6_addr_hash(addr); |
1213 | 1214 | ||
1214 | read_lock_bh(&addrconf_hash_lock); | 1215 | read_lock_bh(&addrconf_hash_lock); |
1215 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { | 1216 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { |
1217 | if (ifp->idev->dev->nd_net != net) | ||
1218 | continue; | ||
1216 | if (ipv6_addr_equal(&ifp->addr, addr) && | 1219 | if (ipv6_addr_equal(&ifp->addr, addr) && |
1217 | !(ifp->flags&IFA_F_TENTATIVE)) { | 1220 | !(ifp->flags&IFA_F_TENTATIVE)) { |
1218 | if (dev == NULL || ifp->idev->dev == dev || | 1221 | if (dev == NULL || ifp->idev->dev == dev || |
@@ -1223,7 +1226,6 @@ int ipv6_chk_addr(struct in6_addr *addr, struct net_device *dev, int strict) | |||
1223 | read_unlock_bh(&addrconf_hash_lock); | 1226 | read_unlock_bh(&addrconf_hash_lock); |
1224 | return ifp != NULL; | 1227 | return ifp != NULL; |
1225 | } | 1228 | } |
1226 | |||
1227 | EXPORT_SYMBOL(ipv6_chk_addr); | 1229 | EXPORT_SYMBOL(ipv6_chk_addr); |
1228 | 1230 | ||
1229 | static | 1231 | static |