Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: namespacify ip_early_demux sysctl knob

Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Nikolay Borisov and committed by
David S. Miller
e21145a9 287b7f38

+11 -15
-3
include/net/ip.h
··· 245 245 extern int inet_peer_minttl; 246 246 extern int inet_peer_maxttl; 247 247 248 - /* From ip_input.c */ 249 - extern int sysctl_ip_early_demux; 250 - 251 248 void ipfrag_init(void); 252 249 253 250 void ip_static_sysctl_init(void);
+1
include/net/netns/ipv4.h
··· 86 86 int sysctl_ip_nonlocal_bind; 87 87 /* Shall we try to damage output packets if routing dev changes? */ 88 88 int sysctl_ip_dynaddr; 89 + int sysctl_ip_early_demux; 89 90 90 91 int sysctl_fwmark_reflect; 91 92 int sysctl_tcp_fwmark_accept;
+1 -4
net/ipv4/ip_input.c
··· 308 308 return true; 309 309 } 310 310 311 - int sysctl_ip_early_demux __read_mostly = 1; 312 - EXPORT_SYMBOL(sysctl_ip_early_demux); 313 - 314 311 static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) 315 312 { 316 313 const struct iphdr *iph = ip_hdr(skb); 317 314 struct rtable *rt; 318 315 319 - if (sysctl_ip_early_demux && 316 + if (net->ipv4.sysctl_ip_early_demux && 320 317 !skb_dst(skb) && 321 318 !skb->sk && 322 319 !ip_is_fragment(iph)) {
+8 -7
net/ipv4/sysctl_net_ipv4.c
··· 297 297 .proc_handler = proc_dointvec 298 298 }, 299 299 { 300 - .procname = "ip_early_demux", 301 - .data = &sysctl_ip_early_demux, 302 - .maxlen = sizeof(int), 303 - .mode = 0644, 304 - .proc_handler = proc_dointvec 305 - }, 306 - { 307 300 .procname = "tcp_fastopen", 308 301 .data = &sysctl_tcp_fastopen, 309 302 .maxlen = sizeof(int), ··· 737 744 .proc_handler = proc_dointvec 738 745 }, 739 746 { 747 + .procname = "ip_early_demux", 748 + .data = &init_net.ipv4.sysctl_ip_early_demux, 749 + .maxlen = sizeof(int), 750 + .mode = 0644, 751 + .proc_handler = proc_dointvec 752 + }, 753 + { 740 754 .procname = "ip_default_ttl", 741 755 .data = &init_net.ipv4.sysctl_ip_default_ttl, 742 756 .maxlen = sizeof(int), ··· 990 990 991 991 net->ipv4.sysctl_ip_default_ttl = IPDEFTTL; 992 992 net->ipv4.sysctl_ip_dynaddr = 0; 993 + net->ipv4.sysctl_ip_early_demux = 1; 993 994 994 995 return 0; 995 996
+1 -1
net/ipv6/ip6_input.c
··· 49 49 50 50 int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) 51 51 { 52 - if (sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) { 52 + if (net->ipv4.sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) { 53 53 const struct inet6_protocol *ipprot; 54 54 55 55 ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);