summaryrefslogtreecommitdiff
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-16 05:54:23 +0300
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-04-03 05:06:00 +0400
commit52eeeb8481d705e61e2e9aae974e7799a93783e9 (patch)
tree6ced371b81334f07926e7bdc190fc2efa396659f /net/ipv6/addrconf.c
parent6294e000736401d4415ad41f408e56e14aaaf7b4 (diff)
downloadlinux-52eeeb8481d705e61e2e9aae974e7799a93783e9.tar.xz
[IPV6]: Unify ip6_onlink() and ipip6_onlink().
Both are identical, let's create ipv6_chk_prefix() and use it in both places.
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5ab9973571ef..c17f8c0b933e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1249,6 +1249,31 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
return ifp != NULL;
}
+int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev)
+{
+ struct inet6_dev *idev;
+ struct inet6_ifaddr *ifa;
+ int onlink;
+
+ onlink = 0;
+ rcu_read_lock();
+ idev = __in6_dev_get(dev);
+ if (idev) {
+ read_lock_bh(&idev->lock);
+ for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) {
+ onlink = ipv6_prefix_equal(addr, &ifa->addr,
+ ifa->prefix_len);
+ if (onlink)
+ break;
+ }
+ read_unlock_bh(&idev->lock);
+ }
+ rcu_read_unlock();
+ return onlink;
+}
+
+EXPORT_SYMBOL(ipv6_chk_prefix);
+
struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr,
struct net_device *dev, int strict)
{