addrconf.c (7159039a128fa0a73ca7b532f6e1d30d9885277f) | addrconf.c (95c385b4d5a71b8ad552aecaa968ea46d7da2f6a) |
---|---|
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 * --- 516 unchanged lines hidden (view full) --- 525 ifa->timer.data = (unsigned long) ifa; 526 ifa->scope = scope; 527 ifa->prefix_len = pfxlen; 528 ifa->flags = flags | IFA_F_TENTATIVE; 529 ifa->cstamp = ifa->tstamp = jiffies; 530 531 ifa->rt = rt; 532 | 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 * --- 516 unchanged lines hidden (view full) --- 525 ifa->timer.data = (unsigned long) ifa; 526 ifa->scope = scope; 527 ifa->prefix_len = pfxlen; 528 ifa->flags = flags | IFA_F_TENTATIVE; 529 ifa->cstamp = ifa->tstamp = jiffies; 530 531 ifa->rt = rt; 532 |
533 /* 534 * part one of RFC 4429, section 3.3 535 * We should not configure an address as 536 * optimistic if we do not yet know the link 537 * layer address of our nexhop router 538 */ 539 540 if (rt->rt6i_nexthop == NULL) 541 ifa->flags &= ~IFA_F_OPTIMISTIC; 542 |
|
533 ifa->idev = idev; 534 in6_dev_hold(idev); 535 /* For caller */ 536 in6_ifa_hold(ifa); 537 538 /* Add to big hash table */ 539 hash = ipv6_addr_hash(addr); 540 --- 160 unchanged lines hidden (view full) --- 701static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *ift) 702{ 703 struct inet6_dev *idev = ifp->idev; 704 struct in6_addr addr, *tmpaddr; 705 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp; 706 int tmp_plen; 707 int ret = 0; 708 int max_addresses; | 543 ifa->idev = idev; 544 in6_dev_hold(idev); 545 /* For caller */ 546 in6_ifa_hold(ifa); 547 548 /* Add to big hash table */ 549 hash = ipv6_addr_hash(addr); 550 --- 160 unchanged lines hidden (view full) --- 711static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *ift) 712{ 713 struct inet6_dev *idev = ifp->idev; 714 struct in6_addr addr, *tmpaddr; 715 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp; 716 int tmp_plen; 717 int ret = 0; 718 int max_addresses; |
719 u32 addr_flags; |
|
709 710 write_lock(&idev->lock); 711 if (ift) { 712 spin_lock_bh(&ift->lock); 713 memcpy(&addr.s6_addr[8], &ift->addr.s6_addr[8], 8); 714 spin_unlock_bh(&ift->lock); 715 tmpaddr = &addr; 716 } else { --- 41 unchanged lines hidden (view full) --- 758 idev->cnf.temp_prefered_lft - desync_factor / HZ); 759 tmp_plen = ifp->prefix_len; 760 max_addresses = idev->cnf.max_addresses; 761 tmp_cstamp = ifp->cstamp; 762 tmp_tstamp = ifp->tstamp; 763 spin_unlock_bh(&ifp->lock); 764 765 write_unlock(&idev->lock); | 720 721 write_lock(&idev->lock); 722 if (ift) { 723 spin_lock_bh(&ift->lock); 724 memcpy(&addr.s6_addr[8], &ift->addr.s6_addr[8], 8); 725 spin_unlock_bh(&ift->lock); 726 tmpaddr = &addr; 727 } else { --- 41 unchanged lines hidden (view full) --- 769 idev->cnf.temp_prefered_lft - desync_factor / HZ); 770 tmp_plen = ifp->prefix_len; 771 max_addresses = idev->cnf.max_addresses; 772 tmp_cstamp = ifp->cstamp; 773 tmp_tstamp = ifp->tstamp; 774 spin_unlock_bh(&ifp->lock); 775 776 write_unlock(&idev->lock); |
777 778 addr_flags = IFA_F_TEMPORARY; 779 /* set in addrconf_prefix_rcv() */ 780 if (ifp->flags & IFA_F_OPTIMISTIC) 781 addr_flags |= IFA_F_OPTIMISTIC; 782 |
|
766 ift = !max_addresses || 767 ipv6_count_addresses(idev) < max_addresses ? 768 ipv6_add_addr(idev, &addr, tmp_plen, | 783 ift = !max_addresses || 784 ipv6_count_addresses(idev) < max_addresses ? 785 ipv6_add_addr(idev, &addr, tmp_plen, |
769 ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, IFA_F_TEMPORARY) : NULL; | 786 ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 787 addr_flags) : NULL; |
770 if (!ift || IS_ERR(ift)) { 771 in6_ifa_put(ifp); 772 in6_dev_put(idev); 773 printk(KERN_INFO 774 "ipv6_create_tempaddr(): retry temporary address regeneration.\n"); 775 tmpaddr = &addr; 776 write_lock(&idev->lock); 777 goto retry; --- 115 unchanged lines hidden (view full) --- 893 struct ipv6_saddr_score score; 894 895 score.addr_type = __ipv6_addr_type(&ifa->addr); 896 897 /* Rule 0: 898 * - Tentative Address (RFC2462 section 5.4) 899 * - A tentative address is not considered 900 * "assigned to an interface" in the traditional | 788 if (!ift || IS_ERR(ift)) { 789 in6_ifa_put(ifp); 790 in6_dev_put(idev); 791 printk(KERN_INFO 792 "ipv6_create_tempaddr(): retry temporary address regeneration.\n"); 793 tmpaddr = &addr; 794 write_lock(&idev->lock); 795 goto retry; --- 115 unchanged lines hidden (view full) --- 911 struct ipv6_saddr_score score; 912 913 score.addr_type = __ipv6_addr_type(&ifa->addr); 914 915 /* Rule 0: 916 * - Tentative Address (RFC2462 section 5.4) 917 * - A tentative address is not considered 918 * "assigned to an interface" in the traditional |
901 * sense. | 919 * sense, unless it is also flagged as optimistic. |
902 * - Candidate Source Address (section 4) 903 * - In any case, anycast addresses, multicast 904 * addresses, and the unspecified address MUST 905 * NOT be included in a candidate set. 906 */ | 920 * - Candidate Source Address (section 4) 921 * - In any case, anycast addresses, multicast 922 * addresses, and the unspecified address MUST 923 * NOT be included in a candidate set. 924 */ |
907 if (ifa->flags & IFA_F_TENTATIVE) | 925 if ((ifa->flags & IFA_F_TENTATIVE) && 926 (!(ifa->flags & IFA_F_OPTIMISTIC))) |
908 continue; 909 if (unlikely(score.addr_type == IPV6_ADDR_ANY || 910 score.addr_type & IPV6_ADDR_MULTICAST)) { 911 LIMIT_NETDEBUG(KERN_DEBUG 912 "ADDRCONF: unspecified / multicast address" 913 "assigned as unicast address on %s", 914 dev->name); 915 continue; --- 42 unchanged lines hidden (view full) --- 958 if (score.scope < daddr_scope) 959 break; /* addresses sorted by scope */ 960 else { 961 score.rule = 2; 962 goto record_it; 963 } 964 } 965 | 927 continue; 928 if (unlikely(score.addr_type == IPV6_ADDR_ANY || 929 score.addr_type & IPV6_ADDR_MULTICAST)) { 930 LIMIT_NETDEBUG(KERN_DEBUG 931 "ADDRCONF: unspecified / multicast address" 932 "assigned as unicast address on %s", 933 dev->name); 934 continue; --- 42 unchanged lines hidden (view full) --- 977 if (score.scope < daddr_scope) 978 break; /* addresses sorted by scope */ 979 else { 980 score.rule = 2; 981 goto record_it; 982 } 983 } 984 |
966 /* Rule 3: Avoid deprecated address */ | 985 /* Rule 3: Avoid deprecated and optimistic addresses */ |
967 if (hiscore.rule < 3) { 968 if (ipv6_saddr_preferred(hiscore.addr_type) || | 986 if (hiscore.rule < 3) { 987 if (ipv6_saddr_preferred(hiscore.addr_type) || |
969 !(ifa_result->flags & IFA_F_DEPRECATED)) | 988 (((ifa_result->flags & 989 (IFA_F_DEPRECATED|IFA_F_OPTIMISTIC)) == 0))) |
970 hiscore.attrs |= IPV6_SADDR_SCORE_PREFERRED; 971 hiscore.rule++; 972 } 973 if (ipv6_saddr_preferred(score.addr_type) || | 990 hiscore.attrs |= IPV6_SADDR_SCORE_PREFERRED; 991 hiscore.rule++; 992 } 993 if (ipv6_saddr_preferred(score.addr_type) || |
974 !(ifa->flags & IFA_F_DEPRECATED)) { | 994 (((ifa_result->flags & 995 (IFA_F_DEPRECATED|IFA_F_OPTIMISTIC)) == 0))) { |
975 score.attrs |= IPV6_SADDR_SCORE_PREFERRED; 976 if (!(hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED)) { 977 score.rule = 3; 978 goto record_it; 979 } 980 } else { 981 if (hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED) 982 continue; --- 123 unchanged lines hidden (view full) --- 1106int ipv6_get_saddr(struct dst_entry *dst, 1107 struct in6_addr *daddr, struct in6_addr *saddr) 1108{ 1109 return ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, daddr, saddr); 1110} 1111 1112EXPORT_SYMBOL(ipv6_get_saddr); 1113 | 996 score.attrs |= IPV6_SADDR_SCORE_PREFERRED; 997 if (!(hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED)) { 998 score.rule = 3; 999 goto record_it; 1000 } 1001 } else { 1002 if (hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED) 1003 continue; --- 123 unchanged lines hidden (view full) --- 1127int ipv6_get_saddr(struct dst_entry *dst, 1128 struct in6_addr *daddr, struct in6_addr *saddr) 1129{ 1130 return ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, daddr, saddr); 1131} 1132 1133EXPORT_SYMBOL(ipv6_get_saddr); 1134 |
1114int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr) | 1135int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, 1136 unsigned char banned_flags) |
1115{ 1116 struct inet6_dev *idev; 1117 int err = -EADDRNOTAVAIL; 1118 1119 rcu_read_lock(); 1120 if ((idev = __in6_dev_get(dev)) != NULL) { 1121 struct inet6_ifaddr *ifp; 1122 1123 read_lock_bh(&idev->lock); 1124 for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { | 1137{ 1138 struct inet6_dev *idev; 1139 int err = -EADDRNOTAVAIL; 1140 1141 rcu_read_lock(); 1142 if ((idev = __in6_dev_get(dev)) != NULL) { 1143 struct inet6_ifaddr *ifp; 1144 1145 read_lock_bh(&idev->lock); 1146 for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { |
1125 if (ifp->scope == IFA_LINK && !(ifp->flags&IFA_F_TENTATIVE)) { | 1147 if (ifp->scope == IFA_LINK && !(ifp->flags & banned_flags)) { |
1126 ipv6_addr_copy(addr, &ifp->addr); 1127 err = 0; 1128 break; 1129 } 1130 } 1131 read_unlock_bh(&idev->lock); 1132 } 1133 rcu_read_unlock(); --- 535 unchanged lines hidden (view full) --- 1669 return; 1670 1671ok: 1672 1673 ifp = ipv6_get_ifaddr(&addr, dev, 1); 1674 1675 if (ifp == NULL && valid_lft) { 1676 int max_addresses = in6_dev->cnf.max_addresses; | 1148 ipv6_addr_copy(addr, &ifp->addr); 1149 err = 0; 1150 break; 1151 } 1152 } 1153 read_unlock_bh(&idev->lock); 1154 } 1155 rcu_read_unlock(); --- 535 unchanged lines hidden (view full) --- 1691 return; 1692 1693ok: 1694 1695 ifp = ipv6_get_ifaddr(&addr, dev, 1); 1696 1697 if (ifp == NULL && valid_lft) { 1698 int max_addresses = in6_dev->cnf.max_addresses; |
1699 u32 addr_flags = 0; |
|
1677 | 1700 |
1701#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 1702 if (in6_dev->cnf.optimistic_dad && 1703 !ipv6_devconf.forwarding) 1704 addr_flags = IFA_F_OPTIMISTIC; 1705#endif 1706 |
|
1678 /* Do not allow to create too much of autoconfigured 1679 * addresses; this would be too easy way to crash kernel. 1680 */ 1681 if (!max_addresses || 1682 ipv6_count_addresses(in6_dev) < max_addresses) 1683 ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, | 1707 /* Do not allow to create too much of autoconfigured 1708 * addresses; this would be too easy way to crash kernel. 1709 */ 1710 if (!max_addresses || 1711 ipv6_count_addresses(in6_dev) < max_addresses) 1712 ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, |
1684 addr_type&IPV6_ADDR_SCOPE_MASK, 0); | 1713 addr_type&IPV6_ADDR_SCOPE_MASK, 1714 addr_flags); |
1685 1686 if (!ifp || IS_ERR(ifp)) { 1687 in6_dev_put(in6_dev); 1688 return; 1689 } 1690 1691 update_lft = create = 1; 1692 ifp->cstamp = jiffies; --- 191 unchanged lines hidden (view full) --- 1884 spin_lock_bh(&ifp->lock); 1885 ifp->valid_lft = valid_lft; 1886 ifp->prefered_lft = prefered_lft; 1887 ifp->tstamp = jiffies; 1888 spin_unlock_bh(&ifp->lock); 1889 1890 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 1891 jiffies_to_clock_t(valid_lft * HZ), flags); | 1715 1716 if (!ifp || IS_ERR(ifp)) { 1717 in6_dev_put(in6_dev); 1718 return; 1719 } 1720 1721 update_lft = create = 1; 1722 ifp->cstamp = jiffies; --- 191 unchanged lines hidden (view full) --- 1914 spin_lock_bh(&ifp->lock); 1915 ifp->valid_lft = valid_lft; 1916 ifp->prefered_lft = prefered_lft; 1917 ifp->tstamp = jiffies; 1918 spin_unlock_bh(&ifp->lock); 1919 1920 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 1921 jiffies_to_clock_t(valid_lft * HZ), flags); |
1922 /* 1923 * Note that section 3.1 of RFC 4429 indicates 1924 * that the Optimistic flag should not be set for 1925 * manually configured addresses 1926 */ |
|
1892 addrconf_dad_start(ifp, 0); 1893 in6_ifa_put(ifp); 1894 addrconf_verify(0); 1895 return 0; 1896 } 1897 1898 return PTR_ERR(ifp); 1899} --- 160 unchanged lines hidden (view full) --- 2060 ipv6_ifa_notify(RTM_NEWADDR, ifp); 2061 in6_ifa_put(ifp); 2062 } 2063} 2064 2065static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr) 2066{ 2067 struct inet6_ifaddr * ifp; | 1927 addrconf_dad_start(ifp, 0); 1928 in6_ifa_put(ifp); 1929 addrconf_verify(0); 1930 return 0; 1931 } 1932 1933 return PTR_ERR(ifp); 1934} --- 160 unchanged lines hidden (view full) --- 2095 ipv6_ifa_notify(RTM_NEWADDR, ifp); 2096 in6_ifa_put(ifp); 2097 } 2098} 2099 2100static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr) 2101{ 2102 struct inet6_ifaddr * ifp; |
2103 u32 addr_flags = IFA_F_PERMANENT; |
|
2068 | 2104 |
2069 ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT); | 2105#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 2106 if (idev->cnf.optimistic_dad && 2107 !ipv6_devconf.forwarding) 2108 addr_flags |= IFA_F_OPTIMISTIC; 2109#endif 2110 2111 2112 ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); |
2070 if (!IS_ERR(ifp)) { 2071 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); 2072 addrconf_dad_start(ifp, 0); 2073 in6_ifa_put(ifp); 2074 } 2075} 2076 2077static void addrconf_dev_config(struct net_device *dev) --- 51 unchanged lines hidden (view full) --- 2129} 2130#endif 2131 2132static inline int 2133ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev) 2134{ 2135 struct in6_addr lladdr; 2136 | 2113 if (!IS_ERR(ifp)) { 2114 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); 2115 addrconf_dad_start(ifp, 0); 2116 in6_ifa_put(ifp); 2117 } 2118} 2119 2120static void addrconf_dev_config(struct net_device *dev) --- 51 unchanged lines hidden (view full) --- 2172} 2173#endif 2174 2175static inline int 2176ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev) 2177{ 2178 struct in6_addr lladdr; 2179 |
2137 if (!ipv6_get_lladdr(link_dev, &lladdr)) { | 2180 if (!ipv6_get_lladdr(link_dev, &lladdr, IFA_F_TENTATIVE)) { |
2138 addrconf_add_linklocal(idev, &lladdr); 2139 return 0; 2140 } 2141 return -1; 2142} 2143 2144static void ip6_tnl_add_linklocal(struct inet6_dev *idev) 2145{ --- 328 unchanged lines hidden (view full) --- 2474/* 2475 * Duplicate Address Detection 2476 */ 2477static void addrconf_dad_kick(struct inet6_ifaddr *ifp) 2478{ 2479 unsigned long rand_num; 2480 struct inet6_dev *idev = ifp->idev; 2481 | 2181 addrconf_add_linklocal(idev, &lladdr); 2182 return 0; 2183 } 2184 return -1; 2185} 2186 2187static void ip6_tnl_add_linklocal(struct inet6_dev *idev) 2188{ --- 328 unchanged lines hidden (view full) --- 2517/* 2518 * Duplicate Address Detection 2519 */ 2520static void addrconf_dad_kick(struct inet6_ifaddr *ifp) 2521{ 2522 unsigned long rand_num; 2523 struct inet6_dev *idev = ifp->idev; 2524 |
2482 rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); | 2525 if (ifp->flags & IFA_F_OPTIMISTIC) 2526 rand_num = 0; 2527 else 2528 rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); 2529 |
2483 ifp->probes = idev->cnf.dad_transmits; 2484 addrconf_mod_timer(ifp, AC_DAD, rand_num); 2485} 2486 2487static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) 2488{ 2489 struct inet6_dev *idev = ifp->idev; 2490 struct net_device *dev = idev->dev; --- 5 unchanged lines hidden (view full) --- 2496 read_lock_bh(&idev->lock); 2497 if (ifp->dead) 2498 goto out; 2499 spin_lock_bh(&ifp->lock); 2500 2501 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) || 2502 !(ifp->flags&IFA_F_TENTATIVE) || 2503 ifp->flags & IFA_F_NODAD) { | 2530 ifp->probes = idev->cnf.dad_transmits; 2531 addrconf_mod_timer(ifp, AC_DAD, rand_num); 2532} 2533 2534static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) 2535{ 2536 struct inet6_dev *idev = ifp->idev; 2537 struct net_device *dev = idev->dev; --- 5 unchanged lines hidden (view full) --- 2543 read_lock_bh(&idev->lock); 2544 if (ifp->dead) 2545 goto out; 2546 spin_lock_bh(&ifp->lock); 2547 2548 if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) || 2549 !(ifp->flags&IFA_F_TENTATIVE) || 2550 ifp->flags & IFA_F_NODAD) { |
2504 ifp->flags &= ~IFA_F_TENTATIVE; | 2551 ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC); |
2505 spin_unlock_bh(&ifp->lock); 2506 read_unlock_bh(&idev->lock); 2507 2508 addrconf_dad_completed(ifp); 2509 return; 2510 } 2511 2512 if (!(idev->if_flags & IF_READY)) { 2513 spin_unlock_bh(&ifp->lock); 2514 read_unlock_bh(&idev->lock); 2515 /* 2516 * If the defice is not ready: 2517 * - keep it tentative if it is a permanent address. 2518 * - otherwise, kill it. 2519 */ 2520 in6_ifa_hold(ifp); 2521 addrconf_dad_stop(ifp); 2522 return; 2523 } | 2552 spin_unlock_bh(&ifp->lock); 2553 read_unlock_bh(&idev->lock); 2554 2555 addrconf_dad_completed(ifp); 2556 return; 2557 } 2558 2559 if (!(idev->if_flags & IF_READY)) { 2560 spin_unlock_bh(&ifp->lock); 2561 read_unlock_bh(&idev->lock); 2562 /* 2563 * If the defice is not ready: 2564 * - keep it tentative if it is a permanent address. 2565 * - otherwise, kill it. 2566 */ 2567 in6_ifa_hold(ifp); 2568 addrconf_dad_stop(ifp); 2569 return; 2570 } |
2571 2572 /* 2573 * Optimistic nodes can start receiving 2574 * Frames right away 2575 */ 2576 if(ifp->flags & IFA_F_OPTIMISTIC) 2577 ip6_ins_rt(ifp->rt); 2578 |
|
2524 addrconf_dad_kick(ifp); 2525 spin_unlock_bh(&ifp->lock); 2526out: 2527 read_unlock_bh(&idev->lock); 2528} 2529 2530static void addrconf_dad_timer(unsigned long data) 2531{ --- 8 unchanged lines hidden (view full) --- 2540 goto out; 2541 } 2542 spin_lock_bh(&ifp->lock); 2543 if (ifp->probes == 0) { 2544 /* 2545 * DAD was successful 2546 */ 2547 | 2579 addrconf_dad_kick(ifp); 2580 spin_unlock_bh(&ifp->lock); 2581out: 2582 read_unlock_bh(&idev->lock); 2583} 2584 2585static void addrconf_dad_timer(unsigned long data) 2586{ --- 8 unchanged lines hidden (view full) --- 2595 goto out; 2596 } 2597 spin_lock_bh(&ifp->lock); 2598 if (ifp->probes == 0) { 2599 /* 2600 * DAD was successful 2601 */ 2602 |
2548 ifp->flags &= ~IFA_F_TENTATIVE; | 2603 ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC); |
2549 spin_unlock_bh(&ifp->lock); 2550 read_unlock_bh(&idev->lock); 2551 2552 addrconf_dad_completed(ifp); 2553 2554 goto out; 2555 } 2556 --- 802 unchanged lines hidden (view full) --- 3359 array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; 3360 array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; 3361#ifdef CONFIG_IPV6_ROUTE_INFO 3362 array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; 3363#endif 3364#endif 3365 array[DEVCONF_PROXY_NDP] = cnf->proxy_ndp; 3366 array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route; | 2604 spin_unlock_bh(&ifp->lock); 2605 read_unlock_bh(&idev->lock); 2606 2607 addrconf_dad_completed(ifp); 2608 2609 goto out; 2610 } 2611 --- 802 unchanged lines hidden (view full) --- 3414 array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; 3415 array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; 3416#ifdef CONFIG_IPV6_ROUTE_INFO 3417 array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; 3418#endif 3419#endif 3420 array[DEVCONF_PROXY_NDP] = cnf->proxy_ndp; 3421 array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route; |
3422#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 3423 array[DEVCONF_OPTIMISTIC_DAD] = cnf->optimistic_dad; 3424#endif |
|
3367} 3368 3369static inline size_t inet6_if_nlmsg_size(void) 3370{ 3371 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 3372 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 3373 + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ 3374 + nla_total_size(4) /* IFLA_MTU */ --- 198 unchanged lines hidden (view full) --- 3573}; 3574 3575static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3576{ 3577 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 3578 3579 switch (event) { 3580 case RTM_NEWADDR: | 3425} 3426 3427static inline size_t inet6_if_nlmsg_size(void) 3428{ 3429 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 3430 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 3431 + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ 3432 + nla_total_size(4) /* IFLA_MTU */ --- 198 unchanged lines hidden (view full) --- 3631}; 3632 3633static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3634{ 3635 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 3636 3637 switch (event) { 3638 case RTM_NEWADDR: |
3581 ip6_ins_rt(ifp->rt); | 3639 /* 3640 * If the address was optimistic 3641 * we inserted the route at the start of 3642 * our DAD process, so we don't need 3643 * to do it again 3644 */ 3645 if (!(ifp->rt->rt6i_node)) 3646 ip6_ins_rt(ifp->rt); |
3582 if (ifp->idev->cnf.forwarding) 3583 addrconf_join_anycast(ifp); 3584 break; 3585 case RTM_DELADDR: 3586 if (ifp->idev->cnf.forwarding) 3587 addrconf_leave_anycast(ifp); 3588 addrconf_leave_solict(ifp->idev, &ifp->addr); 3589 dst_hold(&ifp->rt->u.dst); --- 304 unchanged lines hidden (view full) --- 3894 { 3895 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, 3896 .procname = "accept_source_route", 3897 .data = &ipv6_devconf.accept_source_route, 3898 .maxlen = sizeof(int), 3899 .mode = 0644, 3900 .proc_handler = &proc_dointvec, 3901 }, | 3647 if (ifp->idev->cnf.forwarding) 3648 addrconf_join_anycast(ifp); 3649 break; 3650 case RTM_DELADDR: 3651 if (ifp->idev->cnf.forwarding) 3652 addrconf_leave_anycast(ifp); 3653 addrconf_leave_solict(ifp->idev, &ifp->addr); 3654 dst_hold(&ifp->rt->u.dst); --- 304 unchanged lines hidden (view full) --- 3959 { 3960 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, 3961 .procname = "accept_source_route", 3962 .data = &ipv6_devconf.accept_source_route, 3963 .maxlen = sizeof(int), 3964 .mode = 0644, 3965 .proc_handler = &proc_dointvec, 3966 }, |
3967#ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
|
3902 { | 3968 { |
3969 .ctl_name = CTL_UNNUMBERED, 3970 .procname = "optimistic_dad", 3971 .data = &ipv6_devconf.optimistic_dad, 3972 .maxlen = sizeof(int), 3973 .mode = 0644, 3974 .proc_handler = &proc_dointvec, 3975 3976 }, 3977#endif 3978 { |
|
3903 .ctl_name = 0, /* sentinel */ 3904 } 3905 }, 3906 .addrconf_dev = { 3907 { 3908 .ctl_name = NET_PROTO_CONF_ALL, 3909 .procname = "all", 3910 .mode = 0555, --- 230 unchanged lines hidden --- | 3979 .ctl_name = 0, /* sentinel */ 3980 } 3981 }, 3982 .addrconf_dev = { 3983 { 3984 .ctl_name = NET_PROTO_CONF_ALL, 3985 .procname = "all", 3986 .mode = 0555, --- 230 unchanged lines hidden --- |