Lines Matching refs:nhc
164 static void free_nh_exceptions(struct fib_nh_common *nhc) in free_nh_exceptions() argument
169 hash = rcu_dereference_protected(nhc->nhc_exceptions, 1); in free_nh_exceptions()
211 void fib_nh_common_release(struct fib_nh_common *nhc) in fib_nh_common_release() argument
213 dev_put(nhc->nhc_dev); in fib_nh_common_release()
214 lwtstate_put(nhc->nhc_lwtstate); in fib_nh_common_release()
215 rt_fibinfo_free_cpus(nhc->nhc_pcpu_rth_output); in fib_nh_common_release()
216 rt_fibinfo_free(&nhc->nhc_rth_input); in fib_nh_common_release()
217 free_nh_exceptions(nhc); in fib_nh_common_release()
492 struct fib_nh_common *nhc = fib_info_nhc(fi, i); in fib_nlmsg_size() local
494 if (nhc->nhc_lwtstate) { in fib_nlmsg_size()
497 nhc->nhc_lwtstate); in fib_nlmsg_size()
552 const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); in fib_detect_death() local
556 if (likely(nhc->nhc_gw_family == AF_INET)) in fib_detect_death()
557 n = neigh_lookup(&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev); in fib_detect_death()
558 else if (nhc->nhc_gw_family == AF_INET6) in fib_detect_death()
559 n = neigh_lookup(ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6, in fib_detect_death()
560 nhc->nhc_dev); in fib_detect_death()
582 int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc, in fib_nh_common_init() argument
589 nhc->nhc_pcpu_rth_output = alloc_percpu_gfp(struct rtable __rcu *, in fib_nh_common_init()
591 if (!nhc->nhc_pcpu_rth_output) in fib_nh_common_init()
603 nhc->nhc_family, cfg, &lwtstate, in fib_nh_common_init()
608 nhc->nhc_lwtstate = lwtstate_get(lwtstate); in fib_nh_common_init()
614 rt_fibinfo_free_cpus(nhc->nhc_pcpu_rth_output); in fib_nh_common_init()
615 nhc->nhc_pcpu_rth_output = NULL; in fib_nh_common_init()
1343 __be32 fib_info_update_nhc_saddr(struct net *net, struct fib_nh_common *nhc, in fib_info_update_nhc_saddr() argument
1349 if (nhc->nhc_family != AF_INET) in fib_info_update_nhc_saddr()
1350 return inet_select_addr(nhc->nhc_dev, 0, scope); in fib_info_update_nhc_saddr()
1352 nh = container_of(nhc, struct fib_nh, nh_common); in fib_info_update_nhc_saddr()
1363 struct fib_nh_common *nhc = res->nhc; in fib_result_prefsrc() local
1368 if (nhc->nhc_family == AF_INET) { in fib_result_prefsrc()
1371 nh = container_of(nhc, struct fib_nh, nh_common); in fib_result_prefsrc()
1377 return fib_info_update_nhc_saddr(net, nhc, res->fi->fib_scope); in fib_result_prefsrc()
1653 int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, in fib_nexthop_info() argument
1656 if (nhc->nhc_flags & RTNH_F_DEAD) in fib_nexthop_info()
1659 if (nhc->nhc_flags & RTNH_F_LINKDOWN) { in fib_nexthop_info()
1663 switch (nhc->nhc_family) { in fib_nexthop_info()
1665 if (ip_ignore_linkdown(nhc->nhc_dev)) in fib_nexthop_info()
1669 if (ip6_ignore_linkdown(nhc->nhc_dev)) in fib_nexthop_info()
1676 switch (nhc->nhc_gw_family) { in fib_nexthop_info()
1678 if (nla_put_in_addr(skb, RTA_GATEWAY, nhc->nhc_gw.ipv4)) in fib_nexthop_info()
1685 if (rt_family != nhc->nhc_gw_family) { in fib_nexthop_info()
1696 memcpy(via->rtvia_addr, &nhc->nhc_gw.ipv6, alen); in fib_nexthop_info()
1698 &nhc->nhc_gw.ipv6) < 0) { in fib_nexthop_info()
1704 *flags |= (nhc->nhc_flags & in fib_nexthop_info()
1707 if (!skip_oif && nhc->nhc_dev && in fib_nexthop_info()
1708 nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex)) in fib_nexthop_info()
1711 if (nhc->nhc_lwtstate && in fib_nexthop_info()
1712 lwtunnel_fill_encap(skb, nhc->nhc_lwtstate, in fib_nexthop_info()
1724 int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, in fib_add_nexthop() argument
1727 const struct net_device *dev = nhc->nhc_dev; in fib_add_nexthop()
1738 if (fib_nexthop_info(skb, nhc, rt_family, &flags, true) < 0) in fib_add_nexthop()
1849 const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); in fib_dump_info() local
1852 if (fib_nexthop_info(skb, nhc, AF_INET, &flags, false) < 0) in fib_dump_info()
1857 if (nhc->nhc_family == AF_INET) { in fib_dump_info()
1860 nh = container_of(nhc, struct fib_nh, nh_common); in fib_dump_info()
1956 void fib_nhc_update_mtu(struct fib_nh_common *nhc, u32 new, u32 orig) in fib_nhc_update_mtu() argument
1961 bucket = rcu_dereference_protected(nhc->nhc_exceptions, 1); in fib_nhc_update_mtu()
2082 struct fib_nh_common *nhc; in fib_select_default() local
2105 nhc = fib_info_nhc(next_fi, 0); in fib_select_default()
2106 if (!nhc->nhc_gw_family || nhc->nhc_scope != RT_SCOPE_LINK) in fib_select_default()
2253 res->nhc = &nexthop_nh->nh_common; in fib_select_multipath()
2262 res->nhc = &nexthop_nh->nh_common; in fib_select_multipath()