Lines Matching refs:ifa
174 static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
175 static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
815 struct inet6_ifaddr *ifa; in dev_forward_change() local
836 list_for_each_entry(ifa, &idev->addr_list, if_list) { in dev_forward_change()
837 if (ifa->flags&IFA_F_TENTATIVE) in dev_forward_change()
839 list_add_tail(&ifa->if_list_aux, &tmp_addr_list); in dev_forward_change()
844 ifa = list_first_entry(&tmp_addr_list, in dev_forward_change()
846 list_del(&ifa->if_list_aux); in dev_forward_change()
848 addrconf_join_anycast(ifa); in dev_forward_change()
850 addrconf_leave_anycast(ifa); in dev_forward_change()
1017 struct inet6_ifaddr *ifa in ipv6_link_dev_addr() local
1019 if (ifp_scope >= ipv6_addr_src_scope(&ifa->addr)) in ipv6_link_dev_addr()
1047 static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa) in ipv6_add_addr_hash() argument
1050 unsigned int hash = inet6_addr_hash(net, &ifa->addr); in ipv6_add_addr_hash()
1056 if (ipv6_chk_same_addr(net, &ifa->addr, dev, hash)) { in ipv6_add_addr_hash()
1060 hlist_add_head_rcu(&ifa->addr_lst, &net->ipv6.inet6_addr_lst[hash]); in ipv6_add_addr_hash()
1077 struct inet6_ifaddr *ifa = NULL; in ipv6_add_addr() local
1123 ifa = kzalloc(sizeof(*ifa), gfp_flags | __GFP_ACCOUNT); in ipv6_add_addr()
1124 if (!ifa) { in ipv6_add_addr()
1138 ifa->addr = *cfg->pfx; in ipv6_add_addr()
1140 ifa->peer_addr = *cfg->peer_pfx; in ipv6_add_addr()
1142 spin_lock_init(&ifa->lock); in ipv6_add_addr()
1143 INIT_DELAYED_WORK(&ifa->dad_work, addrconf_dad_work); in ipv6_add_addr()
1144 INIT_HLIST_NODE(&ifa->addr_lst); in ipv6_add_addr()
1145 ifa->scope = cfg->scope; in ipv6_add_addr()
1146 ifa->prefix_len = cfg->plen; in ipv6_add_addr()
1147 ifa->rt_priority = cfg->rt_priority; in ipv6_add_addr()
1148 ifa->flags = cfg->ifa_flags; in ipv6_add_addr()
1149 ifa->ifa_proto = cfg->ifa_proto; in ipv6_add_addr()
1152 ifa->flags |= IFA_F_TENTATIVE; in ipv6_add_addr()
1153 ifa->valid_lft = cfg->valid_lft; in ipv6_add_addr()
1154 ifa->prefered_lft = cfg->preferred_lft; in ipv6_add_addr()
1155 ifa->cstamp = ifa->tstamp = jiffies; in ipv6_add_addr()
1156 ifa->tokenized = false; in ipv6_add_addr()
1158 ifa->rt = f6i; in ipv6_add_addr()
1160 ifa->idev = idev; in ipv6_add_addr()
1164 refcount_set(&ifa->refcnt, 1); in ipv6_add_addr()
1168 err = ipv6_add_addr_hash(idev->dev, ifa); in ipv6_add_addr()
1177 ipv6_link_dev_addr(idev, ifa); in ipv6_add_addr()
1179 if (ifa->flags&IFA_F_TEMPORARY) { in ipv6_add_addr()
1180 list_add(&ifa->tmp_list, &idev->tempaddr_list); in ipv6_add_addr()
1181 in6_ifa_hold(ifa); in ipv6_add_addr()
1184 in6_ifa_hold(ifa); in ipv6_add_addr()
1189 inet6addr_notifier_call_chain(NETDEV_UP, ifa); in ipv6_add_addr()
1194 if (ifa) { in ipv6_add_addr()
1195 if (ifa->idev) in ipv6_add_addr()
1196 in6_dev_put(ifa->idev); in ipv6_add_addr()
1197 kfree(ifa); in ipv6_add_addr()
1199 ifa = ERR_PTR(err); in ipv6_add_addr()
1202 return ifa; in ipv6_add_addr()
1232 struct inet6_ifaddr *ifa; in check_cleanup_prefix_route() local
1239 list_for_each_entry(ifa, &idev->addr_list, if_list) { in check_cleanup_prefix_route()
1240 if (ifa == ifp) in check_cleanup_prefix_route()
1242 if (ifa->prefix_len != ifp->prefix_len || in check_cleanup_prefix_route()
1243 !ipv6_prefix_equal(&ifa->addr, &ifp->addr, in check_cleanup_prefix_route()
1246 if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE)) in check_cleanup_prefix_route()
1251 spin_lock(&ifa->lock); in check_cleanup_prefix_route()
1253 lifetime = addrconf_timeout_fixup(ifa->valid_lft, HZ); in check_cleanup_prefix_route()
1259 if (time_before(*expires, ifa->tstamp + lifetime * HZ)) in check_cleanup_prefix_route()
1260 *expires = ifa->tstamp + lifetime * HZ; in check_cleanup_prefix_route()
1261 spin_unlock(&ifa->lock); in check_cleanup_prefix_route()
1492 struct inet6_ifaddr *ifa; member
1569 ret = !!score->ifa; in ipv6_get_saddr_eval()
1573 ret = ipv6_addr_equal(&score->ifa->addr, dst->addr); in ipv6_get_saddr_eval()
1609 if (!ipv6_use_optimistic_addr(net, score->ifa->idev)) in ipv6_get_saddr_eval()
1612 !(score->ifa->flags & avoid); in ipv6_get_saddr_eval()
1620 ret = !(score->ifa->flags & IFA_F_HOMEADDRESS) ^ prefhome; in ipv6_get_saddr_eval()
1627 dst->ifindex == score->ifa->idev->dev->ifindex); in ipv6_get_saddr_eval()
1632 &score->ifa->addr, score->addr_type, in ipv6_get_saddr_eval()
1633 score->ifa->idev->dev->ifindex) == dst->label; in ipv6_get_saddr_eval()
1642 score->ifa->idev->cnf.use_tempaddr >= 2; in ipv6_get_saddr_eval()
1643 ret = (!(score->ifa->flags & IFA_F_TEMPORARY)) ^ preftmp; in ipv6_get_saddr_eval()
1650 ret = !(ipv6_addr_orchid(&score->ifa->addr) ^ in ipv6_get_saddr_eval()
1655 ret = ipv6_addr_diff(&score->ifa->addr, dst->addr); in ipv6_get_saddr_eval()
1656 if (ret > score->ifa->prefix_len) in ipv6_get_saddr_eval()
1657 ret = score->ifa->prefix_len; in ipv6_get_saddr_eval()
1665 ret = !(score->ifa->flags & IFA_F_OPTIMISTIC); in ipv6_get_saddr_eval()
1687 list_for_each_entry_rcu(score->ifa, &idev->addr_list, if_list) { in __ipv6_dev_get_saddr()
1700 if ((score->ifa->flags & IFA_F_TENTATIVE) && in __ipv6_dev_get_saddr()
1701 (!(score->ifa->flags & IFA_F_OPTIMISTIC))) in __ipv6_dev_get_saddr()
1704 score->addr_type = __ipv6_addr_type(&score->ifa->addr); in __ipv6_dev_get_saddr()
1741 score->ifa = hiscore->ifa; in __ipv6_dev_get_saddr()
1794 scores[hiscore_idx].ifa = NULL; in ipv6_dev_get_saddr()
1842 if (scores[hiscore_idx].ifa) in ipv6_dev_get_saddr()
1861 if (!hiscore->ifa) in ipv6_dev_get_saddr()
1864 *saddr = hiscore->ifa->addr; in ipv6_dev_get_saddr()
1993 const struct inet6_ifaddr *ifa; in ipv6_chk_custom_prefix() local
2000 list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { in ipv6_chk_custom_prefix()
2001 ret = ipv6_prefix_equal(addr, &ifa->addr, prefix_len); in ipv6_chk_custom_prefix()
2014 const struct inet6_ifaddr *ifa; in ipv6_chk_prefix() local
2022 list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { in ipv6_chk_prefix()
2023 onlink = ipv6_prefix_equal(addr, &ifa->addr, in ipv6_chk_prefix()
2024 ifa->prefix_len); in ipv6_chk_prefix()
3205 struct in_ifaddr *ifa; in add_v4_addrs() local
3208 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in add_v4_addrs()
3209 addr.s6_addr32[3] = ifa->ifa_local; in add_v4_addrs()
3211 if (ifa->ifa_scope == RT_SCOPE_LINK) in add_v4_addrs()
3213 if (ifa->ifa_scope >= RT_SCOPE_HOST) { in add_v4_addrs()
3799 struct inet6_ifaddr *ifa; in addrconf_ifdown() local
3847 hlist_for_each_entry_rcu(ifa, h, addr_lst) { in addrconf_ifdown()
3848 if (ifa->idev == idev) { in addrconf_ifdown()
3849 addrconf_del_dad_work(ifa); in addrconf_ifdown()
3854 !(ifa->flags & IFA_F_PERMANENT) || in addrconf_ifdown()
3855 addr_is_local(&ifa->addr)) { in addrconf_ifdown()
3856 hlist_del_init_rcu(&ifa->addr_lst); in addrconf_ifdown()
3877 ifa = list_first_entry(&idev->tempaddr_list, in addrconf_ifdown()
3879 list_del(&ifa->tmp_list); in addrconf_ifdown()
3881 spin_lock_bh(&ifa->lock); in addrconf_ifdown()
3883 if (ifa->ifpub) { in addrconf_ifdown()
3884 in6_ifa_put(ifa->ifpub); in addrconf_ifdown()
3885 ifa->ifpub = NULL; in addrconf_ifdown()
3887 spin_unlock_bh(&ifa->lock); in addrconf_ifdown()
3888 in6_ifa_put(ifa); in addrconf_ifdown()
3892 list_for_each_entry(ifa, &idev->addr_list, if_list) in addrconf_ifdown()
3893 list_add_tail(&ifa->if_list_aux, &tmp_addr_list); in addrconf_ifdown()
3900 ifa = list_first_entry(&tmp_addr_list, in addrconf_ifdown()
3902 list_del(&ifa->if_list_aux); in addrconf_ifdown()
3904 addrconf_del_dad_work(ifa); in addrconf_ifdown()
3906 keep = keep_addr && (ifa->flags & IFA_F_PERMANENT) && in addrconf_ifdown()
3907 !addr_is_local(&ifa->addr); in addrconf_ifdown()
3909 spin_lock_bh(&ifa->lock); in addrconf_ifdown()
3914 ifa->state = INET6_IFADDR_STATE_PREDAD; in addrconf_ifdown()
3915 if (!(ifa->flags & IFA_F_NODAD)) in addrconf_ifdown()
3916 ifa->flags |= IFA_F_TENTATIVE; in addrconf_ifdown()
3918 rt = ifa->rt; in addrconf_ifdown()
3919 ifa->rt = NULL; in addrconf_ifdown()
3921 state = ifa->state; in addrconf_ifdown()
3922 ifa->state = INET6_IFADDR_STATE_DEAD; in addrconf_ifdown()
3925 spin_unlock_bh(&ifa->lock); in addrconf_ifdown()
3931 __ipv6_ifa_notify(RTM_DELADDR, ifa); in addrconf_ifdown()
3932 inet6addr_notifier_call_chain(NETDEV_DOWN, ifa); in addrconf_ifdown()
3935 addrconf_leave_anycast(ifa); in addrconf_ifdown()
3936 addrconf_leave_solict(ifa->idev, &ifa->addr); in addrconf_ifdown()
3941 list_del_rcu(&ifa->if_list); in addrconf_ifdown()
3943 in6_ifa_put(ifa); in addrconf_ifdown()
4358 struct inet6_ifaddr *ifa = NULL; in if6_get_first() local
4368 hlist_for_each_entry_rcu(ifa, &net->ipv6.inet6_addr_lst[state->bucket], in if6_get_first()
4375 return ifa; in if6_get_first()
4386 struct inet6_ifaddr *ifa) in if6_get_next() argument
4391 hlist_for_each_entry_continue_rcu(ifa, addr_lst) { in if6_get_next()
4393 return ifa; in if6_get_next()
4398 hlist_for_each_entry_rcu(ifa, in if6_get_next()
4400 return ifa; in if6_get_next()
4416 struct inet6_ifaddr *ifa; in if6_seq_next() local
4418 ifa = if6_get_next(seq, v); in if6_seq_next()
4420 return ifa; in if6_seq_next()
4915 struct inet6_ifaddr *ifa; in inet6_rtm_newaddr() local
4981 ifa = ipv6_get_ifaddr(net, cfg.pfx, dev, 1); in inet6_rtm_newaddr()
4982 if (!ifa) { in inet6_rtm_newaddr()
4995 err = inet6_addr_modify(net, ifa, &cfg); in inet6_rtm_newaddr()
4998 in6_ifa_put(ifa); in inet6_rtm_newaddr()
5068 static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, in inet6_fill_ifaddr() argument
5079 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), in inet6_fill_ifaddr()
5080 ifa->idev->dev->ifindex); in inet6_fill_ifaddr()
5086 spin_lock_bh(&ifa->lock); in inet6_fill_ifaddr()
5087 if (!((ifa->flags&IFA_F_PERMANENT) && in inet6_fill_ifaddr()
5088 (ifa->prefered_lft == INFINITY_LIFE_TIME))) { in inet6_fill_ifaddr()
5089 preferred = ifa->prefered_lft; in inet6_fill_ifaddr()
5090 valid = ifa->valid_lft; in inet6_fill_ifaddr()
5092 long tval = (jiffies - ifa->tstamp)/HZ; in inet6_fill_ifaddr()
5108 spin_unlock_bh(&ifa->lock); in inet6_fill_ifaddr()
5110 if (!ipv6_addr_any(&ifa->peer_addr)) { in inet6_fill_ifaddr()
5111 if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 || in inet6_fill_ifaddr()
5112 nla_put_in6_addr(skb, IFA_ADDRESS, &ifa->peer_addr) < 0) in inet6_fill_ifaddr()
5115 if (nla_put_in6_addr(skb, IFA_ADDRESS, &ifa->addr) < 0) in inet6_fill_ifaddr()
5118 if (ifa->rt_priority && in inet6_fill_ifaddr()
5119 nla_put_u32(skb, IFA_RT_PRIORITY, ifa->rt_priority)) in inet6_fill_ifaddr()
5122 if (put_cacheinfo(skb, ifa->cstamp, ifa->tstamp, preferred, valid) < 0) in inet6_fill_ifaddr()
5125 if (nla_put_u32(skb, IFA_FLAGS, ifa->flags) < 0) in inet6_fill_ifaddr()
5128 if (ifa->ifa_proto && in inet6_fill_ifaddr()
5129 nla_put_u8(skb, IFA_PROTO, ifa->ifa_proto)) in inet6_fill_ifaddr()
5220 struct inet6_ifaddr *ifa; in in6_dump_addrs() local
5224 list_for_each_entry(ifa, &idev->addr_list, if_list) { in in6_dump_addrs()
5227 err = inet6_fill_ifaddr(skb, ifa, fillargs); in in6_dump_addrs()
5490 struct inet6_ifaddr *ifa; in inet6_rtm_getaddr() local
5516 ifa = ipv6_get_ifaddr(tgt_net, addr, dev, 1); in inet6_rtm_getaddr()
5517 if (!ifa) { in inet6_rtm_getaddr()
5528 err = inet6_fill_ifaddr(skb, ifa, &fillargs); in inet6_rtm_getaddr()
5537 in6_ifa_put(ifa); in inet6_rtm_getaddr()
5546 static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) in inet6_ifa_notify() argument
5549 struct net *net = dev_net(ifa->idev->dev); in inet6_ifa_notify()
5563 err = inet6_fill_ifaddr(skb, ifa, &fillargs); in inet6_ifa_notify()
6592 struct inet6_ifaddr *ifa; in addrconf_disable_policy_idev() local
6595 list_for_each_entry(ifa, &idev->addr_list, if_list) { in addrconf_disable_policy_idev()
6596 spin_lock(&ifa->lock); in addrconf_disable_policy_idev()
6597 if (ifa->rt) { in addrconf_disable_policy_idev()
6599 struct fib6_nh *nh = ifa->rt->fib6_nh; in addrconf_disable_policy_idev()
6603 ifa->rt->dst_nopolicy = val ? true : false; in addrconf_disable_policy_idev()
6614 spin_unlock(&ifa->lock); in addrconf_disable_policy_idev()