]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ipv4: namespacify ip_early_demux sysctl knob
authorNikolay Borisov <kernel@kyup.com>
Mon, 15 Feb 2016 10:11:30 +0000 (12:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Feb 2016 01:42:54 +0000 (20:42 -0500)
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
include/net/netns/ipv4.h
net/ipv4/ip_input.c
net/ipv4/sysctl_net_ipv4.c
net/ipv6/ip6_input.c

index e3fb25d764218ee5c8e95418b7426c91424f0da5..cbb134b2f0e4ff2ae81aa6e45a351a2246605786 100644 (file)
@@ -245,9 +245,6 @@ extern int inet_peer_threshold;
 extern int inet_peer_minttl;
 extern int inet_peer_maxttl;
 
-/* From ip_input.c */
-extern int sysctl_ip_early_demux;
-
 void ipfrag_init(void);
 
 void ip_static_sysctl_init(void);
index b7e3fb2587da64c77fbd8caa3ec7755a1b968747..a69cde3ce4608879ee3e4056d22ce512eb0c3ba5 100644 (file)
@@ -86,6 +86,7 @@ struct netns_ipv4 {
        int sysctl_ip_nonlocal_bind;
        /* Shall we try to damage output packets if routing dev changes? */
        int sysctl_ip_dynaddr;
+       int sysctl_ip_early_demux;
 
        int sysctl_fwmark_reflect;
        int sysctl_tcp_fwmark_accept;
index 852002f64c68455474123f5bb66abb0bd5583e41..e3d782746d9db79b0ad03d1059316bebb73207a4 100644 (file)
@@ -308,15 +308,12 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
        return true;
 }
 
-int sysctl_ip_early_demux __read_mostly = 1;
-EXPORT_SYMBOL(sysctl_ip_early_demux);
-
 static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
        const struct iphdr *iph = ip_hdr(skb);
        struct rtable *rt;
 
-       if (sysctl_ip_early_demux &&
+       if (net->ipv4.sysctl_ip_early_demux &&
            !skb_dst(skb) &&
            !skb->sk &&
            !ip_is_fragment(iph)) {
index 04ac5b763385144b392ba30e868ce1e04b9e7867..1e1fe6086dd912e5071524053581afa79578061b 100644 (file)
@@ -296,13 +296,6 @@ static struct ctl_table ipv4_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
-       {
-               .procname       = "ip_early_demux",
-               .data           = &sysctl_ip_early_demux,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec
-       },
        {
                .procname       = "tcp_fastopen",
                .data           = &sysctl_tcp_fastopen,
@@ -743,6 +736,13 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
+       {
+               .procname       = "ip_early_demux",
+               .data           = &init_net.ipv4.sysctl_ip_early_demux,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec
+       },
        {
                .procname       = "ip_default_ttl",
                .data           = &init_net.ipv4.sysctl_ip_default_ttl,
@@ -990,6 +990,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
 
        net->ipv4.sysctl_ip_default_ttl = IPDEFTTL;
        net->ipv4.sysctl_ip_dynaddr = 0;
+       net->ipv4.sysctl_ip_early_demux = 1;
 
        return 0;
 
index 31ac3c56da4ba16f806d4ef234de7599f25a265c..c05c425c23890b4b5ce077d5ca835a7e644ab881 100644 (file)
@@ -49,7 +49,7 @@
 
 int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
-       if (sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) {
+       if (net->ipv4.sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) {
                const struct inet6_protocol *ipprot;
 
                ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);