Lines Matching refs:res
111 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res,
428 void fib6_select_path(const struct net *net, struct fib6_result *res, in fib6_select_path() argument
433 struct fib6_info *match = res->f6i; in fib6_select_path()
438 if (match->nh && have_oif_match && res->nh) in fib6_select_path()
449 nexthop_path_fib6_result(res, fl6->mp_hash); in fib6_select_path()
471 res->f6i = match; in fib6_select_path()
472 res->nh = match->fib6_nh; in fib6_select_path()
519 struct fib6_result *res, in rt6_nh_dev_match() argument
539 static void rt6_device_match(struct net *net, struct fib6_result *res, in rt6_device_match() argument
542 struct fib6_info *f6i = res->f6i; in rt6_device_match()
562 nh = rt6_nh_dev_match(net, spf6i->nh, res, saddr, in rt6_device_match()
572 res->f6i = spf6i; in rt6_device_match()
578 res->f6i = net->ipv6.fib6_null_entry; in rt6_device_match()
579 nh = res->f6i->fib6_nh; in rt6_device_match()
592 res->f6i = net->ipv6.fib6_null_entry; in rt6_device_match()
593 nh = res->f6i->fib6_nh; in rt6_device_match()
596 res->nh = nh; in rt6_device_match()
597 res->fib6_type = res->f6i->fib6_type; in rt6_device_match()
598 res->fib6_flags = res->f6i->fib6_flags; in rt6_device_match()
602 res->fib6_flags |= RTF_REJECT; in rt6_device_match()
603 res->fib6_type = RTN_BLACKHOLE; in rt6_device_match()
604 res->nh = nh; in rt6_device_match()
799 struct fib6_result *res, struct fib6_info **cont, in __find_rr_leaf() argument
828 res->fib6_flags = RTF_REJECT; in __find_rr_leaf()
829 res->fib6_type = RTN_BLACKHOLE; in __find_rr_leaf()
830 res->f6i = f6i; in __find_rr_leaf()
831 res->nh = nexthop_fib6_nh(f6i->nh); in __find_rr_leaf()
846 res->f6i = f6i; in __find_rr_leaf()
847 res->nh = nh; in __find_rr_leaf()
848 res->fib6_flags = f6i->fib6_flags; in __find_rr_leaf()
849 res->fib6_type = f6i->fib6_type; in __find_rr_leaf()
856 bool *do_rr, struct fib6_result *res) in find_rr_leaf() argument
862 __find_rr_leaf(rr_head, NULL, metric, res, &cont, in find_rr_leaf()
865 __find_rr_leaf(leaf, rr_head, metric, res, &cont, in find_rr_leaf()
868 if (res->f6i || !cont) in find_rr_leaf()
871 __find_rr_leaf(cont, NULL, metric, res, NULL, in find_rr_leaf()
876 struct fib6_result *res, int strict) in rt6_select() argument
884 res->f6i = NULL; in rt6_select()
906 find_rr_leaf(fn, leaf, rt0, oif, strict, &do_rr, res); in rt6_select()
924 if (!res->f6i) { in rt6_select()
925 res->f6i = net->ipv6.fib6_null_entry; in rt6_select()
926 res->nh = res->f6i->fib6_nh; in rt6_select()
927 res->fib6_flags = res->f6i->fib6_flags; in rt6_select()
928 res->fib6_type = res->f6i->fib6_type; in rt6_select()
932 static bool rt6_is_gw_or_nonexthop(const struct fib6_result *res) in rt6_is_gw_or_nonexthop() argument
934 return (res->f6i->fib6_flags & RTF_NONEXTHOP) || in rt6_is_gw_or_nonexthop()
935 res->nh->fib_nh_gw_family; in rt6_is_gw_or_nonexthop()
1019 static struct net_device *ip6_rt_get_dev_rcu(const struct fib6_result *res) in ip6_rt_get_dev_rcu() argument
1021 struct net_device *dev = res->nh->fib_nh_dev; in ip6_rt_get_dev_rcu()
1023 if (res->fib6_flags & (RTF_LOCAL | RTF_ANYCAST)) { in ip6_rt_get_dev_rcu()
1029 !rt6_need_strict(&res->f6i->fib6_dst.addr)) in ip6_rt_get_dev_rcu()
1097 static void ip6_rt_init_dst(struct rt6_info *rt, const struct fib6_result *res) in ip6_rt_init_dst() argument
1099 struct fib6_info *f6i = res->f6i; in ip6_rt_init_dst()
1101 if (res->fib6_flags & RTF_REJECT) { in ip6_rt_init_dst()
1102 ip6_rt_init_dst_reject(rt, res->fib6_type); in ip6_rt_init_dst()
1109 if (res->fib6_type == RTN_LOCAL || res->fib6_type == RTN_ANYCAST) { in ip6_rt_init_dst()
1117 if (res->nh->fib_nh_lws) { in ip6_rt_init_dst()
1118 rt->dst.lwtstate = lwtstate_get(res->nh->fib_nh_lws); in ip6_rt_init_dst()
1134 static void ip6_rt_copy_init(struct rt6_info *rt, const struct fib6_result *res) in ip6_rt_copy_init() argument
1136 const struct fib6_nh *nh = res->nh; in ip6_rt_copy_init()
1138 struct fib6_info *f6i = res->f6i; in ip6_rt_copy_init()
1140 ip6_rt_init_dst(rt, res); in ip6_rt_copy_init()
1144 rt->rt6i_flags = res->fib6_flags; in ip6_rt_copy_init()
1190 static struct rt6_info *ip6_create_rt_rcu(const struct fib6_result *res) in ip6_create_rt_rcu() argument
1192 struct net_device *dev = res->nh->fib_nh_dev; in ip6_create_rt_rcu()
1193 struct fib6_info *f6i = res->f6i; in ip6_create_rt_rcu()
1207 ip6_rt_copy_init(nrt, res); in ip6_create_rt_rcu()
1222 struct fib6_result res = {}; in ip6_pol_route_lookup() local
1232 res.f6i = rcu_dereference(fn->leaf); in ip6_pol_route_lookup()
1233 if (!res.f6i) in ip6_pol_route_lookup()
1234 res.f6i = net->ipv6.fib6_null_entry; in ip6_pol_route_lookup()
1236 rt6_device_match(net, &res, &fl6->saddr, fl6->flowi6_oif, in ip6_pol_route_lookup()
1239 if (res.f6i == net->ipv6.fib6_null_entry) { in ip6_pol_route_lookup()
1247 } else if (res.fib6_flags & RTF_REJECT) { in ip6_pol_route_lookup()
1251 fib6_select_path(net, &res, fl6, fl6->flowi6_oif, in ip6_pol_route_lookup()
1255 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); in ip6_pol_route_lookup()
1261 rt = ip6_create_rt_rcu(&res); in ip6_pol_route_lookup()
1265 trace_fib6_table_lookup(net, &res, table, fl6); in ip6_pol_route_lookup()
1332 static struct rt6_info *ip6_rt_cache_alloc(const struct fib6_result *res, in ip6_rt_cache_alloc() argument
1336 struct fib6_info *f6i = res->f6i; in ip6_rt_cache_alloc()
1347 dev = ip6_rt_get_dev_rcu(res); in ip6_rt_cache_alloc()
1354 ip6_rt_copy_init(rt, res); in ip6_rt_cache_alloc()
1360 if (!rt6_is_gw_or_nonexthop(res)) { in ip6_rt_cache_alloc()
1375 static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res) in ip6_rt_pcpu_alloc() argument
1377 struct fib6_info *f6i = res->f6i; in ip6_rt_pcpu_alloc()
1386 dev = ip6_rt_get_dev_rcu(res); in ip6_rt_pcpu_alloc()
1393 ip6_rt_copy_init(pcpu_rt, res); in ip6_rt_pcpu_alloc()
1408 static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) in rt6_get_pcpu_route() argument
1412 pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu); in rt6_get_pcpu_route()
1417 p = this_cpu_ptr(res->nh->rt6i_pcpu); in rt6_get_pcpu_route()
1431 const struct fib6_result *res) in rt6_make_pcpu_route() argument
1435 pcpu_rt = ip6_rt_pcpu_alloc(res); in rt6_make_pcpu_route()
1439 p = this_cpu_ptr(res->nh->rt6i_pcpu); in rt6_make_pcpu_route()
1443 if (res->f6i->fib6_destroying) { in rt6_make_pcpu_route()
1594 static unsigned int fib6_mtu(const struct fib6_result *res) in fib6_mtu() argument
1596 const struct fib6_nh *nh = res->nh; in fib6_mtu()
1599 if (res->f6i->fib6_pmtu) { in fib6_mtu()
1600 mtu = res->f6i->fib6_pmtu; in fib6_mtu()
1670 const struct fib6_result *res) in rt6_insert_exception() argument
1674 struct fib6_info *f6i = res->f6i; in rt6_insert_exception()
1677 struct fib6_nh *nh = res->nh; in rt6_insert_exception()
1712 if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) { in rt6_insert_exception()
1803 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res, in rt6_find_cached_rt() argument
1824 if (res->f6i->fib6_src.plen) in rt6_find_cached_rt()
1828 bucket = fib6_nh_get_excptn_bucket(res->nh, NULL); in rt6_find_cached_rt()
1836 if (!ret && src_key && src_key != &res->f6i->fib6_src.addr) { in rt6_find_cached_rt()
1837 src_key = &res->f6i->fib6_src.addr; in rt6_find_cached_rt()
2195 struct flowi6 *fl6, struct fib6_result *res, int strict) in fib6_table_lookup() argument
2206 rt6_select(net, fn, oif, res, strict); in fib6_table_lookup()
2207 if (res->f6i == net->ipv6.fib6_null_entry) { in fib6_table_lookup()
2219 trace_fib6_table_lookup(net, res, table, fl6); in fib6_table_lookup()
2228 struct fib6_result res = {}; in ip6_pol_route() local
2242 fib6_table_lookup(net, table, oif, fl6, &res, strict); in ip6_pol_route()
2243 if (res.f6i == net->ipv6.fib6_null_entry) in ip6_pol_route()
2246 fib6_select_path(net, &res, fl6, oif, false, skb, strict); in ip6_pol_route()
2249 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); in ip6_pol_route()
2253 !res.nh->fib_nh_gw_family)) { in ip6_pol_route()
2259 rt = ip6_rt_cache_alloc(&res, &fl6->daddr, NULL); in ip6_pol_route()
2276 rt = rt6_get_pcpu_route(&res); in ip6_pol_route()
2279 rt = rt6_make_pcpu_route(net, &res); in ip6_pol_route()
2774 struct fib6_result res = {}; in __ip6_rt_update_pmtu() local
2778 res.f6i = rcu_dereference(rt6->from); in __ip6_rt_update_pmtu()
2779 if (!res.f6i) in __ip6_rt_update_pmtu()
2782 res.fib6_flags = res.f6i->fib6_flags; in __ip6_rt_update_pmtu()
2783 res.fib6_type = res.f6i->fib6_type; in __ip6_rt_update_pmtu()
2785 if (res.f6i->nh) { in __ip6_rt_update_pmtu()
2791 nexthop_for_each_fib6_nh(res.f6i->nh, in __ip6_rt_update_pmtu()
2800 res.nh = arg.match; in __ip6_rt_update_pmtu()
2802 res.nh = res.f6i->fib6_nh; in __ip6_rt_update_pmtu()
2805 nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr); in __ip6_rt_update_pmtu()
2808 if (rt6_insert_exception(nrt6, &res)) in __ip6_rt_update_pmtu()
2884 static bool ip6_redirect_nh_match(const struct fib6_result *res, in ip6_redirect_nh_match() argument
2889 const struct fib6_nh *nh = res->nh; in ip6_redirect_nh_match()
2903 rt_cache = rt6_find_cached_rt(res, &fl6->daddr, &fl6->saddr); in ip6_redirect_nh_match()
2915 struct fib6_result *res; member
2925 arg->res->nh = nh; in fib6_nh_redirect_match()
2926 return ip6_redirect_nh_match(arg->res, arg->fl6, arg->gw, arg->ret); in fib6_nh_redirect_match()
2943 struct fib6_result res = {}; in __ip6_route_redirect() local
2945 .res = &res, in __ip6_route_redirect()
2973 res.f6i = rt; in __ip6_route_redirect()
2987 res.nh = rt->fib6_nh; in __ip6_route_redirect()
2988 if (ip6_redirect_nh_match(&res, fl6, &rdfl->gateway, in __ip6_route_redirect()
3007 res.f6i = rt; in __ip6_route_redirect()
3008 res.nh = rt->fib6_nh; in __ip6_route_redirect()
3013 res.fib6_flags = res.f6i->fib6_flags; in __ip6_route_redirect()
3014 res.fib6_type = res.f6i->fib6_type; in __ip6_route_redirect()
3015 ret = ip6_create_rt_rcu(&res); in __ip6_route_redirect()
3020 trace_fib6_table_lookup(net, &res, table, fl6); in __ip6_route_redirect()
3138 u32 ip6_mtu_from_fib6(const struct fib6_result *res, in ip6_mtu_from_fib6() argument
3142 const struct fib6_nh *nh = res->nh; in ip6_mtu_from_fib6()
3143 struct fib6_info *f6i = res->f6i; in ip6_mtu_from_fib6()
3154 rt = rt6_find_cached_rt(res, daddr, saddr); in ip6_mtu_from_fib6()
3240 int flags, struct fib6_result *res) in ip6_nh_lookup_table() argument
3259 err = fib6_table_lookup(net, table, cfg->fc_ifindex, &fl6, res, flags); in ip6_nh_lookup_table()
3260 if (!err && res->f6i != net->ipv6.fib6_null_entry) in ip6_nh_lookup_table()
3261 fib6_select_path(net, res, &fl6, cfg->fc_ifindex, in ip6_nh_lookup_table()
3274 struct fib6_result res = {}; in ip6_route_check_nh_onlink() local
3277 err = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0, &res); in ip6_route_check_nh_onlink()
3278 if (!err && !(res.fib6_flags & RTF_REJECT) && in ip6_route_check_nh_onlink()
3280 !ipv6_addr_any(&res.f6i->fib6_dst.addr) && in ip6_route_check_nh_onlink()
3281 (res.fib6_type != RTN_UNICAST || dev != res.nh->fib_nh_dev)) { in ip6_route_check_nh_onlink()
3298 struct fib6_result res = {}; in ip6_route_check_nh() local
3303 cfg->fc_table, flags, &res); in ip6_route_check_nh()
3307 if (err || res.fib6_flags & RTF_REJECT || in ip6_route_check_nh()
3308 res.nh->fib_nh_gw_family || in ip6_route_check_nh()
3309 (dev && dev != res.nh->fib_nh_dev)) in ip6_route_check_nh()
3319 err = fib6_lookup(net, cfg->fc_ifindex, &fl6, &res, flags); in ip6_route_check_nh()
3320 if (err || res.fib6_flags & RTF_REJECT || in ip6_route_check_nh()
3321 res.nh->fib_nh_gw_family) in ip6_route_check_nh()
3327 fib6_select_path(net, &res, &fl6, cfg->fc_ifindex, in ip6_route_check_nh()
3333 if (dev != res.nh->fib_nh_dev) in ip6_route_check_nh()
3336 *_dev = dev = res.nh->fib_nh_dev; in ip6_route_check_nh()
3873 struct fib6_result res = { in ip6_del_cached_rt() local
3879 rt_cache = rt6_find_cached_rt(&res, &cfg->fc_dst, &cfg->fc_src); in ip6_del_cached_rt()
4001 struct fib6_result res = {}; in rt6_do_redirect() local
4087 res.f6i = rcu_dereference(rt->from); in rt6_do_redirect()
4088 if (!res.f6i) in rt6_do_redirect()
4091 if (res.f6i->nh) { in rt6_do_redirect()
4097 nexthop_for_each_fib6_nh(res.f6i->nh, in rt6_do_redirect()
4105 res.nh = arg.match; in rt6_do_redirect()
4107 res.nh = res.f6i->fib6_nh; in rt6_do_redirect()
4110 res.fib6_flags = res.f6i->fib6_flags; in rt6_do_redirect()
4111 res.fib6_type = res.f6i->fib6_type; in rt6_do_redirect()
4112 nrt = ip6_rt_cache_alloc(&res, &msg->dest, NULL); in rt6_do_redirect()
4123 if (rt6_insert_exception(nrt, &res)) { in rt6_do_redirect()