Lines Matching refs:net

336 static int __net_init ip_rt_do_proc_init(struct net *net)  in ip_rt_do_proc_init()  argument
340 pde = proc_create_seq("rt_cache", 0444, net->proc_net, in ip_rt_do_proc_init()
345 pde = proc_create_seq("rt_cache", 0444, net->proc_net_stat, in ip_rt_do_proc_init()
351 pde = proc_create_single("rt_acct", 0, net->proc_net, in ip_rt_do_proc_init()
360 remove_proc_entry("rt_cache", net->proc_net_stat); in ip_rt_do_proc_init()
363 remove_proc_entry("rt_cache", net->proc_net); in ip_rt_do_proc_init()
368 static void __net_exit ip_rt_do_proc_exit(struct net *net) in ip_rt_do_proc_exit() argument
370 remove_proc_entry("rt_cache", net->proc_net_stat); in ip_rt_do_proc_exit()
371 remove_proc_entry("rt_cache", net->proc_net); in ip_rt_do_proc_exit()
373 remove_proc_entry("rt_acct", net->proc_net); in ip_rt_do_proc_exit()
399 void rt_cache_flush(struct net *net) in rt_cache_flush() argument
401 rt_genid_bump_ipv4(net); in rt_cache_flush()
484 void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) in __ip_select_ident() argument
489 if (unlikely(siphash_key_is_zero(&net->ipv4.ip_id_key))) in __ip_select_ident()
490 get_random_bytes(&net->ipv4.ip_id_key, in __ip_select_ident()
491 sizeof(net->ipv4.ip_id_key)); in __ip_select_ident()
496 &net->ipv4.ip_id_key); in __ip_select_ident()
511 static void __build_flow_key(const struct net *net, struct flowi4 *fl4, in __build_flow_key() argument
529 sock_net_uid(net, sk)); in __build_flow_key()
535 const struct net *net = dev_net(skb->dev); in build_skb_flow_key() local
542 __build_flow_key(net, fl4, sk, iph, oif, tos, prot, mark, 0); in build_skb_flow_key()
748 struct net *net; in __ip_do_redirect() local
768 net = dev_net(dev); in __ip_do_redirect()
780 if (inet_addr_type(net, new_gw) != RTN_UNICAST) in __ip_do_redirect()
791 if (fib_lookup(net, fl4, &res, 0) == 0) { in __ip_do_redirect()
794 fib_select_path(net, &res, fl4, skb); in __ip_do_redirect()
829 struct net *net = dev_net(skb->dev); in ip_do_redirect() local
837 __build_flow_key(net, &fl4, sk, iph, oif, tos, prot, mark, 0); in ip_do_redirect()
873 struct net *net; in ip_rt_send_redirect() local
887 net = dev_net(rt->dst.dev); in ip_rt_send_redirect()
888 peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif, 1); in ip_rt_send_redirect()
940 struct net *net; in ip_error() local
957 net = dev_net(rt->dst.dev); in ip_error()
962 __IP_INC_STATS(net, IPSTATS_MIB_INADDRERRORS); in ip_error()
967 __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES); in ip_error()
983 __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES); in ip_error()
990 peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, in ip_error()
1016 struct net *net = dev_net(dst->dev); in __ip_rt_update_pmtu() local
1028 if (mtu < net->ipv4.ip_rt_min_pmtu) { in __ip_rt_update_pmtu()
1030 mtu = min(old_mtu, net->ipv4.ip_rt_min_pmtu); in __ip_rt_update_pmtu()
1034 time_before(jiffies, dst->expires - net->ipv4.ip_rt_mtu_expires / 2)) in __ip_rt_update_pmtu()
1038 if (fib_lookup(net, fl4, &res, 0) == 0) { in __ip_rt_update_pmtu()
1041 fib_select_path(net, &res, fl4, NULL); in __ip_rt_update_pmtu()
1044 jiffies + net->ipv4.ip_rt_mtu_expires); in __ip_rt_update_pmtu()
1065 void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, in ipv4_update_pmtu() argument
1071 u32 mark = IP4_REPLY_MARK(net, skb->mark); in ipv4_update_pmtu()
1073 __build_flow_key(net, &fl4, NULL, iph, oif, iph->tos, protocol, mark, in ipv4_update_pmtu()
1075 rt = __ip_route_output_key(net, &fl4); in ipv4_update_pmtu()
1108 struct net *net = sock_net(sk); in ipv4_sk_update_pmtu() local
1122 __build_flow_key(net, &fl4, sk, iph, 0, 0, 0, 0, 0); in ipv4_sk_update_pmtu()
1155 void ipv4_redirect(struct sk_buff *skb, struct net *net, in ipv4_redirect() argument
1162 __build_flow_key(net, &fl4, NULL, iph, oif, iph->tos, protocol, 0, 0); in ipv4_redirect()
1163 rt = __ip_route_output_key(net, &fl4); in ipv4_redirect()
1176 struct net *net = sock_net(sk); in ipv4_sk_redirect() local
1178 __build_flow_key(net, &fl4, sk, iph, 0, 0, 0, 0, 0); in ipv4_sk_redirect()
1179 rt = __ip_route_output_key(net, &fl4); in ipv4_sk_redirect()
1247 static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb) in ip_rt_bug() argument
1308 struct net *net = dev_net(dst->dev); in ipv4_default_advmss() local
1311 net->ipv4.ip_rt_min_advmss); in ipv4_default_advmss()
1915 static u32 fib_multipath_custom_hash_outer(const struct net *net, in fib_multipath_custom_hash_outer() argument
1919 u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); in fib_multipath_custom_hash_outer()
1944 static u32 fib_multipath_custom_hash_inner(const struct net *net, in fib_multipath_custom_hash_inner() argument
1948 u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); in fib_multipath_custom_hash_inner()
1993 static u32 fib_multipath_custom_hash_skb(const struct net *net, in fib_multipath_custom_hash_skb() argument
1999 mhash = fib_multipath_custom_hash_outer(net, skb, &has_inner); in fib_multipath_custom_hash_skb()
2000 mhash_inner = fib_multipath_custom_hash_inner(net, skb, has_inner); in fib_multipath_custom_hash_skb()
2005 static u32 fib_multipath_custom_hash_fl4(const struct net *net, in fib_multipath_custom_hash_fl4() argument
2008 u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); in fib_multipath_custom_hash_fl4()
2031 int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, in fib_multipath_hash() argument
2038 switch (READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_policy)) { in fib_multipath_hash()
2117 mhash = fib_multipath_custom_hash_skb(net, skb); in fib_multipath_hash()
2119 mhash = fib_multipath_custom_hash_fl4(net, fl4); in fib_multipath_hash()
2159 struct net *net = dev_net(dev); in ip_route_use_hint() local
2172 if (ipv4_is_loopback(saddr) && !IN_DEV_NET_ROUTE_LOCALNET(in_dev, net)) in ip_route_use_hint()
2193 static struct net_device *ip_rt_get_dev(struct net *net, in ip_rt_get_dev() argument
2202 return dev ? : net->loopback_dev; in ip_rt_get_dev()
2224 struct net *net = dev_net(dev); in ip_route_input_slow() local
2270 if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net)) in ip_route_input_slow()
2273 if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net)) in ip_route_input_slow()
2289 fl4.flowi4_uid = sock_net_uid(net, NULL); in ip_route_input_slow()
2292 if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) { in ip_route_input_slow()
2300 err = fib_lookup(net, &fl4, res, 0); in ip_route_input_slow()
2311 if (IPV4_DEVCONF_ALL(net, BC_FORWARDING)) in ip_route_input_slow()
2365 rth = rt_dst_alloc(ip_rt_get_dev(net, res), in ip_route_input_slow()
2624 struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, in ip_route_output_key_hash() argument
2639 rth = ip_route_output_key_hash_rcu(net, fl4, &res, skb); in ip_route_output_key_hash()
2646 struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, in ip_route_output_key_hash_rcu() argument
2678 dev_out = __ip_dev_find(net, fl4->saddr, false); in ip_route_output_key_hash_rcu()
2703 if (!__ip_dev_find(net, fl4->saddr, false)) in ip_route_output_key_hash_rcu()
2710 dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif); in ip_route_output_key_hash_rcu()
2742 dev_out = net->loopback_dev; in ip_route_output_key_hash_rcu()
2749 err = fib_lookup(net, fl4, res, 0); in ip_route_output_key_hash_rcu()
2793 net->loopback_dev; in ip_route_output_key_hash_rcu()
2805 fib_select_path(net, res, fl4, skb); in ip_route_output_key_hash_rcu()
2827 struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig) in ipv4_blackhole_route() argument
2840 new->dev = net->loopback_dev; in ipv4_blackhole_route()
2848 rt->rt_genid = rt_genid_ipv4(net); in ipv4_blackhole_route()
2864 struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, in ip_route_output_flow() argument
2867 struct rtable *rt = __ip_route_output_key(net, flp4); in ip_route_output_flow()
2874 rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, in ip_route_output_flow()
2885 struct net *net, __be32 *saddr, in ip_route_output_tunnel() argument
2912 rt = ip_route_output_key(net, &fl4); in ip_route_output_tunnel()
2932 static int rt_fill_info(struct net *net, __be32 dst, __be32 src, in rt_fill_info() argument
3039 IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { in rt_fill_info()
3040 int err = ipmr_get_route(net, skb, in rt_fill_info()
3069 static int fnhe_dump_bucket(struct net *net, struct sk_buff *skb, in fnhe_dump_bucket() argument
3100 err = rt_fill_info(net, fnhe->fnhe_daddr, 0, rt, in fnhe_dump_bucket()
3118 struct net *net = sock_net(cb->skb->sk); in fib_dump_info_fnhe() local
3119 int nhsel, genid = fnhe_genid(net); in fib_dump_info_fnhe()
3133 err = fnhe_dump_bucket(net, skb, cb, table_id, bucket, in fib_dump_info_fnhe()
3277 struct net *net = sock_net(in_skb->sk); in inet_rtm_getroute() local
3342 dev = dev_get_by_index_rcu(net, iif); in inet_rtm_getroute()
3360 skb->dev = net->loopback_dev; in inet_rtm_getroute()
3361 rt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb); in inet_rtm_getroute()
3424 err = rt_fill_info(net, dst, src, rt, table_id, res.dscp, &fl4, in inet_rtm_getroute()
3433 err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); in inet_rtm_getroute()
3457 struct net *net = (struct net *)__ctl->extra1; in ipv4_sysctl_rtcache_flush() local
3460 rt_cache_flush(net); in ipv4_sysctl_rtcache_flush()
3461 fnhe_genid_bump(net); in ipv4_sysctl_rtcache_flush()
3592 static __net_init int sysctl_route_net_init(struct net *net) in sysctl_route_net_init() argument
3598 if (!net_eq(net, &init_net)) { in sysctl_route_net_init()
3606 if (net->user_ns != &init_user_ns) { in sysctl_route_net_init()
3617 tbl[i].data += (void *)net - (void *)&init_net; in sysctl_route_net_init()
3619 tbl[0].extra1 = net; in sysctl_route_net_init()
3621 net->ipv4.route_hdr = register_net_sysctl_sz(net, "net/ipv4/route", in sysctl_route_net_init()
3623 if (!net->ipv4.route_hdr) in sysctl_route_net_init()
3634 static __net_exit void sysctl_route_net_exit(struct net *net) in sysctl_route_net_exit() argument
3638 tbl = net->ipv4.route_hdr->ctl_table_arg; in sysctl_route_net_exit()
3639 unregister_net_sysctl_table(net->ipv4.route_hdr); in sysctl_route_net_exit()
3650 static __net_init int netns_ip_rt_init(struct net *net) in netns_ip_rt_init() argument
3653 net->ipv4.ip_rt_min_pmtu = DEFAULT_MIN_PMTU; in netns_ip_rt_init()
3654 net->ipv4.ip_rt_mtu_expires = DEFAULT_MTU_EXPIRES; in netns_ip_rt_init()
3655 net->ipv4.ip_rt_min_advmss = DEFAULT_MIN_ADVMSS; in netns_ip_rt_init()
3663 static __net_init int rt_genid_init(struct net *net) in rt_genid_init() argument
3665 atomic_set(&net->ipv4.rt_genid, 0); in rt_genid_init()
3666 atomic_set(&net->fnhe_genid, 0); in rt_genid_init()
3667 atomic_set(&net->ipv4.dev_addr_genid, get_random_u32()); in rt_genid_init()
3675 static int __net_init ipv4_inetpeer_init(struct net *net) in ipv4_inetpeer_init() argument
3682 net->ipv4.peers = bp; in ipv4_inetpeer_init()
3686 static void __net_exit ipv4_inetpeer_exit(struct net *net) in ipv4_inetpeer_exit() argument
3688 struct inet_peer_base *bp = net->ipv4.peers; in ipv4_inetpeer_exit()
3690 net->ipv4.peers = NULL; in ipv4_inetpeer_exit()