igmp: Namespaceify igmp_max_memberships sysctl knob
authorNikolay Borisov <kernel@kyup.com>
Mon, 8 Feb 2016 21:29:21 +0000 (23:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Feb 2016 14:59:22 +0000 (09:59 -0500)
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/igmp.h
include/net/netns/ipv4.h
net/ipv4/igmp.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_ipv4.c

index 9c9de11549a73047318ffc688e621bbea09f71c9..57d6d06ce0b36039acda8dca6991de36456f4a2a 100644 (file)
@@ -38,7 +38,6 @@ static inline struct igmpv3_query *
 }
 
 extern int sysctl_igmp_llm_reports;
-extern int sysctl_igmp_max_memberships;
 extern int sysctl_igmp_max_msf;
 extern int sysctl_igmp_qrv;
 
index 4d6ec3f6fafe0d9b44b0383808d06f25e8e599db..759cf624eec236c5989635d238be6edda7e100ef 100644 (file)
@@ -108,6 +108,8 @@ struct netns_ipv4 {
        int sysctl_tcp_fin_timeout;
        unsigned int sysctl_tcp_notsent_lowat;
 
+       int sysctl_igmp_max_memberships;
+
        struct ping_group_range ping_group_range;
 
        atomic_t dev_addr_genid;
index 05e4cba14162f3583ec588657af7e8b68546b111..5b86257c9d6bb012061f54e59f378da62e14e06e 100644 (file)
 #include <linux/seq_file.h>
 #endif
 
-#define IP_MAX_MEMBERSHIPS     20
 #define IP_MAX_MSF             10
 
 /* IGMP reports for link-local multicast groups are enabled by default */
@@ -1727,7 +1726,6 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
 /*
  *     Join a socket to a group
  */
-int sysctl_igmp_max_memberships __read_mostly = IP_MAX_MEMBERSHIPS;
 int sysctl_igmp_max_msf __read_mostly = IP_MAX_MSF;
 #ifdef CONFIG_IP_MULTICAST
 int sysctl_igmp_qrv __read_mostly = IGMP_QUERY_ROBUSTNESS_VARIABLE;
@@ -2074,7 +2072,7 @@ int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr)
                count++;
        }
        err = -ENOBUFS;
-       if (count >= sysctl_igmp_max_memberships)
+       if (count >= net->ipv4.sysctl_igmp_max_memberships)
                goto done;
        iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL);
        if (!iml)
index 44bb59824267c74f3aa2aa7067c1d8a6233f1b87..6ea3dbb96db47e95617283e0e5c9ef3c6d6a28b2 100644 (file)
@@ -367,13 +367,6 @@ static struct ctl_table ipv4_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
-       {
-               .procname       = "igmp_max_memberships",
-               .data           = &sysctl_igmp_max_memberships,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec
-       },
        {
                .procname       = "igmp_max_msf",
                .data           = &sysctl_igmp_max_msf,
@@ -871,6 +864,13 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
+       {
+               .procname       = "igmp_max_memberships",
+               .data           = &init_net.ipv4.sysctl_igmp_max_memberships,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec
+       },
        {
                .procname       = "tcp_keepalive_time",
                .data           = &init_net.ipv4.sysctl_tcp_keepalive_time,
index 3f872a6bc27449f181089d53b11bed84dd96f036..4b203789900b3016f68ab900e0bfb3f9e7a6b9dc 100644 (file)
@@ -2399,6 +2399,8 @@ static int __net_init tcp_sk_init(struct net *net)
        net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
        net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
 
+       net->ipv4.sysctl_igmp_max_memberships = 20;
+
        return 0;
 fail:
        tcp_sk_exit(net);