Skip to content

Commit

Permalink
igmp: Namespaceify igmp_max_msf sysctl knob
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Borisov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
KernelKyupCom authored and davem330 committed Feb 11, 2016
1 parent 815c527 commit 166b6b2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion include/linux/igmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static inline struct igmpv3_query *
}

extern int sysctl_igmp_llm_reports;
extern int sysctl_igmp_max_msf;
extern int sysctl_igmp_qrv;

struct ip_sf_socklist {
Expand Down
1 change: 1 addition & 0 deletions include/net/netns/ipv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct netns_ipv4 {
unsigned int sysctl_tcp_notsent_lowat;

int sysctl_igmp_max_memberships;
int sysctl_igmp_max_msf;

struct ping_group_range ping_group_range;

Expand Down
5 changes: 1 addition & 4 deletions net/ipv4/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
#include <linux/seq_file.h>
#endif

#define IP_MAX_MSF 10

/* IGMP reports for link-local multicast groups are enabled by default */
int sysctl_igmp_llm_reports __read_mostly = 1;

Expand Down Expand Up @@ -1726,7 +1724,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_msf __read_mostly = IP_MAX_MSF;
#ifdef CONFIG_IP_MULTICAST
int sysctl_igmp_qrv __read_mostly = IGMP_QUERY_ROBUSTNESS_VARIABLE;
#endif
Expand Down Expand Up @@ -2244,7 +2241,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
}
/* else, add a new source to the filter */

if (psl && psl->sl_count >= sysctl_igmp_max_msf) {
if (psl && psl->sl_count >= net->ipv4.sysctl_igmp_max_msf) {
err = -ENOBUFS;
goto done;
}
Expand Down
5 changes: 3 additions & 2 deletions net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
int optname, char __user *optval, unsigned int optlen)
{
struct inet_sock *inet = inet_sk(sk);
struct net *net = sock_net(sk);
int val = 0, err;
bool needs_rtnl = setsockopt_needs_rtnl(optname);

Expand Down Expand Up @@ -910,7 +911,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
}
/* numsrc >= (1G-4) overflow in 32 bits */
if (msf->imsf_numsrc >= 0x3ffffffcU ||
msf->imsf_numsrc > sysctl_igmp_max_msf) {
msf->imsf_numsrc > net->ipv4.sysctl_igmp_max_msf) {
kfree(msf);
err = -ENOBUFS;
break;
Expand Down Expand Up @@ -1065,7 +1066,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,

/* numsrc >= (4G-140)/128 overflow in 32 bits */
if (gsf->gf_numsrc >= 0x1ffffff ||
gsf->gf_numsrc > sysctl_igmp_max_msf) {
gsf->gf_numsrc > net->ipv4.sysctl_igmp_max_msf) {
err = -ENOBUFS;
goto mc_msf_out;
}
Expand Down
14 changes: 7 additions & 7 deletions net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,6 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec
},
{
.procname = "igmp_max_msf",
.data = &sysctl_igmp_max_msf,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
#ifdef CONFIG_IP_MULTICAST
{
.procname = "igmp_qrv",
Expand Down Expand Up @@ -871,6 +864,13 @@ static struct ctl_table ipv4_net_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec
},
{
.procname = "igmp_max_msf",
.data = &init_net.ipv4.sysctl_igmp_max_msf,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
{
.procname = "tcp_keepalive_time",
.data = &init_net.ipv4.sysctl_tcp_keepalive_time,
Expand Down
1 change: 1 addition & 0 deletions net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,7 @@ static int __net_init tcp_sk_init(struct net *net)
net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;

net->ipv4.sysctl_igmp_max_memberships = 20;
net->ipv4.sysctl_igmp_max_msf = 10;

return 0;
fail:
Expand Down

0 comments on commit 166b6b2

Please sign in to comment.