]> git.baikalelectronics.ru Git - kernel.git/commitdiff
inet: make no_pmtu_disc per namespace and kill ipv4_config
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Sat, 14 Dec 2013 04:13:38 +0000 (05:13 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Dec 2013 21:58:20 +0000 (16:58 -0500)
The other field in ipv4_config, log_martians, was converted to a
per-interface setting, so we can just remove the whole structure.

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
include/net/netns/ipv4.h
net/ipv4/af_inet.c
net/ipv4/icmp.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/xfrm4_state.c
net/ipv6/af_inet6.c

index 5a25f36fe3a7cb50a388e309df9b5905f013b6b4..535664477c4a0d339f6ba92051aa3bd9cd1f7dd5 100644 (file)
@@ -177,12 +177,6 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
                           __be32 saddr, const struct ip_reply_arg *arg,
                           unsigned int len);
 
-struct ipv4_config {
-       int     log_martians;
-       int     no_pmtu_disc;
-};
-
-extern struct ipv4_config ipv4_config;
 #define IP_INC_STATS(net, field)       SNMP_INC_STATS64((net)->mib.ip_statistics, field)
 #define IP_INC_STATS_BH(net, field)    SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
 #define IP_ADD_STATS(net, field, val)  SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
index ee520cba2ec2f9f1ce1f011b985524946085fb60..929a668e91a9a8b42acba7a1148cdf21c872f0e8 100644 (file)
@@ -69,6 +69,7 @@ struct netns_ipv4 {
        struct local_ports sysctl_local_ports;
 
        int sysctl_tcp_ecn;
+       int sysctl_ip_no_pmtu_disc;
 
        kgid_t sysctl_ping_group_range[2];
 
index ef4f9df6d698984b9ef4872afde9451bc014fc0a..6b1193e63911203e95dfb1ab891bace2b65d99c4 100644 (file)
 static struct list_head inetsw[SOCK_MAX];
 static DEFINE_SPINLOCK(inetsw_lock);
 
-struct ipv4_config ipv4_config;
-EXPORT_SYMBOL(ipv4_config);
-
 /* New destruction routine */
 
 void inet_sock_destruct(struct sock *sk)
@@ -342,7 +339,7 @@ lookup_protocol:
                        inet->hdrincl = 1;
        }
 
-       if (ipv4_config.no_pmtu_disc)
+       if (net->ipv4.sysctl_ip_no_pmtu_disc)
                inet->pmtudisc = IP_PMTUDISC_DONT;
        else
                inet->pmtudisc = IP_PMTUDISC_WANT;
index 5c0e8bc6e5ba275d2469336533b5848de94ae6c1..1a4ee84ca3f3d9690e6860d031f67056de7a99d7 100644 (file)
@@ -705,7 +705,7 @@ static void icmp_unreach(struct sk_buff *skb)
                case ICMP_PORT_UNREACH:
                        break;
                case ICMP_FRAG_NEEDED:
-                       if (ipv4_config.no_pmtu_disc) {
+                       if (net->ipv4.sysctl_ip_no_pmtu_disc) {
                                LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"),
                                               &iph->daddr);
                        } else {
index 38c8ec90ff680001656f9ab53ee838b85827f9ea..d7b63a61445427e56654b6ee340f2904695f1d73 100644 (file)
@@ -285,13 +285,6 @@ static struct ctl_table ipv4_table[] = {
                .extra1         = &ip_ttl_min,
                .extra2         = &ip_ttl_max,
        },
-       {
-               .procname       = "ip_no_pmtu_disc",
-               .data           = &ipv4_config.no_pmtu_disc,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec
-       },
        {
                .procname       = "ip_nonlocal_bind",
                .data           = &sysctl_ip_nonlocal_bind,
@@ -831,6 +824,13 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = ipv4_local_port_range,
        },
+       {
+               .procname       = "ip_no_pmtu_disc",
+               .data           = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec
+       },
        { }
 };
 
index 0b2a0641526a74118cf46336a185e62b9621fc95..542074c00c78e34ede22013e568623fb0311b18d 100644 (file)
@@ -16,7 +16,7 @@
 
 static int xfrm4_init_flags(struct xfrm_state *x)
 {
-       if (ipv4_config.no_pmtu_disc)
+       if (xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc)
                x->props.flags |= XFRM_STATE_NOPMTUDISC;
        return 0;
 }
index 027615ac1b4eb3e468835efe0fc7109c8997c304..5e76dfa765c4c43c5f6367dfe4f9451adad3bdcd 100644 (file)
@@ -213,7 +213,7 @@ lookup_protocol:
        inet->mc_list   = NULL;
        inet->rcv_tos   = 0;
 
-       if (ipv4_config.no_pmtu_disc)
+       if (net->ipv4.sysctl_ip_no_pmtu_disc)
                inet->pmtudisc = IP_PMTUDISC_DONT;
        else
                inet->pmtudisc = IP_PMTUDISC_WANT;