addrconf.c (9acd9f3ae92d0dc0ca7504fb48c1040e8bbc39fe) | addrconf.c (f3ee4010e84452aa133e5163e6cfabc52b194e94) |
---|---|
1/* 2 * IPv6 Address [auto]configuration 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * --- 208 unchanged lines hidden (view full) --- 217#endif 218 .proxy_ndp = 0, 219 .accept_source_route = 0, /* we do not accept RH0 by default. */ 220}; 221 222/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ 223const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 224const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; | 1/* 2 * IPv6 Address [auto]configuration 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * --- 208 unchanged lines hidden (view full) --- 217#endif 218 .proxy_ndp = 0, 219 .accept_source_route = 0, /* we do not accept RH0 by default. */ 220}; 221 222/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ 223const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 224const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; |
225const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT; 226const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; |
|
225 226/* Check if a valid qdisc is available */ 227static inline int addrconf_qdisc_ok(struct net_device *dev) 228{ 229 return (dev->qdisc != &noop_qdisc); 230} 231 232static void addrconf_del_timer(struct inet6_ifaddr *ifp) --- 83 unchanged lines hidden (view full) --- 316 call_rcu(&idev->rcu, in6_dev_finish_destroy_rcu); 317} 318 319EXPORT_SYMBOL(in6_dev_finish_destroy); 320 321static struct inet6_dev * ipv6_add_dev(struct net_device *dev) 322{ 323 struct inet6_dev *ndev; | 227 228/* Check if a valid qdisc is available */ 229static inline int addrconf_qdisc_ok(struct net_device *dev) 230{ 231 return (dev->qdisc != &noop_qdisc); 232} 233 234static void addrconf_del_timer(struct inet6_ifaddr *ifp) --- 83 unchanged lines hidden (view full) --- 318 call_rcu(&idev->rcu, in6_dev_finish_destroy_rcu); 319} 320 321EXPORT_SYMBOL(in6_dev_finish_destroy); 322 323static struct inet6_dev * ipv6_add_dev(struct net_device *dev) 324{ 325 struct inet6_dev *ndev; |
324 struct in6_addr maddr; | |
325 326 ASSERT_RTNL(); 327 328 if (dev->mtu < IPV6_MIN_MTU) 329 return NULL; 330 331 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); 332 --- 68 unchanged lines hidden (view full) --- 401 402 ipv6_mc_init_dev(ndev); 403 ndev->tstamp = jiffies; 404 addrconf_sysctl_register(ndev); 405 /* protected by rtnl_lock */ 406 rcu_assign_pointer(dev->ip6_ptr, ndev); 407 408 /* Join all-node multicast group */ | 326 327 ASSERT_RTNL(); 328 329 if (dev->mtu < IPV6_MIN_MTU) 330 return NULL; 331 332 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); 333 --- 68 unchanged lines hidden (view full) --- 402 403 ipv6_mc_init_dev(ndev); 404 ndev->tstamp = jiffies; 405 addrconf_sysctl_register(ndev); 406 /* protected by rtnl_lock */ 407 rcu_assign_pointer(dev->ip6_ptr, ndev); 408 409 /* Join all-node multicast group */ |
409 ipv6_addr_all_nodes(&maddr); 410 ipv6_dev_mc_inc(dev, &maddr); | 410 ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes); |
411 412 return ndev; 413} 414 415struct inet6_dev * ipv6_find_idev(struct net_device *dev) 416{ 417 struct inet6_dev *idev; 418 --- 9 unchanged lines hidden (view full) --- 428 return idev; 429} 430 431#ifdef CONFIG_SYSCTL 432static void dev_forward_change(struct inet6_dev *idev) 433{ 434 struct net_device *dev; 435 struct inet6_ifaddr *ifa; | 411 412 return ndev; 413} 414 415struct inet6_dev * ipv6_find_idev(struct net_device *dev) 416{ 417 struct inet6_dev *idev; 418 --- 9 unchanged lines hidden (view full) --- 428 return idev; 429} 430 431#ifdef CONFIG_SYSCTL 432static void dev_forward_change(struct inet6_dev *idev) 433{ 434 struct net_device *dev; 435 struct inet6_ifaddr *ifa; |
436 struct in6_addr addr; | |
437 438 if (!idev) 439 return; 440 dev = idev->dev; 441 if (dev && (dev->flags & IFF_MULTICAST)) { | 436 437 if (!idev) 438 return; 439 dev = idev->dev; 440 if (dev && (dev->flags & IFF_MULTICAST)) { |
442 ipv6_addr_all_routers(&addr); 443 | |
444 if (idev->cnf.forwarding) | 441 if (idev->cnf.forwarding) |
445 ipv6_dev_mc_inc(dev, &addr); | 442 ipv6_dev_mc_inc(dev, &in6addr_linklocal_allrouters); |
446 else | 443 else |
447 ipv6_dev_mc_dec(dev, &addr); | 444 ipv6_dev_mc_dec(dev, &in6addr_linklocal_allrouters); |
448 } 449 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { 450 if (ifa->flags&IFA_F_TENTATIVE) 451 continue; 452 if (idev->cnf.forwarding) 453 addrconf_join_anycast(ifa); 454 else 455 addrconf_leave_anycast(ifa); --- 2193 unchanged lines hidden (view full) --- 2649 * Announcement received after solicitation 2650 * was sent 2651 */ 2652 goto out; 2653 } 2654 2655 spin_lock(&ifp->lock); 2656 if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) { | 445 } 446 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { 447 if (ifa->flags&IFA_F_TENTATIVE) 448 continue; 449 if (idev->cnf.forwarding) 450 addrconf_join_anycast(ifa); 451 else 452 addrconf_leave_anycast(ifa); --- 2193 unchanged lines hidden (view full) --- 2646 * Announcement received after solicitation 2647 * was sent 2648 */ 2649 goto out; 2650 } 2651 2652 spin_lock(&ifp->lock); 2653 if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) { |
2657 struct in6_addr all_routers; 2658 | |
2659 /* The wait after the last probe can be shorter */ 2660 addrconf_mod_timer(ifp, AC_RS, 2661 (ifp->probes == ifp->idev->cnf.rtr_solicits) ? 2662 ifp->idev->cnf.rtr_solicit_delay : 2663 ifp->idev->cnf.rtr_solicit_interval); 2664 spin_unlock(&ifp->lock); 2665 | 2654 /* The wait after the last probe can be shorter */ 2655 addrconf_mod_timer(ifp, AC_RS, 2656 (ifp->probes == ifp->idev->cnf.rtr_solicits) ? 2657 ifp->idev->cnf.rtr_solicit_delay : 2658 ifp->idev->cnf.rtr_solicit_interval); 2659 spin_unlock(&ifp->lock); 2660 |
2666 ipv6_addr_all_routers(&all_routers); 2667 2668 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers); | 2661 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters); |
2669 } else { 2670 spin_unlock(&ifp->lock); 2671 /* 2672 * Note: we do not support deprecated "all on-link" 2673 * assumption any longer. 2674 */ 2675 printk(KERN_DEBUG "%s: no IPv6 routers present\n", 2676 ifp->idev->dev->name); --- 124 unchanged lines hidden (view full) --- 2801 /* If added prefix is link local and forwarding is off, 2802 start sending router solicitations. 2803 */ 2804 2805 if (ifp->idev->cnf.forwarding == 0 && 2806 ifp->idev->cnf.rtr_solicits > 0 && 2807 (dev->flags&IFF_LOOPBACK) == 0 && 2808 (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { | 2662 } else { 2663 spin_unlock(&ifp->lock); 2664 /* 2665 * Note: we do not support deprecated "all on-link" 2666 * assumption any longer. 2667 */ 2668 printk(KERN_DEBUG "%s: no IPv6 routers present\n", 2669 ifp->idev->dev->name); --- 124 unchanged lines hidden (view full) --- 2794 /* If added prefix is link local and forwarding is off, 2795 start sending router solicitations. 2796 */ 2797 2798 if (ifp->idev->cnf.forwarding == 0 && 2799 ifp->idev->cnf.rtr_solicits > 0 && 2800 (dev->flags&IFF_LOOPBACK) == 0 && 2801 (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { |
2809 struct in6_addr all_routers; 2810 2811 ipv6_addr_all_routers(&all_routers); 2812 | |
2813 /* 2814 * If a host as already performed a random delay 2815 * [...] as part of DAD [...] there is no need 2816 * to delay again before sending the first RS 2817 */ | 2802 /* 2803 * If a host as already performed a random delay 2804 * [...] as part of DAD [...] there is no need 2805 * to delay again before sending the first RS 2806 */ |
2818 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers); | 2807 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters); |
2819 2820 spin_lock_bh(&ifp->lock); 2821 ifp->probes = 1; 2822 ifp->idev->if_flags |= IF_RS_SENT; 2823 addrconf_mod_timer(ifp, AC_RS, ifp->idev->cnf.rtr_solicit_interval); 2824 spin_unlock_bh(&ifp->lock); 2825 } 2826} --- 1658 unchanged lines hidden --- | 2808 2809 spin_lock_bh(&ifp->lock); 2810 ifp->probes = 1; 2811 ifp->idev->if_flags |= IF_RS_SENT; 2812 addrconf_mod_timer(ifp, AC_RS, ifp->idev->cnf.rtr_solicit_interval); 2813 spin_unlock_bh(&ifp->lock); 2814 } 2815} --- 1658 unchanged lines hidden --- |