Lines Matching refs:res
862 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) in dn_rt_set_next_hop() argument
864 struct dn_fib_info *fi = res->fi; in dn_rt_set_next_hop()
870 if (DN_FIB_RES_GW(*res) && in dn_rt_set_next_hop()
871 DN_FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) in dn_rt_set_next_hop()
872 rt->rt_gateway = DN_FIB_RES_GW(*res); in dn_rt_set_next_hop()
875 rt->rt_type = res->type; in dn_rt_set_next_hop()
936 static inline __le16 __dn_fib_res_prefsrc(struct dn_fib_res *res) in __dn_fib_res_prefsrc() argument
938 return dnet_select_source(DN_FIB_RES_DEV(*res), DN_FIB_RES_GW(*res), res->scope); in __dn_fib_res_prefsrc()
941 static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_res *res) in dn_fib_rules_map_destination() argument
943 __le16 mask = dnet_make_mask(res->prefixlen); in dn_fib_rules_map_destination()
944 return (daddr&~mask)|res->fi->fib_nh->nh_gw; in dn_fib_rules_map_destination()
962 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNICAST }; in dn_route_output_slow() local
1039 res.type = RTN_LOCAL; in dn_route_output_slow()
1056 if (try_hard || (err = dn_fib_lookup(&fld, &res)) != 0) { in dn_route_output_slow()
1085 res.type = RTN_LOCAL; in dn_route_output_slow()
1109 res.type = RTN_LOCAL; in dn_route_output_slow()
1124 res.type == RTN_LOCAL ? in dn_route_output_slow()
1127 if (fld.saddr == 0 && res.type != RTN_LOCAL) in dn_route_output_slow()
1135 if (res.type == RTN_NAT) in dn_route_output_slow()
1138 if (res.type == RTN_LOCAL) { in dn_route_output_slow()
1148 if (res.fi) in dn_route_output_slow()
1149 dn_fib_info_put(res.fi); in dn_route_output_slow()
1150 res.fi = NULL; in dn_route_output_slow()
1154 if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) in dn_route_output_slow()
1155 dn_fib_select_multipath(&fld, &res); in dn_route_output_slow()
1163 fld.saddr = DN_FIB_RES_PREFSRC(res); in dn_route_output_slow()
1167 dev_out = DN_FIB_RES_DEV(res); in dn_route_output_slow()
1170 gateway = DN_FIB_RES_GW(res); in dn_route_output_slow()
1206 err = dn_rt_set_next_hop(rt, &res); in dn_route_output_slow()
1218 dn_fib_res_put(&res); in dn_route_output_slow()
1319 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE }; in dn_route_input_slow() local
1343 err = dn_fib_lookup(&fld, &res); in dn_route_input_slow()
1353 res.type = RTN_LOCAL; in dn_route_input_slow()
1358 out_dev = DN_FIB_RES_DEV(res); in dn_route_input_slow()
1365 if (res.r) in dn_route_input_slow()
1368 gateway = DN_FIB_RES_GW(res); in dn_route_input_slow()
1369 if (res.type == RTN_NAT) { in dn_route_input_slow()
1370 fld.daddr = dn_fib_rules_map_destination(fld.daddr, &res); in dn_route_input_slow()
1371 dn_fib_res_put(&res); in dn_route_input_slow()
1373 if (dn_fib_lookup(&fld, &res)) in dn_route_input_slow()
1376 if (res.type != RTN_UNICAST) in dn_route_input_slow()
1384 switch(res.type) { in dn_route_input_slow()
1395 if (res.fi->fib_nhs > 1 && fld.flowidn_oif == 0) in dn_route_input_slow()
1396 dn_fib_select_multipath(&fld, &res); in dn_route_input_slow()
1407 local_src = DN_FIB_RES_PREFSRC(res); in dn_route_input_slow()
1467 switch (res.type) { in dn_route_input_slow()
1484 err = dn_rt_set_next_hop(rt, &res); in dn_route_input_slow()
1497 dn_fib_res_put(&res); in dn_route_input_slow()