aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-01-11 01:43:18 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:44 -0500
commitbfeade087005278fc8cafe230b7658a4f40c5acb (patch)
treed9bbacab07552cc6c33f9f022a34af2391d9ecc1 /net/ipv6/addrconf.c
parent3c40090a0f5b69deecc5ca615f994957f949333d (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.c6
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
1209int ipv6_chk_addr(struct in6_addr *addr, struct net_device *dev, int strict) 1209int 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
1227EXPORT_SYMBOL(ipv6_chk_addr); 1229EXPORT_SYMBOL(ipv6_chk_addr);
1228 1230
1229static 1231static