Lines Matching refs:nhc
166 static void free_nh_exceptions(struct fib_nh_common *nhc) in free_nh_exceptions() argument
171 hash = rcu_dereference_protected(nhc->nhc_exceptions, 1); in free_nh_exceptions()
213 void fib_nh_common_release(struct fib_nh_common *nhc) in fib_nh_common_release() argument
215 netdev_put(nhc->nhc_dev, &nhc->nhc_dev_tracker); in fib_nh_common_release()
216 lwtstate_put(nhc->nhc_lwtstate); in fib_nh_common_release()
217 rt_fibinfo_free_cpus(nhc->nhc_pcpu_rth_output); in fib_nh_common_release()
218 rt_fibinfo_free(&nhc->nhc_rth_input); in fib_nh_common_release()
219 free_nh_exceptions(nhc); in fib_nh_common_release()
493 struct fib_nh_common *nhc = fib_info_nhc(fi, i); in fib_nlmsg_size() local
495 if (nhc->nhc_lwtstate) { in fib_nlmsg_size()
498 nhc->nhc_lwtstate); in fib_nlmsg_size()
553 const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); in fib_detect_death() local
557 if (likely(nhc->nhc_gw_family == AF_INET)) in fib_detect_death()
558 n = neigh_lookup(&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev); in fib_detect_death()
559 else if (nhc->nhc_gw_family == AF_INET6) in fib_detect_death()
560 n = neigh_lookup(ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6, in fib_detect_death()
561 nhc->nhc_dev); in fib_detect_death()
583 int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc, in fib_nh_common_init() argument
590 nhc->nhc_pcpu_rth_output = alloc_percpu_gfp(struct rtable __rcu *, in fib_nh_common_init()
592 if (!nhc->nhc_pcpu_rth_output) in fib_nh_common_init()
604 nhc->nhc_family, cfg, &lwtstate, in fib_nh_common_init()
609 nhc->nhc_lwtstate = lwtstate_get(lwtstate); in fib_nh_common_init()
615 rt_fibinfo_free_cpus(nhc->nhc_pcpu_rth_output); in fib_nh_common_init()
616 nhc->nhc_pcpu_rth_output = NULL; in fib_nh_common_init()
1323 __be32 fib_info_update_nhc_saddr(struct net *net, struct fib_nh_common *nhc, in fib_info_update_nhc_saddr() argument
1328 if (nhc->nhc_family != AF_INET) in fib_info_update_nhc_saddr()
1329 return inet_select_addr(nhc->nhc_dev, 0, scope); in fib_info_update_nhc_saddr()
1331 nh = container_of(nhc, struct fib_nh, nh_common); in fib_info_update_nhc_saddr()
1340 struct fib_nh_common *nhc = res->nhc; in fib_result_prefsrc() local
1345 if (nhc->nhc_family == AF_INET) { in fib_result_prefsrc()
1348 nh = container_of(nhc, struct fib_nh, nh_common); in fib_result_prefsrc()
1353 return fib_info_update_nhc_saddr(net, nhc, res->fi->fib_scope); in fib_result_prefsrc()
1629 int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, in fib_nexthop_info() argument
1632 if (nhc->nhc_flags & RTNH_F_DEAD) in fib_nexthop_info()
1635 if (nhc->nhc_flags & RTNH_F_LINKDOWN) { in fib_nexthop_info()
1639 switch (nhc->nhc_family) { in fib_nexthop_info()
1641 if (ip_ignore_linkdown(nhc->nhc_dev)) in fib_nexthop_info()
1645 if (ip6_ignore_linkdown(nhc->nhc_dev)) in fib_nexthop_info()
1652 switch (nhc->nhc_gw_family) { in fib_nexthop_info()
1654 if (nla_put_in_addr(skb, RTA_GATEWAY, nhc->nhc_gw.ipv4)) in fib_nexthop_info()
1661 if (rt_family != nhc->nhc_gw_family) { in fib_nexthop_info()
1672 memcpy(via->rtvia_addr, &nhc->nhc_gw.ipv6, alen); in fib_nexthop_info()
1674 &nhc->nhc_gw.ipv6) < 0) { in fib_nexthop_info()
1680 *flags |= (nhc->nhc_flags & in fib_nexthop_info()
1683 if (!skip_oif && nhc->nhc_dev && in fib_nexthop_info()
1684 nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex)) in fib_nexthop_info()
1687 if (nhc->nhc_lwtstate && in fib_nexthop_info()
1688 lwtunnel_fill_encap(skb, nhc->nhc_lwtstate, in fib_nexthop_info()
1700 int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, in fib_add_nexthop() argument
1703 const struct net_device *dev = nhc->nhc_dev; in fib_add_nexthop()
1714 if (fib_nexthop_info(skb, nhc, rt_family, &flags, true) < 0) in fib_add_nexthop()
1825 const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); in fib_dump_info() local
1828 if (fib_nexthop_info(skb, nhc, AF_INET, &flags, false) < 0) in fib_dump_info()
1833 if (nhc->nhc_family == AF_INET) { in fib_dump_info()
1836 nh = container_of(nhc, struct fib_nh, nh_common); in fib_dump_info()
1932 void fib_nhc_update_mtu(struct fib_nh_common *nhc, u32 new, u32 orig) in fib_nhc_update_mtu() argument
1937 bucket = rcu_dereference_protected(nhc->nhc_exceptions, 1); in fib_nhc_update_mtu()
2058 struct fib_nh_common *nhc; in fib_select_default() local
2082 nhc = fib_info_nhc(next_fi, 0); in fib_select_default()
2083 if (!nhc->nhc_gw_family || nhc->nhc_scope != RT_SCOPE_LINK) in fib_select_default()
2230 res->nhc = &nexthop_nh->nh_common; in fib_select_multipath()
2239 res->nhc = &nexthop_nh->nh_common; in fib_select_multipath()