aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-12-13 23:13:38 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 16:58:20 -0500
commit974eda11c54290a1be8f8b155edae7d791e5ce57 (patch)
treee8956b7e45c8f2e033567d788757e086f76230a0
parent143c9054949436cb05e468439dc5e46231f33d09 (diff)
inet: make no_pmtu_disc per namespace and kill ipv4_config
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>
-rw-r--r--include/net/ip.h6
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--net/ipv4/af_inet.c5
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c14
-rw-r--r--net/ipv4/xfrm4_state.c2
-rw-r--r--net/ipv6/af_inet6.c2
7 files changed, 12 insertions, 20 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 5a25f36fe3a7..535664477c4a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -177,12 +177,6 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
177 __be32 saddr, const struct ip_reply_arg *arg, 177 __be32 saddr, const struct ip_reply_arg *arg,
178 unsigned int len); 178 unsigned int len);
179 179
180struct ipv4_config {
181 int log_martians;
182 int no_pmtu_disc;
183};
184
185extern struct ipv4_config ipv4_config;
186#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) 180#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
187#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field) 181#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
188#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val) 182#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ee520cba2ec2..929a668e91a9 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -69,6 +69,7 @@ struct netns_ipv4 {
69 struct local_ports sysctl_local_ports; 69 struct local_ports sysctl_local_ports;
70 70
71 int sysctl_tcp_ecn; 71 int sysctl_tcp_ecn;
72 int sysctl_ip_no_pmtu_disc;
72 73
73 kgid_t sysctl_ping_group_range[2]; 74 kgid_t sysctl_ping_group_range[2];
74 75
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index ef4f9df6d698..6b1193e63911 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -126,9 +126,6 @@
126static struct list_head inetsw[SOCK_MAX]; 126static struct list_head inetsw[SOCK_MAX];
127static DEFINE_SPINLOCK(inetsw_lock); 127static DEFINE_SPINLOCK(inetsw_lock);
128 128
129struct ipv4_config ipv4_config;
130EXPORT_SYMBOL(ipv4_config);
131
132/* New destruction routine */ 129/* New destruction routine */
133 130
134void inet_sock_destruct(struct sock *sk) 131void inet_sock_destruct(struct sock *sk)
@@ -342,7 +339,7 @@ lookup_protocol:
342 inet->hdrincl = 1; 339 inet->hdrincl = 1;
343 } 340 }
344 341
345 if (ipv4_config.no_pmtu_disc) 342 if (net->ipv4.sysctl_ip_no_pmtu_disc)
346 inet->pmtudisc = IP_PMTUDISC_DONT; 343 inet->pmtudisc = IP_PMTUDISC_DONT;
347 else 344 else
348 inet->pmtudisc = IP_PMTUDISC_WANT; 345 inet->pmtudisc = IP_PMTUDISC_WANT;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 5c0e8bc6e5ba..1a4ee84ca3f3 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -705,7 +705,7 @@ static void icmp_unreach(struct sk_buff *skb)
705 case ICMP_PORT_UNREACH: 705 case ICMP_PORT_UNREACH:
706 break; 706 break;
707 case ICMP_FRAG_NEEDED: 707 case ICMP_FRAG_NEEDED:
708 if (ipv4_config.no_pmtu_disc) { 708 if (net->ipv4.sysctl_ip_no_pmtu_disc) {
709 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"), 709 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"),
710 &iph->daddr); 710 &iph->daddr);
711 } else { 711 } else {
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 38c8ec90ff68..d7b63a614454 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -286,13 +286,6 @@ static struct ctl_table ipv4_table[] = {
286 .extra2 = &ip_ttl_max, 286 .extra2 = &ip_ttl_max,
287 }, 287 },
288 { 288 {
289 .procname = "ip_no_pmtu_disc",
290 .data = &ipv4_config.no_pmtu_disc,
291 .maxlen = sizeof(int),
292 .mode = 0644,
293 .proc_handler = proc_dointvec
294 },
295 {
296 .procname = "ip_nonlocal_bind", 289 .procname = "ip_nonlocal_bind",
297 .data = &sysctl_ip_nonlocal_bind, 290 .data = &sysctl_ip_nonlocal_bind,
298 .maxlen = sizeof(int), 291 .maxlen = sizeof(int),
@@ -831,6 +824,13 @@ static struct ctl_table ipv4_net_table[] = {
831 .mode = 0644, 824 .mode = 0644,
832 .proc_handler = ipv4_local_port_range, 825 .proc_handler = ipv4_local_port_range,
833 }, 826 },
827 {
828 .procname = "ip_no_pmtu_disc",
829 .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
830 .maxlen = sizeof(int),
831 .mode = 0644,
832 .proc_handler = proc_dointvec
833 },
834 { } 834 { }
835}; 835};
836 836
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index 0b2a0641526a..542074c00c78 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -16,7 +16,7 @@
16 16
17static int xfrm4_init_flags(struct xfrm_state *x) 17static int xfrm4_init_flags(struct xfrm_state *x)
18{ 18{
19 if (ipv4_config.no_pmtu_disc) 19 if (xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc)
20 x->props.flags |= XFRM_STATE_NOPMTUDISC; 20 x->props.flags |= XFRM_STATE_NOPMTUDISC;
21 return 0; 21 return 0;
22} 22}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 027615ac1b4e..5e76dfa765c4 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -213,7 +213,7 @@ lookup_protocol:
213 inet->mc_list = NULL; 213 inet->mc_list = NULL;
214 inet->rcv_tos = 0; 214 inet->rcv_tos = 0;
215 215
216 if (ipv4_config.no_pmtu_disc) 216 if (net->ipv4.sysctl_ip_no_pmtu_disc)
217 inet->pmtudisc = IP_PMTUDISC_DONT; 217 inet->pmtudisc = IP_PMTUDISC_DONT;
218 else 218 else
219 inet->pmtudisc = IP_PMTUDISC_WANT; 219 inet->pmtudisc = IP_PMTUDISC_WANT;