Lines Matching refs:fl4
517 static void __build_flow_key(const struct net *net, struct flowi4 *fl4, in __build_flow_key() argument
531 flowi4_init_output(fl4, oif, mark, tos, in __build_flow_key()
538 static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb, in build_skb_flow_key() argument
548 __build_flow_key(net, fl4, sk, iph, oif, tos, prot, mark, 0); in build_skb_flow_key()
551 static void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk) in build_sk_flow_key() argument
561 flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, in build_sk_flow_key()
569 static void ip_rt_build_flow_key(struct flowi4 *fl4, const struct sock *sk, in ip_rt_build_flow_key() argument
573 build_skb_flow_key(fl4, skb, sk); in ip_rt_build_flow_key()
575 build_sk_flow_key(fl4, sk); in ip_rt_build_flow_key()
726 static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flowi4 *fl4, in __ip_do_redirect() argument
778 if (fib_lookup(net, fl4, &res, 0) == 0) { in __ip_do_redirect()
781 update_or_create_fnhe(nh, fl4->daddr, new_gw, in __ip_do_redirect()
812 struct flowi4 fl4; in ip_do_redirect() local
822 __build_flow_key(net, &fl4, sk, iph, oif, tos, prot, mark, 0); in ip_do_redirect()
823 __ip_do_redirect(rt, skb, &fl4, true); in ip_do_redirect()
1001 static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) in __ip_rt_update_pmtu() argument
1024 if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) { in __ip_rt_update_pmtu()
1027 update_or_create_fnhe(nh, fl4->daddr, 0, mtu, lock, in __ip_rt_update_pmtu()
1037 struct flowi4 fl4; in ip_rt_update_pmtu() local
1039 ip_rt_build_flow_key(&fl4, sk, skb); in ip_rt_update_pmtu()
1040 __ip_rt_update_pmtu(rt, &fl4, mtu); in ip_rt_update_pmtu()
1047 struct flowi4 fl4; in ipv4_update_pmtu() local
1053 __build_flow_key(net, &fl4, NULL, iph, oif, in ipv4_update_pmtu()
1055 rt = __ip_route_output_key(net, &fl4); in ipv4_update_pmtu()
1057 __ip_rt_update_pmtu(rt, &fl4, mtu); in ipv4_update_pmtu()
1066 struct flowi4 fl4; in __ipv4_sk_update_pmtu() local
1069 __build_flow_key(sock_net(sk), &fl4, sk, iph, 0, 0, 0, 0, 0); in __ipv4_sk_update_pmtu()
1071 if (!fl4.flowi4_mark) in __ipv4_sk_update_pmtu()
1072 fl4.flowi4_mark = IP4_REPLY_MARK(sock_net(sk), skb->mark); in __ipv4_sk_update_pmtu()
1074 rt = __ip_route_output_key(sock_net(sk), &fl4); in __ipv4_sk_update_pmtu()
1076 __ip_rt_update_pmtu(rt, &fl4, mtu); in __ipv4_sk_update_pmtu()
1084 struct flowi4 fl4; in ipv4_sk_update_pmtu() local
1102 __build_flow_key(net, &fl4, sk, iph, 0, 0, 0, 0, 0); in ipv4_sk_update_pmtu()
1106 rt = ip_route_output_flow(sock_net(sk), &fl4, sk); in ipv4_sk_update_pmtu()
1113 __ip_rt_update_pmtu((struct rtable *) xfrm_dst_path(&rt->dst), &fl4, mtu); in ipv4_sk_update_pmtu()
1119 rt = ip_route_output_flow(sock_net(sk), &fl4, sk); in ipv4_sk_update_pmtu()
1139 struct flowi4 fl4; in ipv4_redirect() local
1142 __build_flow_key(net, &fl4, NULL, iph, oif, in ipv4_redirect()
1144 rt = __ip_route_output_key(net, &fl4); in ipv4_redirect()
1146 __ip_do_redirect(rt, skb, &fl4, false); in ipv4_redirect()
1155 struct flowi4 fl4; in ipv4_sk_redirect() local
1159 __build_flow_key(net, &fl4, sk, iph, 0, 0, 0, 0, 0); in ipv4_sk_redirect()
1160 rt = __ip_route_output_key(net, &fl4); in ipv4_sk_redirect()
1162 __ip_do_redirect(rt, skb, &fl4, false); in ipv4_sk_redirect()
1223 struct flowi4 fl4; in ip_rt_get_source() local
1228 memset(&fl4, 0, sizeof(fl4)); in ip_rt_get_source()
1229 fl4.daddr = iph->daddr; in ip_rt_get_source()
1230 fl4.saddr = iph->saddr; in ip_rt_get_source()
1231 fl4.flowi4_tos = RT_TOS(iph->tos); in ip_rt_get_source()
1232 fl4.flowi4_oif = rt->dst.dev->ifindex; in ip_rt_get_source()
1233 fl4.flowi4_iif = skb->dev->ifindex; in ip_rt_get_source()
1234 fl4.flowi4_mark = skb->mark; in ip_rt_get_source()
1237 if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res, 0) == 0) in ip_rt_get_source()
1827 int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, in fib_multipath_hash() argument
1840 hash_keys.addrs.v4addrs.src = fl4->saddr; in fib_multipath_hash()
1841 hash_keys.addrs.v4addrs.dst = fl4->daddr; in fib_multipath_hash()
1870 hash_keys.addrs.v4addrs.src = fl4->saddr; in fib_multipath_hash()
1871 hash_keys.addrs.v4addrs.dst = fl4->daddr; in fib_multipath_hash()
1872 hash_keys.ports.src = fl4->fl4_sport; in fib_multipath_hash()
1873 hash_keys.ports.dst = fl4->fl4_dport; in fib_multipath_hash()
1874 hash_keys.basic.ip_proto = fl4->flowi4_proto; in fib_multipath_hash()
1925 struct flowi4 fl4; in ip_route_input_slow() local
1939 fl4.flowi4_tun_key.tun_id = tun_info->key.tun_id; in ip_route_input_slow()
1941 fl4.flowi4_tun_key.tun_id = 0; in ip_route_input_slow()
1975 fl4.flowi4_oif = 0; in ip_route_input_slow()
1976 fl4.flowi4_iif = dev->ifindex; in ip_route_input_slow()
1977 fl4.flowi4_mark = skb->mark; in ip_route_input_slow()
1978 fl4.flowi4_tos = tos; in ip_route_input_slow()
1979 fl4.flowi4_scope = RT_SCOPE_UNIVERSE; in ip_route_input_slow()
1980 fl4.flowi4_flags = 0; in ip_route_input_slow()
1981 fl4.daddr = daddr; in ip_route_input_slow()
1982 fl4.saddr = saddr; in ip_route_input_slow()
1983 fl4.flowi4_uid = sock_net_uid(net, NULL); in ip_route_input_slow()
1985 if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) { in ip_route_input_slow()
1988 fl4.flowi4_proto = 0; in ip_route_input_slow()
1989 fl4.fl4_sport = 0; in ip_route_input_slow()
1990 fl4.fl4_dport = 0; in ip_route_input_slow()
1993 err = fib_lookup(net, &fl4, res, 0); in ip_route_input_slow()
2187 const struct flowi4 *fl4, int orig_oif, in __mkroute_output() argument
2203 if (ipv4_is_loopback(fl4->saddr) && in __mkroute_output()
2208 if (ipv4_is_lbcast(fl4->daddr)) in __mkroute_output()
2210 else if (ipv4_is_multicast(fl4->daddr)) in __mkroute_output()
2212 else if (ipv4_is_zeronet(fl4->daddr)) in __mkroute_output()
2224 if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr, in __mkroute_output()
2225 fl4->flowi4_proto)) in __mkroute_output()
2255 fnhe = find_exception(nh, fl4->daddr); in __mkroute_output()
2261 if (unlikely(fl4->flowi4_flags & in __mkroute_output()
2296 !ipv4_is_local_multicast(fl4->daddr)) { in __mkroute_output()
2304 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache); in __mkroute_output()
2314 struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, in ip_route_output_key_hash() argument
2317 __u8 tos = RT_FL_TOS(fl4); in ip_route_output_key_hash()
2326 fl4->flowi4_iif = LOOPBACK_IFINDEX; in ip_route_output_key_hash()
2327 fl4->flowi4_tos = tos & IPTOS_RT_MASK; in ip_route_output_key_hash()
2328 fl4->flowi4_scope = ((tos & RTO_ONLINK) ? in ip_route_output_key_hash()
2332 rth = ip_route_output_key_hash_rcu(net, fl4, &res, skb); in ip_route_output_key_hash()
2339 struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, in ip_route_output_key_hash_rcu() argument
2344 int orig_oif = fl4->flowi4_oif; in ip_route_output_key_hash_rcu()
2349 if (fl4->saddr) { in ip_route_output_key_hash_rcu()
2351 if (ipv4_is_multicast(fl4->saddr) || in ip_route_output_key_hash_rcu()
2352 ipv4_is_lbcast(fl4->saddr) || in ip_route_output_key_hash_rcu()
2353 ipv4_is_zeronet(fl4->saddr)) in ip_route_output_key_hash_rcu()
2364 if (fl4->flowi4_oif == 0 && in ip_route_output_key_hash_rcu()
2365 (ipv4_is_multicast(fl4->daddr) || in ip_route_output_key_hash_rcu()
2366 ipv4_is_lbcast(fl4->daddr))) { in ip_route_output_key_hash_rcu()
2368 dev_out = __ip_dev_find(net, fl4->saddr, false); in ip_route_output_key_hash_rcu()
2387 fl4->flowi4_oif = dev_out->ifindex; in ip_route_output_key_hash_rcu()
2391 if (!(fl4->flowi4_flags & FLOWI_FLAG_ANYSRC)) { in ip_route_output_key_hash_rcu()
2393 if (!__ip_dev_find(net, fl4->saddr, false)) in ip_route_output_key_hash_rcu()
2399 if (fl4->flowi4_oif) { in ip_route_output_key_hash_rcu()
2400 dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif); in ip_route_output_key_hash_rcu()
2410 if (ipv4_is_local_multicast(fl4->daddr) || in ip_route_output_key_hash_rcu()
2411 ipv4_is_lbcast(fl4->daddr) || in ip_route_output_key_hash_rcu()
2412 fl4->flowi4_proto == IPPROTO_IGMP) { in ip_route_output_key_hash_rcu()
2413 if (!fl4->saddr) in ip_route_output_key_hash_rcu()
2414 fl4->saddr = inet_select_addr(dev_out, 0, in ip_route_output_key_hash_rcu()
2418 if (!fl4->saddr) { in ip_route_output_key_hash_rcu()
2419 if (ipv4_is_multicast(fl4->daddr)) in ip_route_output_key_hash_rcu()
2420 fl4->saddr = inet_select_addr(dev_out, 0, in ip_route_output_key_hash_rcu()
2421 fl4->flowi4_scope); in ip_route_output_key_hash_rcu()
2422 else if (!fl4->daddr) in ip_route_output_key_hash_rcu()
2423 fl4->saddr = inet_select_addr(dev_out, 0, in ip_route_output_key_hash_rcu()
2428 if (!fl4->daddr) { in ip_route_output_key_hash_rcu()
2429 fl4->daddr = fl4->saddr; in ip_route_output_key_hash_rcu()
2430 if (!fl4->daddr) in ip_route_output_key_hash_rcu()
2431 fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK); in ip_route_output_key_hash_rcu()
2433 fl4->flowi4_oif = LOOPBACK_IFINDEX; in ip_route_output_key_hash_rcu()
2439 err = fib_lookup(net, fl4, res, 0); in ip_route_output_key_hash_rcu()
2443 if (fl4->flowi4_oif && in ip_route_output_key_hash_rcu()
2444 (ipv4_is_multicast(fl4->daddr) || in ip_route_output_key_hash_rcu()
2445 !netif_index_is_l3_master(net, fl4->flowi4_oif))) { in ip_route_output_key_hash_rcu()
2464 if (fl4->saddr == 0) in ip_route_output_key_hash_rcu()
2465 fl4->saddr = inet_select_addr(dev_out, 0, in ip_route_output_key_hash_rcu()
2475 if (!fl4->saddr) { in ip_route_output_key_hash_rcu()
2477 fl4->saddr = res->fi->fib_prefsrc; in ip_route_output_key_hash_rcu()
2479 fl4->saddr = fl4->daddr; in ip_route_output_key_hash_rcu()
2491 fl4->flowi4_oif = dev_out->ifindex; in ip_route_output_key_hash_rcu()
2496 fib_select_path(net, res, fl4, skb); in ip_route_output_key_hash_rcu()
2499 fl4->flowi4_oif = dev_out->ifindex; in ip_route_output_key_hash_rcu()
2503 rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags); in ip_route_output_key_hash_rcu()
2603 struct rtable *rt, u32 table_id, struct flowi4 *fl4, in rt_fill_info() argument
2620 r->rtm_tos = fl4->flowi4_tos; in rt_fill_info()
2649 fl4->saddr != src) { in rt_fill_info()
2650 if (nla_put_in_addr(skb, RTA_PREFSRC, fl4->saddr)) in rt_fill_info()
2675 if (fl4->flowi4_mark && in rt_fill_info()
2676 nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark)) in rt_fill_info()
2679 if (!uid_eq(fl4->flowi4_uid, INVALID_UID) && in rt_fill_info()
2681 from_kuid_munged(current_user_ns(), fl4->flowi4_uid))) in rt_fill_info()
2691 fl4->saddr, fl4->daddr, in rt_fill_info()
2701 if (nla_put_u32(skb, RTA_IIF, fl4->flowi4_iif)) in rt_fill_info()
2789 struct flowi4 fl4; in inet_rtm_getroute() local
2829 memset(&fl4, 0, sizeof(fl4)); in inet_rtm_getroute()
2830 fl4.daddr = dst; in inet_rtm_getroute()
2831 fl4.saddr = src; in inet_rtm_getroute()
2832 fl4.flowi4_tos = rtm->rtm_tos; in inet_rtm_getroute()
2833 fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0; in inet_rtm_getroute()
2834 fl4.flowi4_mark = mark; in inet_rtm_getroute()
2835 fl4.flowi4_uid = uid; in inet_rtm_getroute()
2837 fl4.fl4_sport = sport; in inet_rtm_getroute()
2839 fl4.fl4_dport = dport; in inet_rtm_getroute()
2840 fl4.flowi4_proto = ip_proto; in inet_rtm_getroute()
2853 fl4.flowi4_iif = iif; /* for rt_fill_info */ in inet_rtm_getroute()
2863 fl4.flowi4_iif = LOOPBACK_IFINDEX; in inet_rtm_getroute()
2864 rt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb); in inet_rtm_getroute()
2897 fl4.flowi4_tos, res.fi, 0); in inet_rtm_getroute()
2899 err = rt_fill_info(net, dst, src, rt, table_id, &fl4, skb, in inet_rtm_getroute()