Lines Matching refs:idev
126 static int addrconf_sysctl_register(struct inet6_dev *idev);
127 static void addrconf_sysctl_unregister(struct inet6_dev *idev);
129 static inline int addrconf_sysctl_register(struct inet6_dev *idev) in addrconf_sysctl_register() argument
134 static inline void addrconf_sysctl_unregister(struct inet6_dev *idev) in addrconf_sysctl_unregister() argument
142 static int ipv6_count_addresses(const struct inet6_dev *idev);
145 const struct inet6_dev *idev);
179 static void addrconf_dad_run(struct inet6_dev *idev, bool restart);
184 static void inet6_prefix_notify(int event, struct inet6_dev *idev,
313 static void addrconf_del_rs_timer(struct inet6_dev *idev) in addrconf_del_rs_timer() argument
315 if (del_timer(&idev->rs_timer)) in addrconf_del_rs_timer()
316 __in6_dev_put(idev); in addrconf_del_rs_timer()
325 static void addrconf_mod_rs_timer(struct inet6_dev *idev, in addrconf_mod_rs_timer() argument
328 if (!timer_pending(&idev->rs_timer)) in addrconf_mod_rs_timer()
329 in6_dev_hold(idev); in addrconf_mod_rs_timer()
330 mod_timer(&idev->rs_timer, jiffies + when); in addrconf_mod_rs_timer()
341 static int snmp6_alloc_dev(struct inet6_dev *idev) in snmp6_alloc_dev() argument
345 idev->stats.ipv6 = alloc_percpu(struct ipstats_mib); in snmp6_alloc_dev()
346 if (!idev->stats.ipv6) in snmp6_alloc_dev()
351 addrconf_stats = per_cpu_ptr(idev->stats.ipv6, i); in snmp6_alloc_dev()
356 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), in snmp6_alloc_dev()
358 if (!idev->stats.icmpv6dev) in snmp6_alloc_dev()
360 idev->stats.icmpv6msgdev = kzalloc(sizeof(struct icmpv6msg_mib_device), in snmp6_alloc_dev()
362 if (!idev->stats.icmpv6msgdev) in snmp6_alloc_dev()
368 kfree(idev->stats.icmpv6dev); in snmp6_alloc_dev()
370 free_percpu(idev->stats.ipv6); in snmp6_alloc_dev()
485 struct inet6_dev *idev; in ipv6_find_idev() local
489 idev = __in6_dev_get(dev); in ipv6_find_idev()
490 if (!idev) { in ipv6_find_idev()
491 idev = ipv6_add_dev(dev); in ipv6_find_idev()
492 if (IS_ERR(idev)) in ipv6_find_idev()
493 return idev; in ipv6_find_idev()
497 ipv6_mc_up(idev); in ipv6_find_idev()
498 return idev; in ipv6_find_idev()
719 struct inet6_dev *idev; in inet6_netconf_dump_devconf() local
749 idev = __in6_dev_get(dev); in inet6_netconf_dump_devconf()
750 if (!idev) in inet6_netconf_dump_devconf()
754 &idev->cnf, in inet6_netconf_dump_devconf()
799 static void dev_forward_change(struct inet6_dev *idev) in dev_forward_change() argument
804 if (!idev) in dev_forward_change()
806 dev = idev->dev; in dev_forward_change()
807 if (idev->cnf.forwarding) in dev_forward_change()
810 if (idev->cnf.forwarding) { in dev_forward_change()
821 list_for_each_entry(ifa, &idev->addr_list, if_list) { in dev_forward_change()
824 if (idev->cnf.forwarding) in dev_forward_change()
831 dev->ifindex, &idev->cnf); in dev_forward_change()
838 struct inet6_dev *idev; in addrconf_forward_change() local
841 idev = __in6_dev_get(dev); in addrconf_forward_change()
842 if (idev) { in addrconf_forward_change()
843 int changed = (!idev->cnf.forwarding) ^ (!newf); in addrconf_forward_change()
844 idev->cnf.forwarding = newf; in addrconf_forward_change()
846 dev_forward_change(idev); in addrconf_forward_change()
901 struct inet6_dev *idev; in addrconf_linkdown_change() local
904 idev = __in6_dev_get(dev); in addrconf_linkdown_change()
905 if (idev) { in addrconf_linkdown_change()
906 int changed = (!idev->cnf.ignore_routes_with_linkdown) ^ (!newf); in addrconf_linkdown_change()
908 idev->cnf.ignore_routes_with_linkdown = newf; in addrconf_linkdown_change()
914 &idev->cnf); in addrconf_linkdown_change()
968 in6_dev_put(ifp->idev); in inet6_ifa_finish_destroy()
983 ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp) in ipv6_link_dev_addr() argument
992 list_for_each(p, &idev->addr_list) { in ipv6_link_dev_addr()
1015 if (!net_eq(dev_net(ifp->idev->dev), net)) in ipv6_chk_same_addr()
1018 if (!dev || ifp->idev->dev == dev) in ipv6_chk_same_addr()
1048 ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg, in ipv6_add_addr() argument
1053 struct net *net = dev_net(idev->dev); in ipv6_add_addr()
1061 (!(idev->dev->flags & IFF_LOOPBACK) && in ipv6_add_addr()
1062 !netif_is_l3_master(idev->dev) && in ipv6_add_addr()
1066 if (idev->dead) { in ipv6_add_addr()
1071 if (idev->cnf.disable_ipv6) { in ipv6_add_addr()
1082 .i6vi_dev = idev, in ipv6_add_addr()
1098 f6i = addrconf_f6i_alloc(net, idev, cfg->pfx, false, gfp_flags); in ipv6_add_addr()
1106 idev->cnf.disable_policy) in ipv6_add_addr()
1109 neigh_parms_data_state_setall(idev->nd_parms); in ipv6_add_addr()
1132 ifa->idev = idev; in ipv6_add_addr()
1133 in6_dev_hold(idev); in ipv6_add_addr()
1140 err = ipv6_add_addr_hash(idev->dev, ifa); in ipv6_add_addr()
1146 write_lock(&idev->lock); in ipv6_add_addr()
1149 ipv6_link_dev_addr(idev, ifa); in ipv6_add_addr()
1152 list_add(&ifa->tmp_list, &idev->tempaddr_list); in ipv6_add_addr()
1157 write_unlock(&idev->lock); in ipv6_add_addr()
1167 if (ifa->idev) in ipv6_add_addr()
1168 in6_dev_put(ifa->idev); in ipv6_add_addr()
1205 struct inet6_dev *idev = ifp->idev; in check_cleanup_prefix_route() local
1211 list_for_each_entry(ifa, &idev->addr_list, if_list) { in check_cleanup_prefix_route()
1247 ifp->idev->dev, 0, RTF_DEFAULT, true); in cleanup_prefix_route()
1250 ip6_del_rt(dev_net(ifp->idev->dev), f6i, false); in cleanup_prefix_route()
1282 write_lock_bh(&ifp->idev->lock); in ipv6_del_addr()
1299 write_unlock_bh(&ifp->idev->lock); in ipv6_del_addr()
1320 struct inet6_dev *idev = ifp->idev; in ipv6_create_tempaddr() local
1331 write_lock_bh(&idev->lock); in ipv6_create_tempaddr()
1334 in6_dev_hold(idev); in ipv6_create_tempaddr()
1335 if (idev->cnf.use_tempaddr <= 0) { in ipv6_create_tempaddr()
1336 write_unlock_bh(&idev->lock); in ipv6_create_tempaddr()
1338 in6_dev_put(idev); in ipv6_create_tempaddr()
1343 if (ifp->regen_count++ >= idev->cnf.regen_max_retry) { in ipv6_create_tempaddr()
1344 idev->cnf.use_tempaddr = -1; /*XXX*/ in ipv6_create_tempaddr()
1346 write_unlock_bh(&idev->lock); in ipv6_create_tempaddr()
1349 in6_dev_put(idev); in ipv6_create_tempaddr()
1359 regen_advance = idev->cnf.regen_max_retry * in ipv6_create_tempaddr()
1360 idev->cnf.dad_transmits * in ipv6_create_tempaddr()
1361 max(NEIGH_VAR(idev->nd_parms, RETRANS_TIME), HZ/100) / HZ; in ipv6_create_tempaddr()
1366 cnf_temp_preferred_lft = READ_ONCE(idev->cnf.temp_prefered_lft); in ipv6_create_tempaddr()
1368 idev->cnf.max_desync_factor, in ipv6_create_tempaddr()
1371 if (unlikely(idev->desync_factor > max_desync_factor)) { in ipv6_create_tempaddr()
1373 get_random_bytes(&idev->desync_factor, in ipv6_create_tempaddr()
1374 sizeof(idev->desync_factor)); in ipv6_create_tempaddr()
1375 idev->desync_factor %= max_desync_factor; in ipv6_create_tempaddr()
1377 idev->desync_factor = 0; in ipv6_create_tempaddr()
1383 idev->cnf.temp_valid_lft + age); in ipv6_create_tempaddr()
1384 cfg.preferred_lft = cnf_temp_preferred_lft + age - idev->desync_factor; in ipv6_create_tempaddr()
1391 write_unlock_bh(&idev->lock); in ipv6_create_tempaddr()
1403 in6_dev_put(idev); in ipv6_create_tempaddr()
1416 ift = ipv6_add_addr(idev, &cfg, block, NULL); in ipv6_create_tempaddr()
1419 in6_dev_put(idev); in ipv6_create_tempaddr()
1421 write_lock_bh(&idev->lock); in ipv6_create_tempaddr()
1433 in6_dev_put(idev); in ipv6_create_tempaddr()
1485 struct inet6_dev *idev) in ipv6_use_optimistic_addr() argument
1488 if (!idev) in ipv6_use_optimistic_addr()
1490 if (!net->ipv6.devconf_all->optimistic_dad && !idev->cnf.optimistic_dad) in ipv6_use_optimistic_addr()
1492 if (!net->ipv6.devconf_all->use_optimistic && !idev->cnf.use_optimistic) in ipv6_use_optimistic_addr()
1502 struct inet6_dev *idev) in ipv6_allow_optimistic_dad() argument
1505 if (!idev) in ipv6_allow_optimistic_dad()
1507 if (!net->ipv6.devconf_all->optimistic_dad && !idev->cnf.optimistic_dad) in ipv6_allow_optimistic_dad()
1580 if (!ipv6_use_optimistic_addr(net, score->ifa->idev)) in ipv6_get_saddr_eval()
1598 dst->ifindex == score->ifa->idev->dev->ifindex); in ipv6_get_saddr_eval()
1604 score->ifa->idev->dev->ifindex) == dst->label; in ipv6_get_saddr_eval()
1613 score->ifa->idev->cnf.use_tempaddr >= 2; in ipv6_get_saddr_eval()
1652 struct inet6_dev *idev, in __ipv6_dev_get_saddr() argument
1658 list_for_each_entry_rcu(score->ifa, &idev->addr_list, if_list) { in __ipv6_dev_get_saddr()
1680 idev->dev->name); in __ipv6_dev_get_saddr()
1729 struct inet6_dev *idev; in ipv6_get_saddr_master() local
1731 idev = __in6_dev_get(dst_dev); in ipv6_get_saddr_master()
1732 if (idev) in ipv6_get_saddr_master()
1733 hiscore_idx = __ipv6_dev_get_saddr(net, dst, idev, in ipv6_get_saddr_master()
1736 idev = __in6_dev_get(master); in ipv6_get_saddr_master()
1737 if (idev) in ipv6_get_saddr_master()
1738 hiscore_idx = __ipv6_dev_get_saddr(net, dst, idev, in ipv6_get_saddr_master()
1750 struct inet6_dev *idev; in ipv6_dev_get_saddr() local
1786 idev = __in6_dev_get(dst_dev); in ipv6_dev_get_saddr()
1789 (idev && idev->cnf.use_oif_addrs_only)) { in ipv6_dev_get_saddr()
1795 if (idev) in ipv6_dev_get_saddr()
1796 hiscore_idx = __ipv6_dev_get_saddr(net, &dst, idev, scores, hiscore_idx); in ipv6_dev_get_saddr()
1823 idev = __in6_dev_get(dev); in ipv6_dev_get_saddr()
1824 if (!idev) in ipv6_dev_get_saddr()
1826 hiscore_idx = __ipv6_dev_get_saddr(net, &dst, idev, scores, hiscore_idx); in ipv6_dev_get_saddr()
1842 int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, in __ipv6_get_lladdr() argument
1848 list_for_each_entry_reverse(ifp, &idev->addr_list, if_list) { in __ipv6_get_lladdr()
1864 struct inet6_dev *idev; in ipv6_get_lladdr() local
1868 idev = __in6_dev_get(dev); in ipv6_get_lladdr()
1869 if (idev) { in ipv6_get_lladdr()
1870 read_lock_bh(&idev->lock); in ipv6_get_lladdr()
1871 err = __ipv6_get_lladdr(idev, addr, banned_flags); in ipv6_get_lladdr()
1872 read_unlock_bh(&idev->lock); in ipv6_get_lladdr()
1878 static int ipv6_count_addresses(const struct inet6_dev *idev) in ipv6_count_addresses() argument
1884 list_for_each_entry_rcu(ifp, &idev->addr_list, if_list) in ipv6_count_addresses()
1924 ndev = ifp->idev->dev; in __ipv6_chk_addr_and_flags()
1967 const struct inet6_dev *idev; in ipv6_chk_custom_prefix() local
1971 idev = __in6_dev_get(dev); in ipv6_chk_custom_prefix()
1972 if (idev) { in ipv6_chk_custom_prefix()
1973 list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { in ipv6_chk_custom_prefix()
1988 const struct inet6_dev *idev; in ipv6_chk_prefix() local
1993 idev = __in6_dev_get(dev); in ipv6_chk_prefix()
1994 if (idev) { in ipv6_chk_prefix()
1995 list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { in ipv6_chk_prefix()
2031 if (!net_eq(dev_net(ifp->idev->dev), net)) in ipv6_get_ifaddr()
2034 if (!dev || ifp->idev->dev == dev || in ipv6_get_ifaddr()
2098 struct inet6_dev *idev = ifp->idev; in addrconf_dad_failure() local
2099 struct net *net = dev_net(ifp->idev->dev); in addrconf_dad_failure()
2107 ifp->idev->dev->name, &ifp->addr, eth_hdr(skb)->h_source); in addrconf_dad_failure()
2126 ifp->idev->dev->name); in addrconf_dad_failure()
2132 idev)) in addrconf_dad_failure()
2137 if (idev->cnf.max_addresses && in addrconf_dad_failure()
2138 ipv6_count_addresses(idev) >= in addrconf_dad_failure()
2139 idev->cnf.max_addresses) in addrconf_dad_failure()
2143 ifp->idev->dev->name); in addrconf_dad_failure()
2145 ifp2 = ipv6_add_addr(idev, &cfg, false, NULL); in addrconf_dad_failure()
2183 void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) in addrconf_leave_solict() argument
2187 if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) in addrconf_leave_solict()
2191 __ipv6_dev_mc_dec(idev, &maddr); in addrconf_leave_solict()
2204 __ipv6_dev_ac_inc(ifp->idev, &addr); in addrconf_join_anycast()
2217 __ipv6_dev_ac_dec(ifp->idev, &addr); in addrconf_leave_anycast()
2339 static int ipv6_inherit_eui64(u8 *eui, struct inet6_dev *idev) in ipv6_inherit_eui64() argument
2344 read_lock_bh(&idev->lock); in ipv6_inherit_eui64()
2345 list_for_each_entry_reverse(ifp, &idev->addr_list, if_list) { in ipv6_inherit_eui64()
2354 read_unlock_bh(&idev->lock); in ipv6_inherit_eui64()
2493 struct inet6_dev *idev; in addrconf_add_dev() local
2497 idev = ipv6_find_idev(dev); in addrconf_add_dev()
2498 if (IS_ERR(idev)) in addrconf_add_dev()
2499 return idev; in addrconf_add_dev()
2501 if (idev->cnf.disable_ipv6) in addrconf_add_dev()
2508 return idev; in addrconf_add_dev()
2511 static void manage_tempaddrs(struct inet6_dev *idev, in manage_tempaddrs() argument
2519 read_lock_bh(&idev->lock); in manage_tempaddrs()
2521 list_for_each_entry(ift, &idev->tempaddr_list, tmp_list) { in manage_tempaddrs()
2536 max_valid = idev->cnf.temp_valid_lft - age; in manage_tempaddrs()
2540 max_prefered = idev->cnf.temp_prefered_lft - in manage_tempaddrs()
2541 idev->desync_factor - age; in manage_tempaddrs()
2564 if ((create || list_empty(&idev->tempaddr_list)) && in manage_tempaddrs()
2565 idev->cnf.use_tempaddr > 0) { in manage_tempaddrs()
2571 read_unlock_bh(&idev->lock); in manage_tempaddrs()
2574 read_unlock_bh(&idev->lock); in manage_tempaddrs()
2578 static bool is_addr_mode_generate_stable(struct inet6_dev *idev) in is_addr_mode_generate_stable() argument
2580 return idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_STABLE_PRIVACY || in is_addr_mode_generate_stable()
2581 idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_RANDOM; in is_addr_mode_generate_stable()
2900 struct inet6_dev *idev; in inet6_addr_add() local
2922 idev = addrconf_add_dev(dev); in inet6_addr_add()
2923 if (IS_ERR(idev)) in inet6_addr_add()
2924 return PTR_ERR(idev); in inet6_addr_add()
2954 ifp = ipv6_add_addr(idev, cfg, true, extack); in inet6_addr_add()
2974 manage_tempaddrs(idev, ifp, cfg->valid_lft, in inet6_addr_add()
2991 struct inet6_dev *idev; in inet6_addr_del() local
3001 idev = __in6_dev_get(dev); in inet6_addr_del()
3002 if (!idev) in inet6_addr_del()
3005 read_lock_bh(&idev->lock); in inet6_addr_del()
3006 list_for_each_entry(ifp, &idev->addr_list, if_list) { in inet6_addr_del()
3010 read_unlock_bh(&idev->lock); in inet6_addr_del()
3014 manage_tempaddrs(idev, ifp, 0, 0, false, in inet6_addr_del()
3025 read_unlock_bh(&idev->lock); in inet6_addr_del()
3073 static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, in add_addr() argument
3086 ifp = ipv6_add_addr(idev, &cfg, true, NULL); in add_addr()
3091 rt_genid_bump_ipv6(dev_net(idev->dev)); in add_addr()
3098 static void add_v4_addrs(struct inet6_dev *idev) in add_v4_addrs() argument
3102 struct net *net = dev_net(idev->dev); in add_v4_addrs()
3110 if (idev->dev->addr_len == sizeof(struct in6_addr)) in add_v4_addrs()
3112 memcpy(&addr.s6_addr32[3], idev->dev->dev_addr + offset, 4); in add_v4_addrs()
3114 if (idev->dev->flags&IFF_POINTOPOINT) { in add_v4_addrs()
3115 if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE) in add_v4_addrs()
3128 add_addr(idev, &addr, plen, scope); in add_v4_addrs()
3129 addrconf_prefix_route(&addr, plen, 0, idev->dev, 0, pflags, in add_v4_addrs()
3146 if (idev->dev->flags&IFF_POINTOPOINT) in add_v4_addrs()
3151 add_addr(idev, &addr, plen, flag); in add_v4_addrs()
3152 addrconf_prefix_route(&addr, plen, 0, idev->dev, in add_v4_addrs()
3162 struct inet6_dev *idev; in init_loopback() local
3168 idev = ipv6_find_idev(dev); in init_loopback()
3169 if (IS_ERR(idev)) { in init_loopback()
3174 add_addr(idev, &in6addr_loopback, 128, IFA_HOST); in init_loopback()
3177 void addrconf_add_linklocal(struct inet6_dev *idev, in addrconf_add_linklocal() argument
3191 if ((dev_net(idev->dev)->ipv6.devconf_all->optimistic_dad || in addrconf_add_linklocal()
3192 idev->cnf.optimistic_dad) && in addrconf_add_linklocal()
3193 !dev_net(idev->dev)->ipv6.devconf_all->forwarding) in addrconf_add_linklocal()
3197 ifp = ipv6_add_addr(idev, &cfg, true, NULL); in addrconf_add_linklocal()
3199 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, 0, idev->dev, in addrconf_add_linklocal()
3225 const struct inet6_dev *idev) in ipv6_generate_stable_address() argument
3243 struct net *net = dev_net(idev->dev); in ipv6_generate_stable_address()
3247 if (idev->cnf.stable_secret.initialized) in ipv6_generate_stable_address()
3248 secret = idev->cnf.stable_secret.secret; in ipv6_generate_stable_address()
3260 memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len); in ipv6_generate_stable_address()
3276 if (dad_count > dev_net(idev->dev)->ipv6.sysctl.idgen_retries) in ipv6_generate_stable_address()
3285 static void ipv6_gen_mode_random_init(struct inet6_dev *idev) in ipv6_gen_mode_random_init() argument
3287 struct ipv6_stable_secret *s = &idev->cnf.stable_secret; in ipv6_gen_mode_random_init()
3291 s = &idev->cnf.stable_secret; in ipv6_gen_mode_random_init()
3296 static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route) in addrconf_addr_gen() argument
3301 if (netif_is_l3_master(idev->dev)) in addrconf_addr_gen()
3305 if (idev->dev->flags & IFF_SLAVE) in addrconf_addr_gen()
3310 switch (idev->cnf.addr_gen_mode) { in addrconf_addr_gen()
3312 ipv6_gen_mode_random_init(idev); in addrconf_addr_gen()
3315 if (!ipv6_generate_stable_address(&addr, 0, idev)) in addrconf_addr_gen()
3316 addrconf_add_linklocal(idev, &addr, in addrconf_addr_gen()
3319 addrconf_prefix_route(&addr, 64, 0, idev->dev, in addrconf_addr_gen()
3327 if (ipv6_generate_eui64(addr.s6_addr + 8, idev->dev) == 0) in addrconf_addr_gen()
3328 addrconf_add_linklocal(idev, &addr, 0); in addrconf_addr_gen()
3330 addrconf_prefix_route(&addr, 64, 0, idev->dev, in addrconf_addr_gen()
3342 struct inet6_dev *idev; in addrconf_dev_config() local
3357 idev = __in6_dev_get(dev); in addrconf_dev_config()
3358 if (!IS_ERR_OR_NULL(idev) && dev->flags & IFF_UP && in addrconf_dev_config()
3360 ipv6_mc_up(idev); in addrconf_dev_config()
3364 idev = addrconf_add_dev(dev); in addrconf_dev_config()
3365 if (IS_ERR(idev)) in addrconf_dev_config()
3370 idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64) in addrconf_dev_config()
3371 idev->cnf.addr_gen_mode = IN6_ADDR_GEN_MODE_RANDOM; in addrconf_dev_config()
3373 addrconf_addr_gen(idev, false); in addrconf_dev_config()
3379 struct inet6_dev *idev; in addrconf_sit_config() local
3389 idev = ipv6_find_idev(dev); in addrconf_sit_config()
3390 if (IS_ERR(idev)) { in addrconf_sit_config()
3396 addrconf_addr_gen(idev, false); in addrconf_sit_config()
3400 add_v4_addrs(idev); in addrconf_sit_config()
3410 struct inet6_dev *idev; in addrconf_gre_config() local
3414 idev = ipv6_find_idev(dev); in addrconf_gre_config()
3415 if (IS_ERR(idev)) { in addrconf_gre_config()
3421 addrconf_addr_gen(idev, true); in addrconf_gre_config()
3425 add_v4_addrs(idev); in addrconf_gre_config()
3433 struct inet6_dev *idev, in fixup_permanent_addr() argument
3443 f6i = addrconf_f6i_alloc(net, idev, &ifp->addr, false, in fixup_permanent_addr()
3459 ifp->rt_priority, idev->dev, 0, 0, in fixup_permanent_addr()
3472 struct inet6_dev *idev; in addrconf_permanent_addr() local
3474 idev = __in6_dev_get(dev); in addrconf_permanent_addr()
3475 if (!idev) in addrconf_permanent_addr()
3478 write_lock_bh(&idev->lock); in addrconf_permanent_addr()
3480 list_for_each_entry_safe(ifp, tmp, &idev->addr_list, if_list) { in addrconf_permanent_addr()
3482 fixup_permanent_addr(net, idev, ifp) < 0) { in addrconf_permanent_addr()
3483 write_unlock_bh(&idev->lock); in addrconf_permanent_addr()
3486 write_lock_bh(&idev->lock); in addrconf_permanent_addr()
3489 idev->dev->name, &ifp->addr); in addrconf_permanent_addr()
3493 write_unlock_bh(&idev->lock); in addrconf_permanent_addr()
3502 struct inet6_dev *idev = __in6_dev_get(dev); in addrconf_notify() local
3509 if (!idev && dev->mtu >= IPV6_MIN_MTU) { in addrconf_notify()
3510 idev = ipv6_add_dev(dev); in addrconf_notify()
3511 if (IS_ERR(idev)) in addrconf_notify()
3512 return notifier_from_errno(PTR_ERR(idev)); in addrconf_notify()
3523 if (idev) { in addrconf_notify()
3525 idev->cnf.mtu6 = dev->mtu; in addrconf_notify()
3530 idev = ipv6_add_dev(dev); in addrconf_notify()
3531 if (IS_ERR(idev)) in addrconf_notify()
3535 if (!(idev->if_flags & IF_READY)) in addrconf_notify()
3545 if (idev && idev->cnf.disable_ipv6) in addrconf_notify()
3559 if (!idev && dev->mtu >= IPV6_MIN_MTU) in addrconf_notify()
3560 idev = ipv6_add_dev(dev); in addrconf_notify()
3562 if (!IS_ERR_OR_NULL(idev)) { in addrconf_notify()
3563 idev->if_flags |= IF_READY; in addrconf_notify()
3573 if (!IS_ERR_OR_NULL(idev)) { in addrconf_notify()
3574 if (idev->if_flags & IF_READY) { in addrconf_notify()
3580 ipv6_mc_up(idev); in addrconf_notify()
3583 addrconf_dad_run(idev, true); in addrconf_notify()
3587 idev->if_flags |= IF_READY; in addrconf_notify()
3617 if (!IS_ERR_OR_NULL(idev)) { in addrconf_notify()
3619 addrconf_dad_run(idev, false); in addrconf_notify()
3629 if (idev->cnf.mtu6 != dev->mtu && in addrconf_notify()
3632 idev->cnf.mtu6 = dev->mtu; in addrconf_notify()
3634 idev->tstamp = jiffies; in addrconf_notify()
3635 inet6_ifinfo_notify(RTM_NEWLINK, idev); in addrconf_notify()
3655 if (idev) { in addrconf_notify()
3656 snmp6_unregister_dev(idev); in addrconf_notify()
3657 addrconf_sysctl_unregister(idev); in addrconf_notify()
3658 err = addrconf_sysctl_register(idev); in addrconf_notify()
3661 err = snmp6_register_dev(idev); in addrconf_notify()
3663 addrconf_sysctl_unregister(idev); in addrconf_notify()
3671 if (idev) in addrconf_notify()
3698 struct inet6_dev *idev; in addrconf_type_change() local
3701 idev = __in6_dev_get(dev); in addrconf_type_change()
3704 ipv6_mc_remap(idev); in addrconf_type_change()
3706 ipv6_mc_unmap(idev); in addrconf_type_change()
3719 struct inet6_dev *idev; in addrconf_ifdown() local
3728 idev = __in6_dev_get(dev); in addrconf_ifdown()
3729 if (!idev) in addrconf_ifdown()
3737 idev->dead = 1; in addrconf_ifdown()
3743 snmp6_unregister_dev(idev); in addrconf_ifdown()
3750 if (!unregister && !idev->cnf.disable_ipv6) { in addrconf_ifdown()
3755 _keep_addr = idev->cnf.keep_addr_on_down; in addrconf_ifdown()
3767 if (ifa->idev == idev) { in addrconf_ifdown()
3783 write_lock_bh(&idev->lock); in addrconf_ifdown()
3785 addrconf_del_rs_timer(idev); in addrconf_ifdown()
3789 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); in addrconf_ifdown()
3792 while (!list_empty(&idev->tempaddr_list)) { in addrconf_ifdown()
3793 ifa = list_first_entry(&idev->tempaddr_list, in addrconf_ifdown()
3796 write_unlock_bh(&idev->lock); in addrconf_ifdown()
3805 write_lock_bh(&idev->lock); in addrconf_ifdown()
3808 list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { in addrconf_ifdown()
3817 write_unlock_bh(&idev->lock); in addrconf_ifdown()
3843 if (idev->cnf.forwarding) in addrconf_ifdown()
3845 addrconf_leave_solict(ifa->idev, &ifa->addr); in addrconf_ifdown()
3848 write_lock_bh(&idev->lock); in addrconf_ifdown()
3855 write_unlock_bh(&idev->lock); in addrconf_ifdown()
3859 ipv6_ac_destroy_dev(idev); in addrconf_ifdown()
3860 ipv6_mc_destroy_dev(idev); in addrconf_ifdown()
3862 ipv6_mc_down(idev); in addrconf_ifdown()
3865 idev->tstamp = jiffies; in addrconf_ifdown()
3866 idev->ra_mtu = 0; in addrconf_ifdown()
3870 addrconf_sysctl_unregister(idev); in addrconf_ifdown()
3871 neigh_parms_release(&nd_tbl, idev->nd_parms); in addrconf_ifdown()
3873 in6_dev_put(idev); in addrconf_ifdown()
3880 struct inet6_dev *idev = from_timer(idev, t, rs_timer); in addrconf_rs_timer() local
3881 struct net_device *dev = idev->dev; in addrconf_rs_timer()
3884 write_lock(&idev->lock); in addrconf_rs_timer()
3885 if (idev->dead || !(idev->if_flags & IF_READY)) in addrconf_rs_timer()
3888 if (!ipv6_accept_ra(idev)) in addrconf_rs_timer()
3892 if (idev->if_flags & IF_RA_RCVD) in addrconf_rs_timer()
3895 if (idev->rs_probes++ < idev->cnf.rtr_solicits || idev->cnf.rtr_solicits < 0) { in addrconf_rs_timer()
3896 write_unlock(&idev->lock); in addrconf_rs_timer()
3903 write_lock(&idev->lock); in addrconf_rs_timer()
3904 idev->rs_interval = rfc3315_s14_backoff_update( in addrconf_rs_timer()
3905 idev->rs_interval, idev->cnf.rtr_solicit_max_interval); in addrconf_rs_timer()
3907 addrconf_mod_rs_timer(idev, (idev->rs_probes == in addrconf_rs_timer()
3908 idev->cnf.rtr_solicits) ? in addrconf_rs_timer()
3909 idev->cnf.rtr_solicit_delay : in addrconf_rs_timer()
3910 idev->rs_interval); in addrconf_rs_timer()
3916 pr_debug("%s: no IPv6 routers present\n", idev->dev->name); in addrconf_rs_timer()
3920 write_unlock(&idev->lock); in addrconf_rs_timer()
3922 in6_dev_put(idev); in addrconf_rs_timer()
3931 struct inet6_dev *idev = ifp->idev; in addrconf_dad_kick() local
3937 rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1); in addrconf_dad_kick()
3940 if (idev->cnf.enhanced_dad || in addrconf_dad_kick()
3941 dev_net(idev->dev)->ipv6.devconf_all->enhanced_dad) { in addrconf_dad_kick()
3947 ifp->dad_probes = idev->cnf.dad_transmits; in addrconf_dad_kick()
3953 struct inet6_dev *idev = ifp->idev; in addrconf_dad_begin() local
3954 struct net_device *dev = idev->dev; in addrconf_dad_begin()
3962 read_lock_bh(&idev->lock); in addrconf_dad_begin()
3970 idev->cnf.accept_dad < 1) || in addrconf_dad_begin()
3981 read_unlock_bh(&idev->lock); in addrconf_dad_begin()
3987 if (!(idev->if_flags & IF_READY)) { in addrconf_dad_begin()
3989 read_unlock_bh(&idev->lock); in addrconf_dad_begin()
4006 if (ipv6_use_optimistic_addr(net, idev)) { in addrconf_dad_begin()
4017 read_unlock_bh(&idev->lock); in addrconf_dad_begin()
4042 struct inet6_dev *idev = ifp->idev; in addrconf_dad_work() local
4062 if ((dev_net(idev->dev)->ipv6.devconf_all->accept_dad > 1 || in addrconf_dad_work()
4063 idev->cnf.accept_dad > 1) && in addrconf_dad_work()
4064 !idev->cnf.disable_ipv6 && in addrconf_dad_work()
4071 if (!ipv6_generate_eui64(addr.s6_addr + 8, idev->dev) && in addrconf_dad_work()
4074 idev->cnf.disable_ipv6 = 1; in addrconf_dad_work()
4077 ifp->idev->dev->name); in addrconf_dad_work()
4091 addrconf_ifdown(idev->dev, false); in addrconf_dad_work()
4098 write_lock_bh(&idev->lock); in addrconf_dad_work()
4099 if (idev->dead || !(idev->if_flags & IF_READY)) { in addrconf_dad_work()
4100 write_unlock_bh(&idev->lock); in addrconf_dad_work()
4107 write_unlock_bh(&idev->lock); in addrconf_dad_work()
4124 write_unlock_bh(&idev->lock); in addrconf_dad_work()
4133 max(NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME), in addrconf_dad_work()
4136 write_unlock_bh(&idev->lock); in addrconf_dad_work()
4140 ndisc_send_ns(ifp->idev->dev, &ifp->addr, &mcaddr, &in6addr_any, in addrconf_dad_work()
4151 struct inet6_dev *idev = ifp->idev; in ipv6_lonely_lladdr() local
4153 list_for_each_entry_reverse(ifpiter, &idev->addr_list, if_list) { in ipv6_lonely_lladdr()
4168 struct net_device *dev = ifp->idev->dev; in addrconf_dad_completed()
4184 read_lock_bh(&ifp->idev->lock); in addrconf_dad_completed()
4187 ipv6_accept_ra(ifp->idev) && in addrconf_dad_completed()
4188 ifp->idev->cnf.rtr_solicits != 0 && in addrconf_dad_completed()
4190 read_unlock_bh(&ifp->idev->lock); in addrconf_dad_completed()
4196 ipv6_mc_dad_complete(ifp->idev); in addrconf_dad_completed()
4200 (ifp->idev->cnf.ndisc_notify || in addrconf_dad_completed()
4203 /*router=*/ !!ifp->idev->cnf.forwarding, in addrconf_dad_completed()
4218 write_lock_bh(&ifp->idev->lock); in addrconf_dad_completed()
4220 ifp->idev->rs_interval = rfc3315_s14_backoff_init( in addrconf_dad_completed()
4221 ifp->idev->cnf.rtr_solicit_interval); in addrconf_dad_completed()
4222 ifp->idev->rs_probes = 1; in addrconf_dad_completed()
4223 ifp->idev->if_flags |= IF_RS_SENT; in addrconf_dad_completed()
4224 addrconf_mod_rs_timer(ifp->idev, ifp->idev->rs_interval); in addrconf_dad_completed()
4226 write_unlock_bh(&ifp->idev->lock); in addrconf_dad_completed()
4239 static void addrconf_dad_run(struct inet6_dev *idev, bool restart) in addrconf_dad_run() argument
4243 read_lock_bh(&idev->lock); in addrconf_dad_run()
4244 list_for_each_entry(ifp, &idev->addr_list, if_list) { in addrconf_dad_run()
4254 read_unlock_bh(&idev->lock); in addrconf_dad_run()
4280 if (!net_eq(dev_net(ifa->idev->dev), net)) in if6_get_first()
4304 if (!net_eq(dev_net(ifa->idev->dev), net)) in if6_get_next()
4314 if (!net_eq(dev_net(ifa->idev->dev), net)) in if6_get_next()
4350 ifp->idev->dev->ifindex, in if6_seq_show()
4354 ifp->idev->dev->name); in if6_seq_show()
4404 if (!net_eq(dev_net(ifp->idev->dev), net)) in ipv6_chk_home_addr()
4444 if (!net_eq(dev_net(ifp->idev->dev), net)) in ipv6_chk_rpl_srh_loop()
4540 unsigned long regen_advance = ifp->idev->cnf.regen_max_retry * in addrconf_verify_rtnl()
4541 ifp->idev->cnf.dad_transmits * in addrconf_verify_rtnl()
4542 max(NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME), HZ/100) / HZ; in addrconf_verify_rtnl()
4672 ifp->idev->dev, 0, RTF_DEFAULT, true); in modify_prefix_route()
4679 ip6_del_rt(dev_net(ifp->idev->dev), f6i, false); in modify_prefix_route()
4684 ifp->rt_priority, ifp->idev->dev, in modify_prefix_route()
4775 ifp->rt_priority, ifp->idev->dev, in inet6_addr_modify()
4784 ifp->rt_priority, ifp->idev->dev, in inet6_addr_modify()
4791 write_lock_bh(&ifp->idev->lock); in inet6_addr_modify()
4793 write_unlock_bh(&ifp->idev->lock); in inet6_addr_modify()
4807 manage_tempaddrs(ifp->idev, ifp, cfg->valid_lft, in inet6_addr_modify()
4827 struct inet6_dev *idev; in inet6_rtm_newaddr() local
4873 idev = ipv6_find_idev(dev); in inet6_rtm_newaddr()
4874 if (IS_ERR(idev)) in inet6_rtm_newaddr()
4875 return PTR_ERR(idev); in inet6_rtm_newaddr()
4877 if (!ipv6_allow_optimistic_dad(net, idev)) in inet6_rtm_newaddr()
4982 ifa->idev->dev->ifindex); in inet6_fill_ifaddr()
5041 int ifindex = ifmca->idev->dev->ifindex; in inet6_fill_ifmcaddr()
5104 static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, in in6_dump_addrs() argument
5113 read_lock_bh(&idev->lock); in in6_dump_addrs()
5120 list_for_each_entry(ifa, &idev->addr_list, if_list) { in in6_dump_addrs()
5133 read_unlock_bh(&idev->lock); in in6_dump_addrs()
5137 for (ifmca = rcu_dereference(idev->mc_list); in in6_dump_addrs()
5146 read_lock_bh(&idev->lock); in in6_dump_addrs()
5151 for (ifaca = idev->ac_list; ifaca; in in6_dump_addrs()
5163 read_unlock_bh(&idev->lock); in in6_dump_addrs()
5239 struct inet6_dev *idev; in inet6_dump_addr() local
5260 idev = __in6_dev_get(dev); in inet6_dump_addr()
5261 if (idev) { in inet6_dump_addr()
5262 err = in6_dump_addrs(idev, skb, cb, s_ip_idx, in inet6_dump_addr()
5281 idev = __in6_dev_get(dev); in inet6_dump_addr()
5282 if (!idev) in inet6_dump_addr()
5285 if (in6_dump_addrs(idev, skb, cb, s_ip_idx, in inet6_dump_addr()
5444 struct net *net = dev_net(ifa->idev->dev); in inet6_ifa_notify()
5613 static void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, in snmp6_fill_stats() argument
5618 __snmp6_fill_stats64(stats, idev->stats.ipv6, bytes, in snmp6_fill_stats()
5622 __snmp6_fill_statsdev(stats, idev->stats.icmpv6dev->mibs, bytes); in snmp6_fill_stats()
5627 static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev, in inet6_fill_ifla6_attrs() argument
5633 if (nla_put_u32(skb, IFLA_INET6_FLAGS, idev->if_flags)) in inet6_fill_ifla6_attrs()
5636 ci.tstamp = cstamp_delta(idev->tstamp); in inet6_fill_ifla6_attrs()
5637 ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time); in inet6_fill_ifla6_attrs()
5638 ci.retrans_time = jiffies_to_msecs(NEIGH_VAR(idev->nd_parms, RETRANS_TIME)); in inet6_fill_ifla6_attrs()
5644 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla)); in inet6_fill_ifla6_attrs()
5654 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla)); in inet6_fill_ifla6_attrs()
5659 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla)); in inet6_fill_ifla6_attrs()
5664 read_lock_bh(&idev->lock); in inet6_fill_ifla6_attrs()
5665 memcpy(nla_data(nla), idev->token.s6_addr, nla_len(nla)); in inet6_fill_ifla6_attrs()
5666 read_unlock_bh(&idev->lock); in inet6_fill_ifla6_attrs()
5668 if (nla_put_u8(skb, IFLA_INET6_ADDR_GEN_MODE, idev->cnf.addr_gen_mode)) in inet6_fill_ifla6_attrs()
5671 if (idev->ra_mtu && in inet6_fill_ifla6_attrs()
5672 nla_put_u32(skb, IFLA_INET6_RA_MTU, idev->ra_mtu)) in inet6_fill_ifla6_attrs()
5693 struct inet6_dev *idev = __in6_dev_get(dev); in inet6_fill_link_af() local
5695 if (!idev) in inet6_fill_link_af()
5698 if (inet6_fill_ifla6_attrs(skb, idev, ext_filter_mask) < 0) in inet6_fill_link_af()
5704 static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token, in inet6_set_iftoken() argument
5708 struct net_device *dev = idev->dev; in inet6_set_iftoken()
5728 if (!ipv6_accept_ra(idev)) { in inet6_set_iftoken()
5734 if (idev->cnf.rtr_solicits == 0) { in inet6_set_iftoken()
5740 write_lock_bh(&idev->lock); in inet6_set_iftoken()
5743 memcpy(idev->token.s6_addr + 8, token->s6_addr + 8, 8); in inet6_set_iftoken()
5745 write_unlock_bh(&idev->lock); in inet6_set_iftoken()
5751 if (!idev->dead && (idev->if_flags & IF_READY) && in inet6_set_iftoken()
5762 write_lock_bh(&idev->lock); in inet6_set_iftoken()
5765 idev->if_flags |= IF_RS_SENT; in inet6_set_iftoken()
5766 idev->rs_interval = rfc3315_s14_backoff_init( in inet6_set_iftoken()
5767 idev->cnf.rtr_solicit_interval); in inet6_set_iftoken()
5768 idev->rs_probes = 1; in inet6_set_iftoken()
5769 addrconf_mod_rs_timer(idev, idev->rs_interval); in inet6_set_iftoken()
5773 list_for_each_entry(ifp, &idev->addr_list, if_list) { in inet6_set_iftoken()
5782 write_unlock_bh(&idev->lock); in inet6_set_iftoken()
5783 inet6_ifinfo_notify(RTM_NEWLINK, idev); in inet6_set_iftoken()
5806 static int check_stable_privacy(struct inet6_dev *idev, struct net *net, in check_stable_privacy() argument
5810 !idev->cnf.stable_secret.initialized && in check_stable_privacy()
5821 struct inet6_dev *idev = NULL; in inet6_validate_link_af() local
5825 idev = __in6_dev_get(dev); in inet6_validate_link_af()
5826 if (!idev) in inet6_validate_link_af()
5843 if (dev && check_stable_privacy(idev, dev_net(dev), mode) < 0) in inet6_validate_link_af()
5853 struct inet6_dev *idev = __in6_dev_get(dev); in inet6_set_link_af() local
5857 if (!idev) in inet6_set_link_af()
5864 err = inet6_set_iftoken(idev, nla_data(tb[IFLA_INET6_TOKEN]), in inet6_set_link_af()
5873 idev->cnf.addr_gen_mode = mode; in inet6_set_link_af()
5879 static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, in inet6_fill_ifinfo() argument
5882 struct net_device *dev = idev->dev; in inet6_fill_ifinfo()
5912 if (inet6_fill_ifla6_attrs(skb, idev, 0) < 0) in inet6_fill_ifinfo()
5955 struct inet6_dev *idev; in inet6_dump_ifinfo() local
5978 idev = __in6_dev_get(dev); in inet6_dump_ifinfo()
5979 if (!idev) in inet6_dump_ifinfo()
5981 if (inet6_fill_ifinfo(skb, idev, in inet6_dump_ifinfo()
5998 void inet6_ifinfo_notify(int event, struct inet6_dev *idev) in inet6_ifinfo_notify() argument
6001 struct net *net = dev_net(idev->dev); in inet6_ifinfo_notify()
6008 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0); in inet6_ifinfo_notify()
6029 static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, in inet6_fill_prefix() argument
6045 pmsg->prefix_ifindex = idev->dev->ifindex; in inet6_fill_prefix()
6069 static void inet6_prefix_notify(int event, struct inet6_dev *idev, in inet6_prefix_notify() argument
6073 struct net *net = dev_net(idev->dev); in inet6_prefix_notify()
6080 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0); in inet6_prefix_notify()
6096 struct net *net = dev_net(ifp->idev->dev); in __ipv6_ifa_notify()
6115 } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) { in __ipv6_ifa_notify()
6117 &ifp->addr, ifp->idev->dev->name); in __ipv6_ifa_notify()
6120 if (ifp->idev->cnf.forwarding) in __ipv6_ifa_notify()
6124 ifp->rt_priority, ifp->idev->dev, in __ipv6_ifa_notify()
6128 if (ifp->idev->cnf.forwarding) in __ipv6_ifa_notify()
6130 addrconf_leave_solict(ifp->idev, &ifp->addr); in __ipv6_ifa_notify()
6135 ifp->idev->dev, 0, 0, in __ipv6_ifa_notify()
6152 if (likely(ifp->idev->dead == 0)) in ipv6_ifa_notify()
6186 struct inet6_dev *idev = ctl->extra1; in addrconf_sysctl_mtu() local
6192 lctl.extra2 = idev ? &idev->dev->mtu : NULL; in addrconf_sysctl_mtu()
6197 static void dev_disable_change(struct inet6_dev *idev) in dev_disable_change() argument
6201 if (!idev || !idev->dev) in dev_disable_change()
6204 netdev_notifier_info_init(&info, idev->dev); in dev_disable_change()
6205 if (idev->cnf.disable_ipv6) in dev_disable_change()
6214 struct inet6_dev *idev; in addrconf_disable_change() local
6217 idev = __in6_dev_get(dev); in addrconf_disable_change()
6218 if (idev) { in addrconf_disable_change()
6219 int changed = (!idev->cnf.disable_ipv6) ^ (!newf); in addrconf_disable_change()
6220 idev->cnf.disable_ipv6 = newf; in addrconf_disable_change()
6222 dev_disable_change(idev); in addrconf_disable_change()
6307 struct inet6_dev *idev = ctl->extra1; in addrconf_sysctl_proxy_ndp() local
6311 idev->dev->ifindex, in addrconf_sysctl_proxy_ndp()
6312 &idev->cnf); in addrconf_sysctl_proxy_ndp()
6326 struct inet6_dev *idev = (struct inet6_dev *)ctl->extra1; in addrconf_sysctl_addr_gen_mode() local
6349 if (idev) { in addrconf_sysctl_addr_gen_mode()
6350 if (check_stable_privacy(idev, net, new_val) < 0) { in addrconf_sysctl_addr_gen_mode()
6355 if (idev->cnf.addr_gen_mode != new_val) { in addrconf_sysctl_addr_gen_mode()
6356 idev->cnf.addr_gen_mode = new_val; in addrconf_sysctl_addr_gen_mode()
6357 addrconf_dev_config(idev->dev); in addrconf_sysctl_addr_gen_mode()
6364 idev = __in6_dev_get(dev); in addrconf_sysctl_addr_gen_mode()
6365 if (idev && in addrconf_sysctl_addr_gen_mode()
6366 idev->cnf.addr_gen_mode != new_val) { in addrconf_sysctl_addr_gen_mode()
6367 idev->cnf.addr_gen_mode = new_val; in addrconf_sysctl_addr_gen_mode()
6368 addrconf_dev_config(idev->dev); in addrconf_sysctl_addr_gen_mode()
6429 struct inet6_dev *idev = __in6_dev_get(dev); in addrconf_sysctl_stable_secret() local
6431 if (idev) { in addrconf_sysctl_stable_secret()
6432 idev->cnf.addr_gen_mode = in addrconf_sysctl_stable_secret()
6437 struct inet6_dev *idev = ctl->extra1; in addrconf_sysctl_stable_secret() local
6439 idev->cnf.addr_gen_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; in addrconf_sysctl_stable_secret()
6487 void addrconf_disable_policy_idev(struct inet6_dev *idev, int val) in addrconf_disable_policy_idev() argument
6491 read_lock_bh(&idev->lock); in addrconf_disable_policy_idev()
6492 list_for_each_entry(ifa, &idev->addr_list, if_list) { in addrconf_disable_policy_idev()
6513 read_unlock_bh(&idev->lock); in addrconf_disable_policy_idev()
6519 struct inet6_dev *idev; in addrconf_disable_policy() local
6537 idev = __in6_dev_get(dev); in addrconf_disable_policy()
6538 if (idev) in addrconf_disable_policy()
6539 addrconf_disable_policy_idev(idev, val); in addrconf_disable_policy()
6542 idev = (struct inet6_dev *)ctl->extra1; in addrconf_disable_policy()
6543 addrconf_disable_policy_idev(idev, val); in addrconf_disable_policy()
7007 struct inet6_dev *idev, struct ipv6_devconf *p) in __addrconf_sysctl_register() argument
7024 table[i].extra1 = idev; /* embedded; no ref */ in __addrconf_sysctl_register()
7040 ifindex = idev->dev->ifindex; in __addrconf_sysctl_register()
7067 static int addrconf_sysctl_register(struct inet6_dev *idev) in addrconf_sysctl_register() argument
7071 if (!sysctl_dev_name_is_allowed(idev->dev->name)) in addrconf_sysctl_register()
7074 err = neigh_sysctl_register(idev->dev, idev->nd_parms, in addrconf_sysctl_register()
7078 err = __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name, in addrconf_sysctl_register()
7079 idev, &idev->cnf); in addrconf_sysctl_register()
7081 neigh_sysctl_unregister(idev->nd_parms); in addrconf_sysctl_register()
7086 static void addrconf_sysctl_unregister(struct inet6_dev *idev) in addrconf_sysctl_unregister() argument
7088 __addrconf_sysctl_unregister(dev_net(idev->dev), &idev->cnf, in addrconf_sysctl_unregister()
7089 idev->dev->ifindex); in addrconf_sysctl_unregister()
7090 neigh_sysctl_unregister(idev->nd_parms); in addrconf_sysctl_unregister()
7196 struct inet6_dev *idev; in addrconf_init() local
7235 idev = ipv6_add_dev(init_net.loopback_dev); in addrconf_init()
7237 if (IS_ERR(idev)) { in addrconf_init()
7238 err = PTR_ERR(idev); in addrconf_init()