Lines Matching refs:res
110 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res,
427 void fib6_select_path(const struct net *net, struct fib6_result *res, in fib6_select_path() argument
432 struct fib6_info *match = res->f6i; in fib6_select_path()
445 nexthop_path_fib6_result(res, fl6->mp_hash); in fib6_select_path()
467 res->f6i = match; in fib6_select_path()
468 res->nh = match->fib6_nh; in fib6_select_path()
515 struct fib6_result *res, in rt6_nh_dev_match() argument
535 static void rt6_device_match(struct net *net, struct fib6_result *res, in rt6_device_match() argument
538 struct fib6_info *f6i = res->f6i; in rt6_device_match()
558 nh = rt6_nh_dev_match(net, spf6i->nh, res, saddr, in rt6_device_match()
568 res->f6i = spf6i; in rt6_device_match()
574 res->f6i = net->ipv6.fib6_null_entry; in rt6_device_match()
575 nh = res->f6i->fib6_nh; in rt6_device_match()
588 res->f6i = net->ipv6.fib6_null_entry; in rt6_device_match()
589 nh = res->f6i->fib6_nh; in rt6_device_match()
592 res->nh = nh; in rt6_device_match()
593 res->fib6_type = res->f6i->fib6_type; in rt6_device_match()
594 res->fib6_flags = res->f6i->fib6_flags; in rt6_device_match()
598 res->fib6_flags |= RTF_REJECT; in rt6_device_match()
599 res->fib6_type = RTN_BLACKHOLE; in rt6_device_match()
600 res->nh = nh; in rt6_device_match()
795 struct fib6_result *res, struct fib6_info **cont, in __find_rr_leaf() argument
824 res->fib6_flags = RTF_REJECT; in __find_rr_leaf()
825 res->fib6_type = RTN_BLACKHOLE; in __find_rr_leaf()
826 res->f6i = f6i; in __find_rr_leaf()
827 res->nh = nexthop_fib6_nh(f6i->nh); in __find_rr_leaf()
842 res->f6i = f6i; in __find_rr_leaf()
843 res->nh = nh; in __find_rr_leaf()
844 res->fib6_flags = f6i->fib6_flags; in __find_rr_leaf()
845 res->fib6_type = f6i->fib6_type; in __find_rr_leaf()
852 bool *do_rr, struct fib6_result *res) in find_rr_leaf() argument
858 __find_rr_leaf(rr_head, NULL, metric, res, &cont, in find_rr_leaf()
861 __find_rr_leaf(leaf, rr_head, metric, res, &cont, in find_rr_leaf()
864 if (res->f6i || !cont) in find_rr_leaf()
867 __find_rr_leaf(cont, NULL, metric, res, NULL, in find_rr_leaf()
872 struct fib6_result *res, int strict) in rt6_select() argument
880 res->f6i = NULL; in rt6_select()
902 find_rr_leaf(fn, leaf, rt0, oif, strict, &do_rr, res); in rt6_select()
920 if (!res->f6i) { in rt6_select()
921 res->f6i = net->ipv6.fib6_null_entry; in rt6_select()
922 res->nh = res->f6i->fib6_nh; in rt6_select()
923 res->fib6_flags = res->f6i->fib6_flags; in rt6_select()
924 res->fib6_type = res->f6i->fib6_type; in rt6_select()
928 static bool rt6_is_gw_or_nonexthop(const struct fib6_result *res) in rt6_is_gw_or_nonexthop() argument
930 return (res->f6i->fib6_flags & RTF_NONEXTHOP) || in rt6_is_gw_or_nonexthop()
931 res->nh->fib_nh_gw_family; in rt6_is_gw_or_nonexthop()
1015 static struct net_device *ip6_rt_get_dev_rcu(const struct fib6_result *res) in ip6_rt_get_dev_rcu() argument
1017 struct net_device *dev = res->nh->fib_nh_dev; in ip6_rt_get_dev_rcu()
1019 if (res->fib6_flags & (RTF_LOCAL | RTF_ANYCAST)) { in ip6_rt_get_dev_rcu()
1025 !rt6_need_strict(&res->f6i->fib6_dst.addr)) in ip6_rt_get_dev_rcu()
1093 static void ip6_rt_init_dst(struct rt6_info *rt, const struct fib6_result *res) in ip6_rt_init_dst() argument
1095 struct fib6_info *f6i = res->f6i; in ip6_rt_init_dst()
1097 if (res->fib6_flags & RTF_REJECT) { in ip6_rt_init_dst()
1098 ip6_rt_init_dst_reject(rt, res->fib6_type); in ip6_rt_init_dst()
1105 if (res->fib6_type == RTN_LOCAL || res->fib6_type == RTN_ANYCAST) { in ip6_rt_init_dst()
1113 if (res->nh->fib_nh_lws) { in ip6_rt_init_dst()
1114 rt->dst.lwtstate = lwtstate_get(res->nh->fib_nh_lws); in ip6_rt_init_dst()
1130 static void ip6_rt_copy_init(struct rt6_info *rt, const struct fib6_result *res) in ip6_rt_copy_init() argument
1132 const struct fib6_nh *nh = res->nh; in ip6_rt_copy_init()
1134 struct fib6_info *f6i = res->f6i; in ip6_rt_copy_init()
1136 ip6_rt_init_dst(rt, res); in ip6_rt_copy_init()
1140 rt->rt6i_flags = res->fib6_flags; in ip6_rt_copy_init()
1186 static struct rt6_info *ip6_create_rt_rcu(const struct fib6_result *res) in ip6_create_rt_rcu() argument
1188 struct net_device *dev = res->nh->fib_nh_dev; in ip6_create_rt_rcu()
1189 struct fib6_info *f6i = res->f6i; in ip6_create_rt_rcu()
1203 ip6_rt_copy_init(nrt, res); in ip6_create_rt_rcu()
1218 struct fib6_result res = {}; in ip6_pol_route_lookup() local
1228 res.f6i = rcu_dereference(fn->leaf); in ip6_pol_route_lookup()
1229 if (!res.f6i) in ip6_pol_route_lookup()
1230 res.f6i = net->ipv6.fib6_null_entry; in ip6_pol_route_lookup()
1232 rt6_device_match(net, &res, &fl6->saddr, fl6->flowi6_oif, in ip6_pol_route_lookup()
1235 if (res.f6i == net->ipv6.fib6_null_entry) { in ip6_pol_route_lookup()
1243 } else if (res.fib6_flags & RTF_REJECT) { in ip6_pol_route_lookup()
1247 fib6_select_path(net, &res, fl6, fl6->flowi6_oif, in ip6_pol_route_lookup()
1251 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); in ip6_pol_route_lookup()
1257 rt = ip6_create_rt_rcu(&res); in ip6_pol_route_lookup()
1261 trace_fib6_table_lookup(net, &res, table, fl6); in ip6_pol_route_lookup()
1328 static struct rt6_info *ip6_rt_cache_alloc(const struct fib6_result *res, in ip6_rt_cache_alloc() argument
1332 struct fib6_info *f6i = res->f6i; in ip6_rt_cache_alloc()
1343 dev = ip6_rt_get_dev_rcu(res); in ip6_rt_cache_alloc()
1350 ip6_rt_copy_init(rt, res); in ip6_rt_cache_alloc()
1356 if (!rt6_is_gw_or_nonexthop(res)) { in ip6_rt_cache_alloc()
1371 static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res) in ip6_rt_pcpu_alloc() argument
1373 struct fib6_info *f6i = res->f6i; in ip6_rt_pcpu_alloc()
1382 dev = ip6_rt_get_dev_rcu(res); in ip6_rt_pcpu_alloc()
1389 ip6_rt_copy_init(pcpu_rt, res); in ip6_rt_pcpu_alloc()
1395 static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) in rt6_get_pcpu_route() argument
1399 pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu); in rt6_get_pcpu_route()
1405 const struct fib6_result *res) in rt6_make_pcpu_route() argument
1409 pcpu_rt = ip6_rt_pcpu_alloc(res); in rt6_make_pcpu_route()
1413 p = this_cpu_ptr(res->nh->rt6i_pcpu); in rt6_make_pcpu_route()
1417 if (res->f6i->fib6_destroying) { in rt6_make_pcpu_route()
1561 static unsigned int fib6_mtu(const struct fib6_result *res) in fib6_mtu() argument
1563 const struct fib6_nh *nh = res->nh; in fib6_mtu()
1566 if (res->f6i->fib6_pmtu) { in fib6_mtu()
1567 mtu = res->f6i->fib6_pmtu; in fib6_mtu()
1637 const struct fib6_result *res) in rt6_insert_exception() argument
1641 struct fib6_info *f6i = res->f6i; in rt6_insert_exception()
1644 struct fib6_nh *nh = res->nh; in rt6_insert_exception()
1678 if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) { in rt6_insert_exception()
1767 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res, in rt6_find_cached_rt() argument
1788 if (res->f6i->fib6_src.plen) in rt6_find_cached_rt()
1792 bucket = fib6_nh_get_excptn_bucket(res->nh, NULL); in rt6_find_cached_rt()
1800 if (!ret && src_key && src_key != &res->f6i->fib6_src.addr) { in rt6_find_cached_rt()
1801 src_key = &res->f6i->fib6_src.addr; in rt6_find_cached_rt()
2159 struct flowi6 *fl6, struct fib6_result *res, int strict) in fib6_table_lookup() argument
2170 rt6_select(net, fn, oif, res, strict); in fib6_table_lookup()
2171 if (res->f6i == net->ipv6.fib6_null_entry) { in fib6_table_lookup()
2183 trace_fib6_table_lookup(net, res, table, fl6); in fib6_table_lookup()
2192 struct fib6_result res = {}; in ip6_pol_route() local
2206 fib6_table_lookup(net, table, oif, fl6, &res, strict); in ip6_pol_route()
2207 if (res.f6i == net->ipv6.fib6_null_entry) in ip6_pol_route()
2210 fib6_select_path(net, &res, fl6, oif, false, skb, strict); in ip6_pol_route()
2213 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); in ip6_pol_route()
2217 !res.nh->fib_nh_gw_family)) { in ip6_pol_route()
2223 rt = ip6_rt_cache_alloc(&res, &fl6->daddr, NULL); in ip6_pol_route()
2240 rt = rt6_get_pcpu_route(&res); in ip6_pol_route()
2243 rt = rt6_make_pcpu_route(net, &res); in ip6_pol_route()
2733 struct fib6_result res = {}; in __ip6_rt_update_pmtu() local
2737 res.f6i = rcu_dereference(rt6->from); in __ip6_rt_update_pmtu()
2738 if (!res.f6i) in __ip6_rt_update_pmtu()
2741 res.fib6_flags = res.f6i->fib6_flags; in __ip6_rt_update_pmtu()
2742 res.fib6_type = res.f6i->fib6_type; in __ip6_rt_update_pmtu()
2744 if (res.f6i->nh) { in __ip6_rt_update_pmtu()
2750 nexthop_for_each_fib6_nh(res.f6i->nh, in __ip6_rt_update_pmtu()
2759 res.nh = arg.match; in __ip6_rt_update_pmtu()
2761 res.nh = res.f6i->fib6_nh; in __ip6_rt_update_pmtu()
2764 nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr); in __ip6_rt_update_pmtu()
2767 if (rt6_insert_exception(nrt6, &res)) in __ip6_rt_update_pmtu()
2843 static bool ip6_redirect_nh_match(const struct fib6_result *res, in ip6_redirect_nh_match() argument
2848 const struct fib6_nh *nh = res->nh; in ip6_redirect_nh_match()
2862 rt_cache = rt6_find_cached_rt(res, &fl6->daddr, &fl6->saddr); in ip6_redirect_nh_match()
2874 struct fib6_result *res; member
2884 arg->res->nh = nh; in fib6_nh_redirect_match()
2885 return ip6_redirect_nh_match(arg->res, arg->fl6, arg->gw, arg->ret); in fib6_nh_redirect_match()
2902 struct fib6_result res = {}; in __ip6_route_redirect() local
2904 .res = &res, in __ip6_route_redirect()
2932 res.f6i = rt; in __ip6_route_redirect()
2946 res.nh = rt->fib6_nh; in __ip6_route_redirect()
2947 if (ip6_redirect_nh_match(&res, fl6, &rdfl->gateway, in __ip6_route_redirect()
2966 res.f6i = rt; in __ip6_route_redirect()
2967 res.nh = rt->fib6_nh; in __ip6_route_redirect()
2972 res.fib6_flags = res.f6i->fib6_flags; in __ip6_route_redirect()
2973 res.fib6_type = res.f6i->fib6_type; in __ip6_route_redirect()
2974 ret = ip6_create_rt_rcu(&res); in __ip6_route_redirect()
2979 trace_fib6_table_lookup(net, &res, table, fl6); in __ip6_route_redirect()
3097 u32 ip6_mtu_from_fib6(const struct fib6_result *res, in ip6_mtu_from_fib6() argument
3101 const struct fib6_nh *nh = res->nh; in ip6_mtu_from_fib6()
3102 struct fib6_info *f6i = res->f6i; in ip6_mtu_from_fib6()
3113 rt = rt6_find_cached_rt(res, daddr, saddr); in ip6_mtu_from_fib6()
3196 int flags, struct fib6_result *res) in ip6_nh_lookup_table() argument
3215 err = fib6_table_lookup(net, table, cfg->fc_ifindex, &fl6, res, flags); in ip6_nh_lookup_table()
3216 if (!err && res->f6i != net->ipv6.fib6_null_entry) in ip6_nh_lookup_table()
3217 fib6_select_path(net, res, &fl6, cfg->fc_ifindex, in ip6_nh_lookup_table()
3230 struct fib6_result res = {}; in ip6_route_check_nh_onlink() local
3233 err = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0, &res); in ip6_route_check_nh_onlink()
3234 if (!err && !(res.fib6_flags & RTF_REJECT) && in ip6_route_check_nh_onlink()
3236 !ipv6_addr_any(&res.f6i->fib6_dst.addr) && in ip6_route_check_nh_onlink()
3237 (res.fib6_type != RTN_UNICAST || dev != res.nh->fib_nh_dev)) { in ip6_route_check_nh_onlink()
3254 struct fib6_result res = {}; in ip6_route_check_nh() local
3259 cfg->fc_table, flags, &res); in ip6_route_check_nh()
3263 if (err || res.fib6_flags & RTF_REJECT || in ip6_route_check_nh()
3264 res.nh->fib_nh_gw_family || in ip6_route_check_nh()
3265 (dev && dev != res.nh->fib_nh_dev)) in ip6_route_check_nh()
3275 err = fib6_lookup(net, cfg->fc_ifindex, &fl6, &res, flags); in ip6_route_check_nh()
3276 if (err || res.fib6_flags & RTF_REJECT || in ip6_route_check_nh()
3277 res.nh->fib_nh_gw_family) in ip6_route_check_nh()
3283 fib6_select_path(net, &res, &fl6, cfg->fc_ifindex, in ip6_route_check_nh()
3289 if (dev != res.nh->fib_nh_dev) in ip6_route_check_nh()
3292 *_dev = dev = res.nh->fib_nh_dev; in ip6_route_check_nh()
3825 struct fib6_result res = { in ip6_del_cached_rt() local
3831 rt_cache = rt6_find_cached_rt(&res, &cfg->fc_dst, &cfg->fc_src); in ip6_del_cached_rt()
3953 struct fib6_result res = {}; in rt6_do_redirect() local
4039 res.f6i = rcu_dereference(rt->from); in rt6_do_redirect()
4040 if (!res.f6i) in rt6_do_redirect()
4043 if (res.f6i->nh) { in rt6_do_redirect()
4049 nexthop_for_each_fib6_nh(res.f6i->nh, in rt6_do_redirect()
4057 res.nh = arg.match; in rt6_do_redirect()
4059 res.nh = res.f6i->fib6_nh; in rt6_do_redirect()
4062 res.fib6_flags = res.f6i->fib6_flags; in rt6_do_redirect()
4063 res.fib6_type = res.f6i->fib6_type; in rt6_do_redirect()
4064 nrt = ip6_rt_cache_alloc(&res, &msg->dest, NULL); in rt6_do_redirect()
4075 if (rt6_insert_exception(nrt, &res)) { in rt6_do_redirect()