Lines Matching defs:res

114 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res,
413 void fib6_select_path(const struct net *net, struct fib6_result *res,
418 struct fib6_info *match = res->f6i;
423 if (match->nh && have_oif_match && res->nh)
437 nexthop_path_fib6_result(res, fl6->mp_hash);
459 res->f6i = match;
460 res->nh = match->fib6_nh;
507 struct fib6_result *res,
527 static void rt6_device_match(struct net *net, struct fib6_result *res,
530 struct fib6_info *f6i = res->f6i;
550 nh = rt6_nh_dev_match(net, spf6i->nh, res, saddr,
560 res->f6i = spf6i;
566 res->f6i = net->ipv6.fib6_null_entry;
567 nh = res->f6i->fib6_nh;
580 res->f6i = net->ipv6.fib6_null_entry;
581 nh = res->f6i->fib6_nh;
584 res->nh = nh;
585 res->fib6_type = res->f6i->fib6_type;
586 res->fib6_flags = res->f6i->fib6_flags;
590 res->fib6_flags |= RTF_REJECT;
591 res->fib6_type = RTN_BLACKHOLE;
592 res->nh = nh;
788 struct fib6_result *res, struct fib6_info **cont,
817 res->fib6_flags = RTF_REJECT;
818 res->fib6_type = RTN_BLACKHOLE;
819 res->f6i = f6i;
820 res->nh = nexthop_fib6_nh(f6i->nh);
835 res->f6i = f6i;
836 res->nh = nh;
837 res->fib6_flags = f6i->fib6_flags;
838 res->fib6_type = f6i->fib6_type;
845 bool *do_rr, struct fib6_result *res)
851 __find_rr_leaf(rr_head, NULL, metric, res, &cont,
854 __find_rr_leaf(leaf, rr_head, metric, res, &cont,
857 if (res->f6i || !cont)
860 __find_rr_leaf(cont, NULL, metric, res, NULL,
865 struct fib6_result *res, int strict)
873 res->f6i = NULL;
895 find_rr_leaf(fn, leaf, rt0, oif, strict, &do_rr, res);
913 if (!res->f6i) {
914 res->f6i = net->ipv6.fib6_null_entry;
915 res->nh = res->f6i->fib6_nh;
916 res->fib6_flags = res->f6i->fib6_flags;
917 res->fib6_type = res->f6i->fib6_type;
921 static bool rt6_is_gw_or_nonexthop(const struct fib6_result *res)
923 return (res->f6i->fib6_flags & RTF_NONEXTHOP) ||
924 res->nh->fib_nh_gw_family;
1008 static struct net_device *ip6_rt_get_dev_rcu(const struct fib6_result *res)
1010 struct net_device *dev = res->nh->fib_nh_dev;
1012 if (res->fib6_flags & (RTF_LOCAL | RTF_ANYCAST)) {
1018 !rt6_need_strict(&res->f6i->fib6_dst.addr))
1084 static void ip6_rt_init_dst(struct rt6_info *rt, const struct fib6_result *res)
1086 struct fib6_info *f6i = res->f6i;
1088 if (res->fib6_flags & RTF_REJECT) {
1089 ip6_rt_init_dst_reject(rt, res->fib6_type);
1096 if (res->fib6_type == RTN_LOCAL || res->fib6_type == RTN_ANYCAST) {
1104 if (res->nh->fib_nh_lws) {
1105 rt->dst.lwtstate = lwtstate_get(res->nh->fib_nh_lws);
1121 static void ip6_rt_copy_init(struct rt6_info *rt, const struct fib6_result *res)
1123 const struct fib6_nh *nh = res->nh;
1125 struct fib6_info *f6i = res->f6i;
1127 ip6_rt_init_dst(rt, res);
1131 rt->rt6i_flags = res->fib6_flags;
1177 static struct rt6_info *ip6_create_rt_rcu(const struct fib6_result *res)
1179 struct net_device *dev = res->nh->fib_nh_dev;
1180 struct fib6_info *f6i = res->f6i;
1194 ip6_rt_copy_init(nrt, res);
1209 struct fib6_result res = {};
1216 res.f6i = rcu_dereference(fn->leaf);
1217 if (!res.f6i)
1218 res.f6i = net->ipv6.fib6_null_entry;
1220 rt6_device_match(net, &res, &fl6->saddr, fl6->flowi6_oif,
1223 if (res.f6i == net->ipv6.fib6_null_entry) {
1231 } else if (res.fib6_flags & RTF_REJECT) {
1235 fib6_select_path(net, &res, fl6, fl6->flowi6_oif,
1239 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr);
1245 rt = ip6_create_rt_rcu(&res);
1249 trace_fib6_table_lookup(net, &res, table, fl6);
1316 static struct rt6_info *ip6_rt_cache_alloc(const struct fib6_result *res,
1320 struct fib6_info *f6i = res->f6i;
1331 dev = ip6_rt_get_dev_rcu(res);
1338 ip6_rt_copy_init(rt, res);
1343 if (!rt6_is_gw_or_nonexthop(res)) {
1358 static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res)
1360 struct fib6_info *f6i = res->f6i;
1369 dev = ip6_rt_get_dev_rcu(res);
1376 ip6_rt_copy_init(pcpu_rt, res);
1391 static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
1395 pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu);
1400 p = this_cpu_ptr(res->nh->rt6i_pcpu);
1414 const struct fib6_result *res)
1418 pcpu_rt = ip6_rt_pcpu_alloc(res);
1422 p = this_cpu_ptr(res->nh->rt6i_pcpu);
1426 if (res->f6i->fib6_destroying) {
1577 static unsigned int fib6_mtu(const struct fib6_result *res)
1579 const struct fib6_nh *nh = res->nh;
1582 if (res->f6i->fib6_pmtu) {
1583 mtu = res->f6i->fib6_pmtu;
1653 const struct fib6_result *res)
1657 struct fib6_info *f6i = res->f6i;
1660 struct fib6_nh *nh = res->nh;
1695 if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) {
1786 static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res,
1807 if (res->f6i->fib6_src.plen)
1811 bucket = fib6_nh_get_excptn_bucket(res->nh, NULL);
1819 if (!ret && src_key && src_key != &res->f6i->fib6_src.addr) {
1820 src_key = &res->f6i->fib6_src.addr;
2175 struct flowi6 *fl6, struct fib6_result *res, int strict)
2183 rt6_select(net, fn, oif, res, strict);
2184 if (res->f6i == net->ipv6.fib6_null_entry) {
2196 trace_fib6_table_lookup(net, res, table, fl6);
2205 struct fib6_result res = {};
2219 fib6_table_lookup(net, table, oif, fl6, &res, strict);
2220 if (res.f6i == net->ipv6.fib6_null_entry)
2223 fib6_select_path(net, &res, fl6, oif, false, skb, strict);
2226 rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr);
2230 !res.nh->fib_nh_gw_family)) {
2236 rt = ip6_rt_cache_alloc(&res, &fl6->daddr, NULL);
2252 rt = rt6_get_pcpu_route(&res);
2255 rt = rt6_make_pcpu_route(net, &res);
2877 struct fib6_result res = {};
2881 res.f6i = rcu_dereference(rt6->from);
2882 if (!res.f6i)
2885 res.fib6_flags = res.f6i->fib6_flags;
2886 res.fib6_type = res.f6i->fib6_type;
2888 if (res.f6i->nh) {
2894 nexthop_for_each_fib6_nh(res.f6i->nh,
2903 res.nh = arg.match;
2905 res.nh = res.f6i->fib6_nh;
2908 nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr);
2911 if (rt6_insert_exception(nrt6, &res))
2988 static bool ip6_redirect_nh_match(const struct fib6_result *res,
2993 const struct fib6_nh *nh = res->nh;
3007 rt_cache = rt6_find_cached_rt(res, &fl6->daddr, &fl6->saddr);
3019 struct fib6_result *res;
3029 arg->res->nh = nh;
3030 return ip6_redirect_nh_match(arg->res, arg->fl6, arg->gw, arg->ret);
3047 struct fib6_result res = {};
3049 .res = &res,
3071 res.f6i = rt;
3079 /* on match, res->nh is filled in and potentially ret */
3085 res.nh = rt->fib6_nh;
3086 if (ip6_redirect_nh_match(&res, fl6, &rdfl->gateway,
3105 res.f6i = rt;
3106 res.nh = rt->fib6_nh;
3111 res.fib6_flags = res.f6i->fib6_flags;
3112 res.fib6_type = res.f6i->fib6_type;
3113 ret = ip6_create_rt_rcu(&res);
3118 trace_fib6_table_lookup(net, &res, table, fl6);
3219 u32 ip6_mtu_from_fib6(const struct fib6_result *res,
3223 const struct fib6_nh *nh = res->nh;
3224 struct fib6_info *f6i = res->f6i;
3235 rt = rt6_find_cached_rt(res, daddr, saddr);
3313 int flags, struct fib6_result *res)
3332 err = fib6_table_lookup(net, table, cfg->fc_ifindex, &fl6, res, flags);
3333 if (!err && res->f6i != net->ipv6.fib6_null_entry)
3334 fib6_select_path(net, res, &fl6, cfg->fc_ifindex,
3347 struct fib6_result res = {};
3350 err = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0, &res);
3351 if (!err && !(res.fib6_flags & RTF_REJECT) &&
3353 !ipv6_addr_any(&res.f6i->fib6_dst.addr) &&
3354 (res.fib6_type != RTN_UNICAST || dev != res.nh->fib_nh_dev)) {
3372 struct fib6_result res = {};
3377 cfg->fc_table, flags, &res);
3381 if (err || res.fib6_flags & RTF_REJECT ||
3382 res.nh->fib_nh_gw_family ||
3383 (dev && dev != res.nh->fib_nh_dev))
3393 err = fib6_lookup(net, cfg->fc_ifindex, &fl6, &res, flags);
3394 if (err || res.fib6_flags & RTF_REJECT ||
3395 res.nh->fib_nh_gw_family)
3401 fib6_select_path(net, &res, &fl6, cfg->fc_ifindex,
3407 if (dev != res.nh->fib_nh_dev)
3410 *_dev = dev = res.nh->fib_nh_dev;
3982 struct fib6_result res = {
3988 rt_cache = rt6_find_cached_rt(&res, &cfg->fc_dst, &cfg->fc_src);
4110 struct fib6_result res = {};
4196 res.f6i = rcu_dereference(rt->from);
4197 if (!res.f6i)
4200 if (res.f6i->nh) {
4206 nexthop_for_each_fib6_nh(res.f6i->nh,
4214 res.nh = arg.match;
4216 res.nh = res.f6i->fib6_nh;
4219 res.fib6_flags = res.f6i->fib6_flags;
4220 res.fib6_type = res.f6i->fib6_type;
4221 nrt = ip6_rt_cache_alloc(&res, &msg->dest, NULL);
4232 if (rt6_insert_exception(nrt, &res)) {