aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-15 22:54:23 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-04-02 21:06:00 -0400
commit52eeeb8481d705e61e2e9aae974e7799a93783e9 (patch)
tree6ced371b81334f07926e7bdc190fc2efa396659f /net/ipv6/sit.c
parent6294e000736401d4415ad41f408e56e14aaaf7b4 (diff)
[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/sit.c')
-rw-r--r--net/ipv6/sit.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 08a483a8de50..cc16fe07bbff 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -344,31 +344,6 @@ out:
344 return 0; 344 return 0;
345} 345}
346 346
347/* copied directly from anycast.c */
348static int
349ipip6_onlink(struct in6_addr *addr, struct net_device *dev)
350{
351 struct inet6_dev *idev;
352 struct inet6_ifaddr *ifa;
353 int onlink;
354
355 onlink = 0;
356 rcu_read_lock();
357 idev = __in6_dev_get(dev);
358 if (idev) {
359 read_lock_bh(&idev->lock);
360 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) {
361 onlink = ipv6_prefix_equal(addr, &ifa->addr,
362 ifa->prefix_len);
363 if (onlink)
364 break;
365 }
366 read_unlock_bh(&idev->lock);
367 }
368 rcu_read_unlock();
369 return onlink;
370}
371
372static int 347static int
373isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t) 348isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t)
374{ 349{
@@ -386,7 +361,7 @@ isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t)
386 struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; 361 struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr;
387 if (ipv6_addr_is_isatap(addr6) && 362 if (ipv6_addr_is_isatap(addr6) &&
388 (addr6->s6_addr32[3] == iph->saddr) && 363 (addr6->s6_addr32[3] == iph->saddr) &&
389 ipip6_onlink(addr6, t->dev)) 364 ipv6_chk_prefix(addr6, t->dev))
390 skb->ndisc_nodetype = NDISC_NODETYPE_HOST; 365 skb->ndisc_nodetype = NDISC_NODETYPE_HOST;
391 else 366 else
392 ok = 0; 367 ok = 0;