Lines Matching refs:ifa

131 static void inet_hash_insert(struct net *net, struct in_ifaddr *ifa)  in inet_hash_insert()  argument
133 u32 hash = inet_addr_hash(net, ifa->ifa_local); in inet_hash_insert()
136 hlist_add_head_rcu(&ifa->hash, &inet_addr_lst[hash]); in inet_hash_insert()
139 static void inet_hash_remove(struct in_ifaddr *ifa) in inet_hash_remove() argument
142 hlist_del_init_rcu(&ifa->hash); in inet_hash_remove()
156 struct in_ifaddr *ifa; in __ip_dev_find() local
159 ifa = inet_lookup_ifaddr_rcu(net, addr); in __ip_dev_find()
160 if (!ifa) { in __ip_dev_find()
174 result = ifa->ifa_dev->dev; in __ip_dev_find()
187 struct in_ifaddr *ifa; in inet_lookup_ifaddr_rcu() local
189 hlist_for_each_entry_rcu(ifa, &inet_addr_lst[hash], hash) in inet_lookup_ifaddr_rcu()
190 if (ifa->ifa_local == addr && in inet_lookup_ifaddr_rcu()
191 net_eq(dev_net(ifa->ifa_dev->dev), net)) in inet_lookup_ifaddr_rcu()
192 return ifa; in inet_lookup_ifaddr_rcu()
226 struct in_ifaddr *ifa = container_of(head, struct in_ifaddr, rcu_head); in inet_rcu_free_ifa() local
227 if (ifa->ifa_dev) in inet_rcu_free_ifa()
228 in_dev_put(ifa->ifa_dev); in inet_rcu_free_ifa()
229 kfree(ifa); in inet_rcu_free_ifa()
232 static void inet_free_ifa(struct in_ifaddr *ifa) in inet_free_ifa() argument
234 call_rcu(&ifa->rcu_head, inet_rcu_free_ifa); in inet_free_ifa()
310 struct in_ifaddr *ifa; in inetdev_destroy() local
320 while ((ifa = rtnl_dereference(in_dev->ifa_list)) != NULL) { in inetdev_destroy()
322 inet_free_ifa(ifa); in inetdev_destroy()
336 const struct in_ifaddr *ifa; in inet_addr_onlink() local
339 in_dev_for_each_ifa_rcu(ifa, in_dev) { in inet_addr_onlink()
340 if (inet_ifa_match(a, ifa)) { in inet_addr_onlink()
341 if (!b || inet_ifa_match(b, ifa)) { in inet_addr_onlink()
356 struct in_ifaddr *ifa, *ifa1; in __inet_del_ifa() local
375 while ((ifa = rtnl_dereference(*ifap1)) != NULL) { in __inet_del_ifa()
376 if (!(ifa->ifa_flags & IFA_F_SECONDARY) && in __inet_del_ifa()
377 ifa1->ifa_scope <= ifa->ifa_scope) in __inet_del_ifa()
378 last_prim = ifa; in __inet_del_ifa()
380 if (!(ifa->ifa_flags & IFA_F_SECONDARY) || in __inet_del_ifa()
381 ifa1->ifa_mask != ifa->ifa_mask || in __inet_del_ifa()
382 !inet_ifa_match(ifa1->ifa_address, ifa)) { in __inet_del_ifa()
383 ifap1 = &ifa->ifa_next; in __inet_del_ifa()
384 prev_prom = ifa; in __inet_del_ifa()
389 inet_hash_remove(ifa); in __inet_del_ifa()
390 *ifap1 = ifa->ifa_next; in __inet_del_ifa()
392 rtmsg_ifa(RTM_DELADDR, ifa, nlh, portid); in __inet_del_ifa()
394 NETDEV_DOWN, ifa); in __inet_del_ifa()
395 inet_free_ifa(ifa); in __inet_del_ifa()
397 promote = ifa; in __inet_del_ifa()
408 for (ifa = promote; ifa; ifa = rtnl_dereference(ifa->ifa_next)) { in __inet_del_ifa()
409 if (ifa1->ifa_mask == ifa->ifa_mask && in __inet_del_ifa()
410 inet_ifa_match(ifa1->ifa_address, ifa)) in __inet_del_ifa()
411 fib_del_ifaddr(ifa, ifa1); in __inet_del_ifa()
451 for (ifa = next_sec; ifa; in __inet_del_ifa()
452 ifa = rtnl_dereference(ifa->ifa_next)) { in __inet_del_ifa()
453 if (ifa1->ifa_mask != ifa->ifa_mask || in __inet_del_ifa()
454 !inet_ifa_match(ifa1->ifa_address, ifa)) in __inet_del_ifa()
456 fib_add_ifaddr(ifa); in __inet_del_ifa()
475 static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, in __inet_insert_ifa() argument
479 struct in_device *in_dev = ifa->ifa_dev; in __inet_insert_ifa()
486 if (!ifa->ifa_local) { in __inet_insert_ifa()
487 inet_free_ifa(ifa); in __inet_insert_ifa()
491 ifa->ifa_flags &= ~IFA_F_SECONDARY; in __inet_insert_ifa()
495 ifa->ifa_flags &= ~IPV6ONLY_FLAGS; in __inet_insert_ifa()
502 ifa->ifa_scope <= ifa1->ifa_scope) in __inet_insert_ifa()
504 if (ifa1->ifa_mask == ifa->ifa_mask && in __inet_insert_ifa()
505 inet_ifa_match(ifa1->ifa_address, ifa)) { in __inet_insert_ifa()
506 if (ifa1->ifa_local == ifa->ifa_local) { in __inet_insert_ifa()
507 inet_free_ifa(ifa); in __inet_insert_ifa()
510 if (ifa1->ifa_scope != ifa->ifa_scope) { in __inet_insert_ifa()
511 inet_free_ifa(ifa); in __inet_insert_ifa()
514 ifa->ifa_flags |= IFA_F_SECONDARY; in __inet_insert_ifa()
528 ivi.ivi_addr = ifa->ifa_address; in __inet_insert_ifa()
529 ivi.ivi_dev = ifa->ifa_dev; in __inet_insert_ifa()
535 inet_free_ifa(ifa); in __inet_insert_ifa()
539 if (!(ifa->ifa_flags & IFA_F_SECONDARY)) in __inet_insert_ifa()
542 rcu_assign_pointer(ifa->ifa_next, *ifap); in __inet_insert_ifa()
543 rcu_assign_pointer(*ifap, ifa); in __inet_insert_ifa()
545 inet_hash_insert(dev_net(in_dev->dev), ifa); in __inet_insert_ifa()
553 rtmsg_ifa(RTM_NEWADDR, ifa, nlh, portid); in __inet_insert_ifa()
554 blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa); in __inet_insert_ifa()
559 static int inet_insert_ifa(struct in_ifaddr *ifa) in inet_insert_ifa() argument
561 return __inet_insert_ifa(ifa, NULL, 0, NULL); in inet_insert_ifa()
564 static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) in inet_set_ifa() argument
571 inet_free_ifa(ifa); in inet_set_ifa()
576 if (ifa->ifa_dev != in_dev) { in inet_set_ifa()
577 WARN_ON(ifa->ifa_dev); in inet_set_ifa()
579 ifa->ifa_dev = in_dev; in inet_set_ifa()
581 if (ipv4_is_loopback(ifa->ifa_local)) in inet_set_ifa()
582 ifa->ifa_scope = RT_SCOPE_HOST; in inet_set_ifa()
583 return inet_insert_ifa(ifa); in inet_set_ifa()
608 struct in_ifaddr *ifa; in inet_ifa_byprefix() local
612 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in inet_ifa_byprefix()
613 if (ifa->ifa_mask == mask && inet_ifa_match(prefix, ifa)) in inet_ifa_byprefix()
614 return ifa; in inet_ifa_byprefix()
620 const struct in_ifaddr *ifa) in ip_mc_autojoin_config() argument
624 .imr_multiaddr.s_addr = ifa->ifa_address, in ip_mc_autojoin_config()
625 .imr_ifindex = ifa->ifa_dev->dev->ifindex, in ip_mc_autojoin_config()
653 struct in_ifaddr *ifa; in inet_rtm_deladdr() local
670 for (ifap = &in_dev->ifa_list; (ifa = rtnl_dereference(*ifap)) != NULL; in inet_rtm_deladdr()
671 ifap = &ifa->ifa_next) { in inet_rtm_deladdr()
673 ifa->ifa_local != nla_get_in_addr(tb[IFA_LOCAL])) in inet_rtm_deladdr()
676 if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) in inet_rtm_deladdr()
680 (ifm->ifa_prefixlen != ifa->ifa_prefixlen || in inet_rtm_deladdr()
681 !inet_ifa_match(nla_get_in_addr(tb[IFA_ADDRESS]), ifa))) in inet_rtm_deladdr()
684 if (ipv4_is_multicast(ifa->ifa_address)) in inet_rtm_deladdr()
685 ip_mc_autojoin_config(net, false, ifa); in inet_rtm_deladdr()
700 struct in_ifaddr *ifa; in check_lifetime() local
711 hlist_for_each_entry_rcu(ifa, &inet_addr_lst[i], hash) { in check_lifetime()
714 if (ifa->ifa_flags & IFA_F_PERMANENT) in check_lifetime()
718 age = (now - ifa->ifa_tstamp + in check_lifetime()
721 if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && in check_lifetime()
722 age >= ifa->ifa_valid_lft) { in check_lifetime()
724 } else if (ifa->ifa_preferred_lft == in check_lifetime()
727 } else if (age >= ifa->ifa_preferred_lft) { in check_lifetime()
728 if (time_before(ifa->ifa_tstamp + in check_lifetime()
729 ifa->ifa_valid_lft * HZ, next)) in check_lifetime()
730 next = ifa->ifa_tstamp + in check_lifetime()
731 ifa->ifa_valid_lft * HZ; in check_lifetime()
733 if (!(ifa->ifa_flags & IFA_F_DEPRECATED)) in check_lifetime()
735 } else if (time_before(ifa->ifa_tstamp + in check_lifetime()
736 ifa->ifa_preferred_lft * HZ, in check_lifetime()
738 next = ifa->ifa_tstamp + in check_lifetime()
739 ifa->ifa_preferred_lft * HZ; in check_lifetime()
746 hlist_for_each_entry_safe(ifa, n, &inet_addr_lst[i], hash) { in check_lifetime()
749 if (ifa->ifa_flags & IFA_F_PERMANENT) in check_lifetime()
753 age = (now - ifa->ifa_tstamp + in check_lifetime()
756 if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && in check_lifetime()
757 age >= ifa->ifa_valid_lft) { in check_lifetime()
761 ifap = &ifa->ifa_dev->ifa_list; in check_lifetime()
764 if (tmp == ifa) { in check_lifetime()
765 inet_del_ifa(ifa->ifa_dev, in check_lifetime()
772 } else if (ifa->ifa_preferred_lft != in check_lifetime()
774 age >= ifa->ifa_preferred_lft && in check_lifetime()
775 !(ifa->ifa_flags & IFA_F_DEPRECATED)) { in check_lifetime()
776 ifa->ifa_flags |= IFA_F_DEPRECATED; in check_lifetime()
777 rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0); in check_lifetime()
799 static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft, in set_ifa_lifetime() argument
804 ifa->ifa_flags &= ~(IFA_F_PERMANENT | IFA_F_DEPRECATED); in set_ifa_lifetime()
808 ifa->ifa_valid_lft = timeout; in set_ifa_lifetime()
810 ifa->ifa_flags |= IFA_F_PERMANENT; in set_ifa_lifetime()
815 ifa->ifa_flags |= IFA_F_DEPRECATED; in set_ifa_lifetime()
816 ifa->ifa_preferred_lft = timeout; in set_ifa_lifetime()
818 ifa->ifa_tstamp = jiffies; in set_ifa_lifetime()
819 if (!ifa->ifa_cstamp) in set_ifa_lifetime()
820 ifa->ifa_cstamp = ifa->ifa_tstamp; in set_ifa_lifetime()
828 struct in_ifaddr *ifa; in rtm_to_ifaddr() local
854 ifa = inet_alloc_ifa(); in rtm_to_ifaddr()
855 if (!ifa) in rtm_to_ifaddr()
869 INIT_HLIST_NODE(&ifa->hash); in rtm_to_ifaddr()
870 ifa->ifa_prefixlen = ifm->ifa_prefixlen; in rtm_to_ifaddr()
871 ifa->ifa_mask = inet_make_mask(ifm->ifa_prefixlen); in rtm_to_ifaddr()
872 ifa->ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : in rtm_to_ifaddr()
874 ifa->ifa_scope = ifm->ifa_scope; in rtm_to_ifaddr()
875 ifa->ifa_dev = in_dev; in rtm_to_ifaddr()
877 ifa->ifa_local = nla_get_in_addr(tb[IFA_LOCAL]); in rtm_to_ifaddr()
878 ifa->ifa_address = nla_get_in_addr(tb[IFA_ADDRESS]); in rtm_to_ifaddr()
881 ifa->ifa_broadcast = nla_get_in_addr(tb[IFA_BROADCAST]); in rtm_to_ifaddr()
884 nla_strscpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); in rtm_to_ifaddr()
886 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); in rtm_to_ifaddr()
889 ifa->ifa_rt_priority = nla_get_u32(tb[IFA_RT_PRIORITY]); in rtm_to_ifaddr()
892 ifa->ifa_proto = nla_get_u8(tb[IFA_PROTO]); in rtm_to_ifaddr()
906 return ifa; in rtm_to_ifaddr()
909 inet_free_ifa(ifa); in rtm_to_ifaddr()
914 static struct in_ifaddr *find_matching_ifa(struct in_ifaddr *ifa) in find_matching_ifa() argument
916 struct in_device *in_dev = ifa->ifa_dev; in find_matching_ifa()
919 if (!ifa->ifa_local) in find_matching_ifa()
923 if (ifa1->ifa_mask == ifa->ifa_mask && in find_matching_ifa()
924 inet_ifa_match(ifa1->ifa_address, ifa) && in find_matching_ifa()
925 ifa1->ifa_local == ifa->ifa_local) in find_matching_ifa()
935 struct in_ifaddr *ifa; in inet_rtm_newaddr() local
942 ifa = rtm_to_ifaddr(net, nlh, &valid_lft, &prefered_lft, extack); in inet_rtm_newaddr()
943 if (IS_ERR(ifa)) in inet_rtm_newaddr()
944 return PTR_ERR(ifa); in inet_rtm_newaddr()
946 ifa_existing = find_matching_ifa(ifa); in inet_rtm_newaddr()
951 set_ifa_lifetime(ifa, valid_lft, prefered_lft); in inet_rtm_newaddr()
952 if (ifa->ifa_flags & IFA_F_MCAUTOJOIN) { in inet_rtm_newaddr()
953 int ret = ip_mc_autojoin_config(net, true, ifa); in inet_rtm_newaddr()
956 inet_free_ifa(ifa); in inet_rtm_newaddr()
960 return __inet_insert_ifa(ifa, nlh, NETLINK_CB(skb).portid, in inet_rtm_newaddr()
963 u32 new_metric = ifa->ifa_rt_priority; in inet_rtm_newaddr()
965 inet_free_ifa(ifa); in inet_rtm_newaddr()
970 ifa = ifa_existing; in inet_rtm_newaddr()
972 if (ifa->ifa_rt_priority != new_metric) { in inet_rtm_newaddr()
973 fib_modify_prefix_metric(ifa, new_metric); in inet_rtm_newaddr()
974 ifa->ifa_rt_priority = new_metric; in inet_rtm_newaddr()
977 set_ifa_lifetime(ifa, valid_lft, prefered_lft); in inet_rtm_newaddr()
981 rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid); in inet_rtm_newaddr()
1018 struct in_ifaddr *ifa = NULL; in devinet_ioctl() local
1090 (ifa = rtnl_dereference(*ifap)) != NULL; in devinet_ioctl()
1091 ifap = &ifa->ifa_next) { in devinet_ioctl()
1092 if (!strcmp(ifr->ifr_name, ifa->ifa_label) && in devinet_ioctl()
1094 ifa->ifa_local) { in devinet_ioctl()
1102 if (!ifa) { in devinet_ioctl()
1104 (ifa = rtnl_dereference(*ifap)) != NULL; in devinet_ioctl()
1105 ifap = &ifa->ifa_next) in devinet_ioctl()
1106 if (!strcmp(ifr->ifr_name, ifa->ifa_label)) in devinet_ioctl()
1112 if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS) in devinet_ioctl()
1118 sin->sin_addr.s_addr = ifa->ifa_local; in devinet_ioctl()
1123 sin->sin_addr.s_addr = ifa->ifa_broadcast; in devinet_ioctl()
1128 sin->sin_addr.s_addr = ifa->ifa_address; in devinet_ioctl()
1133 sin->sin_addr.s_addr = ifa->ifa_mask; in devinet_ioctl()
1139 if (!ifa) in devinet_ioctl()
1154 if (!ifa) { in devinet_ioctl()
1156 ifa = inet_alloc_ifa(); in devinet_ioctl()
1157 if (!ifa) in devinet_ioctl()
1159 INIT_HLIST_NODE(&ifa->hash); in devinet_ioctl()
1161 memcpy(ifa->ifa_label, ifr->ifr_name, IFNAMSIZ); in devinet_ioctl()
1163 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); in devinet_ioctl()
1166 if (ifa->ifa_local == sin->sin_addr.s_addr) in devinet_ioctl()
1169 ifa->ifa_broadcast = 0; in devinet_ioctl()
1170 ifa->ifa_scope = 0; in devinet_ioctl()
1173 ifa->ifa_address = ifa->ifa_local = sin->sin_addr.s_addr; in devinet_ioctl()
1176 ifa->ifa_prefixlen = inet_abc_len(ifa->ifa_address); in devinet_ioctl()
1177 ifa->ifa_mask = inet_make_mask(ifa->ifa_prefixlen); in devinet_ioctl()
1179 ifa->ifa_prefixlen < 31) in devinet_ioctl()
1180 ifa->ifa_broadcast = ifa->ifa_address | in devinet_ioctl()
1181 ~ifa->ifa_mask; in devinet_ioctl()
1183 ifa->ifa_prefixlen = 32; in devinet_ioctl()
1184 ifa->ifa_mask = inet_make_mask(32); in devinet_ioctl()
1186 set_ifa_lifetime(ifa, INFINITY_LIFE_TIME, INFINITY_LIFE_TIME); in devinet_ioctl()
1187 ret = inet_set_ifa(dev, ifa); in devinet_ioctl()
1192 if (ifa->ifa_broadcast != sin->sin_addr.s_addr) { in devinet_ioctl()
1194 ifa->ifa_broadcast = sin->sin_addr.s_addr; in devinet_ioctl()
1195 inet_insert_ifa(ifa); in devinet_ioctl()
1201 if (ifa->ifa_address == sin->sin_addr.s_addr) in devinet_ioctl()
1208 ifa->ifa_address = sin->sin_addr.s_addr; in devinet_ioctl()
1209 inet_insert_ifa(ifa); in devinet_ioctl()
1221 if (ifa->ifa_mask != sin->sin_addr.s_addr) { in devinet_ioctl()
1222 __be32 old_mask = ifa->ifa_mask; in devinet_ioctl()
1224 ifa->ifa_mask = sin->sin_addr.s_addr; in devinet_ioctl()
1225 ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); in devinet_ioctl()
1234 (ifa->ifa_prefixlen < 31) && in devinet_ioctl()
1235 (ifa->ifa_broadcast == in devinet_ioctl()
1236 (ifa->ifa_local|~old_mask))) { in devinet_ioctl()
1237 ifa->ifa_broadcast = (ifa->ifa_local | in devinet_ioctl()
1240 inet_insert_ifa(ifa); in devinet_ioctl()
1253 const struct in_ifaddr *ifa; in inet_gifconf() local
1263 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in inet_gifconf()
1271 strcpy(ifr.ifr_name, ifa->ifa_label); in inet_gifconf()
1275 ifa->ifa_local; in inet_gifconf()
1291 const struct in_ifaddr *ifa; in in_dev_select_addr() local
1293 in_dev_for_each_ifa_rcu(ifa, in_dev) { in in_dev_select_addr()
1294 if (ifa->ifa_flags & IFA_F_SECONDARY) in in_dev_select_addr()
1296 if (ifa->ifa_scope != RT_SCOPE_LINK && in in_dev_select_addr()
1297 ifa->ifa_scope <= scope) in in_dev_select_addr()
1298 return ifa->ifa_local; in in_dev_select_addr()
1306 const struct in_ifaddr *ifa; in inet_select_addr() local
1321 in_dev_for_each_ifa_rcu(ifa, in_dev) { in inet_select_addr()
1322 if (ifa->ifa_flags & IFA_F_SECONDARY) in inet_select_addr()
1324 if (min(ifa->ifa_scope, localnet_scope) > scope) in inet_select_addr()
1326 if (!dst || inet_ifa_match(dst, ifa)) { in inet_select_addr()
1327 addr = ifa->ifa_local; in inet_select_addr()
1331 addr = ifa->ifa_local; in inet_select_addr()
1378 const struct in_ifaddr *ifa; in confirm_addr_indev() local
1385 in_dev_for_each_ifa_rcu(ifa, in_dev) { in confirm_addr_indev()
1386 unsigned char min_scope = min(ifa->ifa_scope, localnet_scope); in confirm_addr_indev()
1389 (local == ifa->ifa_local || !local) && in confirm_addr_indev()
1391 addr = ifa->ifa_local; in confirm_addr_indev()
1396 same = (!local || inet_ifa_match(local, ifa)) && in confirm_addr_indev()
1397 (!dst || inet_ifa_match(dst, ifa)); in confirm_addr_indev()
1402 if (inet_ifa_match(addr, ifa)) in confirm_addr_indev()
1406 addr = ifa->ifa_local; in confirm_addr_indev()
1484 struct in_ifaddr *ifa; in inetdev_changename() local
1487 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in inetdev_changename()
1490 memcpy(old, ifa->ifa_label, IFNAMSIZ); in inetdev_changename()
1491 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); in inetdev_changename()
1500 strcat(ifa->ifa_label, dot); in inetdev_changename()
1502 strcpy(ifa->ifa_label + (IFNAMSIZ - strlen(dot) - 1), dot); in inetdev_changename()
1504 rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0); in inetdev_changename()
1512 const struct in_ifaddr *ifa; in inetdev_send_gratuitous_arp() local
1514 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in inetdev_send_gratuitous_arp()
1516 ifa->ifa_local, dev, in inetdev_send_gratuitous_arp()
1517 ifa->ifa_local, NULL, in inetdev_send_gratuitous_arp()
1558 struct in_ifaddr *ifa = inet_alloc_ifa(); in inetdev_event() local
1560 if (ifa) { in inetdev_event()
1561 INIT_HLIST_NODE(&ifa->hash); in inetdev_event()
1562 ifa->ifa_local = in inetdev_event()
1563 ifa->ifa_address = htonl(INADDR_LOOPBACK); in inetdev_event()
1564 ifa->ifa_prefixlen = 8; in inetdev_event()
1565 ifa->ifa_mask = inet_make_mask(8); in inetdev_event()
1567 ifa->ifa_dev = in_dev; in inetdev_event()
1568 ifa->ifa_scope = RT_SCOPE_HOST; in inetdev_event()
1569 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); in inetdev_event()
1570 set_ifa_lifetime(ifa, INFINITY_LIFE_TIME, in inetdev_event()
1574 inet_insert_ifa(ifa); in inetdev_event()
1653 static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, in inet_fill_ifaddr() argument
1667 ifm->ifa_prefixlen = ifa->ifa_prefixlen; in inet_fill_ifaddr()
1668 ifm->ifa_flags = ifa->ifa_flags; in inet_fill_ifaddr()
1669 ifm->ifa_scope = ifa->ifa_scope; in inet_fill_ifaddr()
1670 ifm->ifa_index = ifa->ifa_dev->dev->ifindex; in inet_fill_ifaddr()
1677 preferred = ifa->ifa_preferred_lft; in inet_fill_ifaddr()
1678 valid = ifa->ifa_valid_lft; in inet_fill_ifaddr()
1680 long tval = (jiffies - ifa->ifa_tstamp) / HZ; in inet_fill_ifaddr()
1697 if ((ifa->ifa_address && in inet_fill_ifaddr()
1698 nla_put_in_addr(skb, IFA_ADDRESS, ifa->ifa_address)) || in inet_fill_ifaddr()
1699 (ifa->ifa_local && in inet_fill_ifaddr()
1700 nla_put_in_addr(skb, IFA_LOCAL, ifa->ifa_local)) || in inet_fill_ifaddr()
1701 (ifa->ifa_broadcast && in inet_fill_ifaddr()
1702 nla_put_in_addr(skb, IFA_BROADCAST, ifa->ifa_broadcast)) || in inet_fill_ifaddr()
1703 (ifa->ifa_label[0] && in inet_fill_ifaddr()
1704 nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || in inet_fill_ifaddr()
1705 (ifa->ifa_proto && in inet_fill_ifaddr()
1706 nla_put_u8(skb, IFA_PROTO, ifa->ifa_proto)) || in inet_fill_ifaddr()
1707 nla_put_u32(skb, IFA_FLAGS, ifa->ifa_flags) || in inet_fill_ifaddr()
1708 (ifa->ifa_rt_priority && in inet_fill_ifaddr()
1709 nla_put_u32(skb, IFA_RT_PRIORITY, ifa->ifa_rt_priority)) || in inet_fill_ifaddr()
1710 put_cacheinfo(skb, ifa->ifa_cstamp, ifa->ifa_tstamp, in inet_fill_ifaddr()
1783 struct in_ifaddr *ifa; in in_dev_dump_addr() local
1787 in_dev_for_each_ifa_rtnl(ifa, in_dev) { in in_dev_dump_addr()
1792 err = inet_fill_ifaddr(skb, ifa, fillargs); in in_dev_dump_addr()
1891 static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, in rtmsg_ifa() argument
1905 net = dev_net(ifa->ifa_dev->dev); in rtmsg_ifa()
1910 err = inet_fill_ifaddr(skb, ifa, &fillargs); in rtmsg_ifa()