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

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>

authored by

Hannes Frederic Sowa and committed by
David S. Miller
974eda11 143c9054

+12 -20
-6
include/net/ip.h
··· 177 177 __be32 saddr, const struct ip_reply_arg *arg, 178 178 unsigned int len); 179 179 180 - struct ipv4_config { 181 - int log_martians; 182 - int no_pmtu_disc; 183 - }; 184 - 185 - extern struct ipv4_config ipv4_config; 186 180 #define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) 187 181 #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field) 188 182 #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
+1
include/net/netns/ipv4.h
··· 69 69 struct local_ports sysctl_local_ports; 70 70 71 71 int sysctl_tcp_ecn; 72 + int sysctl_ip_no_pmtu_disc; 72 73 73 74 kgid_t sysctl_ping_group_range[2]; 74 75
+1 -4
net/ipv4/af_inet.c
··· 126 126 static struct list_head inetsw[SOCK_MAX]; 127 127 static DEFINE_SPINLOCK(inetsw_lock); 128 128 129 - struct ipv4_config ipv4_config; 130 - EXPORT_SYMBOL(ipv4_config); 131 - 132 129 /* New destruction routine */ 133 130 134 131 void inet_sock_destruct(struct sock *sk) ··· 339 342 inet->hdrincl = 1; 340 343 } 341 344 342 - if (ipv4_config.no_pmtu_disc) 345 + if (net->ipv4.sysctl_ip_no_pmtu_disc) 343 346 inet->pmtudisc = IP_PMTUDISC_DONT; 344 347 else 345 348 inet->pmtudisc = IP_PMTUDISC_WANT;
+1 -1
net/ipv4/icmp.c
··· 705 705 case ICMP_PORT_UNREACH: 706 706 break; 707 707 case ICMP_FRAG_NEEDED: 708 - if (ipv4_config.no_pmtu_disc) { 708 + if (net->ipv4.sysctl_ip_no_pmtu_disc) { 709 709 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"), 710 710 &iph->daddr); 711 711 } else {
+7 -7
net/ipv4/sysctl_net_ipv4.c
··· 286 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 289 .procname = "ip_nonlocal_bind", 297 290 .data = &sysctl_ip_nonlocal_bind, 298 291 .maxlen = sizeof(int), ··· 823 830 .data = &init_net.ipv4.sysctl_local_ports.range, 824 831 .mode = 0644, 825 832 .proc_handler = ipv4_local_port_range, 833 + }, 834 + { 835 + .procname = "ip_no_pmtu_disc", 836 + .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, 837 + .maxlen = sizeof(int), 838 + .mode = 0644, 839 + .proc_handler = proc_dointvec 826 840 }, 827 841 { } 828 842 };
+1 -1
net/ipv4/xfrm4_state.c
··· 16 16 17 17 static 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 20 x->props.flags |= XFRM_STATE_NOPMTUDISC; 21 21 return 0; 22 22 }
+1 -1
net/ipv6/af_inet6.c
··· 213 213 inet->mc_list = NULL; 214 214 inet->rcv_tos = 0; 215 215 216 - if (ipv4_config.no_pmtu_disc) 216 + if (net->ipv4.sysctl_ip_no_pmtu_disc) 217 217 inet->pmtudisc = IP_PMTUDISC_DONT; 218 218 else 219 219 inet->pmtudisc = IP_PMTUDISC_WANT;