diff options
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index dbc51af69017..924158393d04 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1265,6 +1265,31 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, | |||
1265 | return ifp != NULL; | 1265 | return ifp != NULL; |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev) | ||
1269 | { | ||
1270 | struct inet6_dev *idev; | ||
1271 | struct inet6_ifaddr *ifa; | ||
1272 | int onlink; | ||
1273 | |||
1274 | onlink = 0; | ||
1275 | rcu_read_lock(); | ||
1276 | idev = __in6_dev_get(dev); | ||
1277 | if (idev) { | ||
1278 | read_lock_bh(&idev->lock); | ||
1279 | for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) { | ||
1280 | onlink = ipv6_prefix_equal(addr, &ifa->addr, | ||
1281 | ifa->prefix_len); | ||
1282 | if (onlink) | ||
1283 | break; | ||
1284 | } | ||
1285 | read_unlock_bh(&idev->lock); | ||
1286 | } | ||
1287 | rcu_read_unlock(); | ||
1288 | return onlink; | ||
1289 | } | ||
1290 | |||
1291 | EXPORT_SYMBOL(ipv6_chk_prefix); | ||
1292 | |||
1268 | struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr, | 1293 | struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr, |
1269 | struct net_device *dev, int strict) | 1294 | struct net_device *dev, int strict) |
1270 | { | 1295 | { |