Lines Matching refs:nhi
98 const struct nh_info *nhi) in __nh_notifier_single_info_init() argument
100 nh_info->dev = nhi->fib_nhc.nhc_dev; in __nh_notifier_single_info_init()
101 nh_info->gw_family = nhi->fib_nhc.nhc_gw_family; in __nh_notifier_single_info_init()
103 nh_info->ipv4 = nhi->fib_nhc.nhc_gw.ipv4; in __nh_notifier_single_info_init()
105 nh_info->ipv6 = nhi->fib_nhc.nhc_gw.ipv6; in __nh_notifier_single_info_init()
107 nh_info->id = nhi->nh_parent->id; in __nh_notifier_single_info_init()
108 nh_info->is_reject = nhi->reject_nh; in __nh_notifier_single_info_init()
109 nh_info->is_fdb = nhi->fdb_nh; in __nh_notifier_single_info_init()
110 nh_info->has_encap = !!nhi->fib_nhc.nhc_lwtstate; in __nh_notifier_single_info_init()
116 struct nh_info *nhi = rtnl_dereference(nh->nh_info); in nh_notifier_single_info_init() local
123 __nh_notifier_single_info_init(info->nh, nhi); in nh_notifier_single_info_init()
151 struct nh_info *nhi; in nh_notifier_mpath_info_init() local
153 nhi = rtnl_dereference(nhge->nh->nh_info); in nh_notifier_mpath_info_init()
156 nhi); in nh_notifier_mpath_info_init()
183 struct nh_info *nhi; in nh_notifier_res_table_info_init() local
186 nhi = rtnl_dereference(nhge->nh->nh_info); in nh_notifier_res_table_info_init()
188 nhi); in nh_notifier_res_table_info_init()
469 static void nexthop_devhash_add(struct net *net, struct nh_info *nhi) in nexthop_devhash_add() argument
471 struct net_device *dev = nhi->fib_nhc.nhc_dev; in nexthop_devhash_add()
479 hlist_add_head(&nhi->dev_hash, head); in nexthop_devhash_add()
507 struct nh_info *nhi; in nexthop_free_single() local
509 nhi = rcu_dereference_raw(nh->nh_info); in nexthop_free_single()
510 switch (nhi->family) { in nexthop_free_single()
512 fib_nh_release(nh->net, &nhi->fib_nh); in nexthop_free_single()
515 ipv6_stub->fib6_nh_release(&nhi->fib6_nh); in nexthop_free_single()
518 kfree(nhi); in nexthop_free_single()
924 struct nh_info *nhi; in nh_fill_node() local
953 nhi = rtnl_dereference(nh->nh_info); in nh_fill_node()
954 nhm->nh_family = nhi->family; in nh_fill_node()
955 if (nhi->reject_nh) { in nh_fill_node()
959 } else if (nhi->fdb_nh) { in nh_fill_node()
965 dev = nhi->fib_nhc.nhc_dev; in nh_fill_node()
970 nhm->nh_scope = nhi->fib_nhc.nhc_scope; in nh_fill_node()
971 switch (nhi->family) { in nh_fill_node()
973 fib_nh = &nhi->fib_nh; in nh_fill_node()
980 fib6_nh = &nhi->fib6_nh; in nh_fill_node()
987 if (nhi->fib_nhc.nhc_lwtstate && in nh_fill_node()
988 lwtunnel_fill_encap(skb, nhi->fib_nhc.nhc_lwtstate, in nh_fill_node()
1025 struct nh_info *nhi = rtnl_dereference(nh->nh_info); in nh_nlmsg_size_single() local
1033 switch (nhi->family) { in nh_nlmsg_size_single()
1035 if (nhi->fib_nh.fib_nh_gw_family) in nh_nlmsg_size_single()
1041 if (nhi->fib6_nh.fib_nh_gw_family) in nh_nlmsg_size_single()
1046 if (nhi->fib_nhc.nhc_lwtstate) { in nh_nlmsg_size_single()
1047 sz += lwtunnel_get_encap_size(nhi->fib_nhc.nhc_lwtstate); in nh_nlmsg_size_single()
1235 struct nh_info *nhi = rtnl_dereference(nh->nh_info); in valid_group_nh() local
1237 if (nhi->reject_nh && npaths > 1) { in valid_group_nh()
1242 *is_fdb = nhi->fdb_nh; in valid_group_nh()
1251 struct nh_info *nhi; in nh_check_attr_fdb_group() local
1253 nhi = rtnl_dereference(nh->nh_info); in nh_check_attr_fdb_group()
1255 if (!nhi->fdb_nh) { in nh_check_attr_fdb_group()
1261 *nh_family = nhi->family; in nh_check_attr_fdb_group()
1262 } else if (*nh_family != nhi->family) { in nh_check_attr_fdb_group()
1388 struct nh_info *nhi = rcu_dereference(nh->nh_info); in nexthop_is_good_nh() local
1390 switch (nhi->family) { in nexthop_is_good_nh()
1392 return ipv4_good_nh(&nhi->fib_nh); in nexthop_is_good_nh()
1394 return ipv6_good_nh(&nhi->fib6_nh); in nexthop_is_good_nh()
1490 struct nh_info *nhi; in nexthop_for_each_fib6_nh() local
1501 nhi = rcu_dereference_rtnl(nhge->nh->nh_info); in nexthop_for_each_fib6_nh()
1502 err = cb(&nhi->fib6_nh, arg); in nexthop_for_each_fib6_nh()
1507 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_for_each_fib6_nh()
1508 err = cb(&nhi->fib6_nh, arg); in nexthop_for_each_fib6_nh()
1530 struct nh_info *nhi; in fib6_check_nexthop() local
1550 nhi = rtnl_dereference(nh->nh_info); in fib6_check_nexthop()
1551 if (nhi->family == AF_INET) in fib6_check_nexthop()
1553 is_fdb_nh = nhi->fdb_nh; in fib6_check_nexthop()
1587 static int nexthop_check_scope(struct nh_info *nhi, u8 scope, in nexthop_check_scope() argument
1590 if (scope == RT_SCOPE_HOST && nhi->fib_nhc.nhc_gw_family) { in nexthop_check_scope()
1596 if (nhi->fib_nhc.nhc_flags & RTNH_F_ONLINK && scope >= RT_SCOPE_LINK) { in nexthop_check_scope()
1611 struct nh_info *nhi; in fib_check_nexthop() local
1631 nhi = rtnl_dereference(nhg->nh_entries[0].nh->nh_info); in fib_check_nexthop()
1632 err = nexthop_check_scope(nhi, scope, extack); in fib_check_nexthop()
1634 nhi = rtnl_dereference(nh->nh_info); in fib_check_nexthop()
1635 if (nhi->fdb_nh) { in fib_check_nexthop()
1640 err = nexthop_check_scope(nhi, scope, extack); in fib_check_nexthop()
2026 struct nh_info *nhi; in remove_nh_grp_entry() local
2034 nhi = rtnl_dereference(nhges[i].nh->nh_info); in remove_nh_grp_entry()
2035 if (nhi->family == AF_INET) in remove_nh_grp_entry()
2136 struct nh_info *nhi; in __remove_nexthop() local
2138 nhi = rtnl_dereference(nh->nh_info); in __remove_nexthop()
2139 if (nhi->fib_nhc.nhc_dev) in __remove_nexthop()
2140 hlist_del(&nhi->dev_hash); in __remove_nexthop()
2188 struct nh_info *nhi = rtnl_dereference(nhge->nh->nh_info); in nh_rt_cache_flush() local
2190 if (nhi->family == AF_INET6) in nh_rt_cache_flush()
2191 ipv6_stub->fib6_nh_release_dsts(&nhi->fib6_nh); in nh_rt_cache_flush()
2290 struct nh_info *nhi; in nh_group_v4_update() local
2292 nhi = rtnl_dereference(nhges[i].nh->nh_info); in nh_group_v4_update()
2293 if (nhi->family == AF_INET) in nh_group_v4_update()
2503 struct nh_info *nhi = rtnl_dereference(new->nh_info); in replace_nexthop() local
2505 new_is_reject = nhi->reject_nh; in replace_nexthop()
2643 struct nh_info *nhi; in nexthop_flush_dev() local
2645 hlist_for_each_entry_safe(nhi, n, head, dev_hash) { in nexthop_flush_dev()
2646 if (nhi->fib_nhc.nhc_dev != dev) in nexthop_flush_dev()
2649 if (nhi->reject_nh && in nexthop_flush_dev()
2653 remove_nexthop(net, nhi->nh_parent, NULL); in nexthop_flush_dev()
2708 struct nh_info *nhi; in nexthop_create_group() local
2716 nhi = rtnl_dereference(nhe->nh_info); in nexthop_create_group()
2717 if (nhi->family == AF_INET) in nexthop_create_group()
2782 struct nh_info *nhi, struct nh_config *cfg, in nh_create_ipv4() argument
2785 struct fib_nh *fib_nh = &nhi->fib_nh; in nh_create_ipv4()
2804 if (nhi->fdb_nh) in nh_create_ipv4()
2821 struct nh_info *nhi, struct nh_config *cfg, in nh_create_ipv6() argument
2824 struct fib6_nh *fib6_nh = &nhi->fib6_nh; in nh_create_ipv6()
2858 struct nh_info *nhi; in nexthop_create() local
2866 nhi = kzalloc(sizeof(*nhi), GFP_KERNEL); in nexthop_create()
2867 if (!nhi) { in nexthop_create()
2875 nhi->nh_parent = nh; in nexthop_create()
2876 nhi->family = cfg->nh_family; in nexthop_create()
2877 nhi->fib_nhc.nhc_scope = RT_SCOPE_LINK; in nexthop_create()
2880 nhi->fdb_nh = 1; in nexthop_create()
2883 nhi->reject_nh = 1; in nexthop_create()
2889 err = nh_create_ipv4(net, nh, nhi, cfg, extack); in nexthop_create()
2892 err = nh_create_ipv6(net, nh, nhi, cfg, extack); in nexthop_create()
2897 kfree(nhi); in nexthop_create()
2903 if (!nhi->fdb_nh) in nexthop_create()
2904 nexthop_devhash_add(net, nhi); in nexthop_create()
2906 rcu_assign_pointer(nh->nh_info, nhi); in nexthop_create()
3355 const struct nh_info *nhi; in nh_dump_filtered() local
3366 nhi = rtnl_dereference(nh->nh_info); in nh_dump_filtered()
3367 if (family && nhi->family != family) in nh_dump_filtered()
3370 dev = nhi->fib_nhc.nhc_dev; in nh_dump_filtered()
3820 struct nh_info *nhi; in nexthop_sync_mtu() local
3822 hlist_for_each_entry_safe(nhi, n, head, dev_hash) { in nexthop_sync_mtu()
3823 if (nhi->fib_nhc.nhc_dev == dev) { in nexthop_sync_mtu()
3824 if (nhi->family == AF_INET) in nexthop_sync_mtu()
3825 fib_nhc_update_mtu(&nhi->fib_nhc, dev->mtu, in nexthop_sync_mtu()