ipv4: move local_port_range out of CONFIG_SYSCTL
When CONFIG_SYSCTL is not set, ip_local_port_range should still work, just that no one can change it. Therefore we should move it out of sysctl_inet.c. Also, rename it to ->ip_local_ports instead. Cc: David S. Miller <davem@davemloft.net> Cc: Francois Romieu <romieu@fr.zoreil.com> Reported-by: Stefan de Konink <stefan@konink.de> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
23a456f053
commit
c9d8f1a642
@@ -1650,6 +1650,31 @@ static int __init init_ipv4_mibs(void)
|
||||
return register_pernet_subsys(&ipv4_mib_ops);
|
||||
}
|
||||
|
||||
static __net_init int inet_init_net(struct net *net)
|
||||
{
|
||||
/*
|
||||
* Set defaults for local port range
|
||||
*/
|
||||
seqlock_init(&net->ipv4.ip_local_ports.lock);
|
||||
net->ipv4.ip_local_ports.range[0] = 32768;
|
||||
net->ipv4.ip_local_ports.range[1] = 61000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __net_exit void inet_exit_net(struct net *net)
|
||||
{
|
||||
}
|
||||
|
||||
static __net_initdata struct pernet_operations af_inet_ops = {
|
||||
.init = inet_init_net,
|
||||
.exit = inet_exit_net,
|
||||
};
|
||||
|
||||
static int __init init_inet_pernet_ops(void)
|
||||
{
|
||||
return register_pernet_subsys(&af_inet_ops);
|
||||
}
|
||||
|
||||
static int ipv4_proc_init(void);
|
||||
|
||||
/*
|
||||
@@ -1794,6 +1819,9 @@ static int __init inet_init(void)
|
||||
if (ip_mr_init())
|
||||
pr_crit("%s: Cannot init ipv4 mroute\n", __func__);
|
||||
#endif
|
||||
|
||||
if (init_inet_pernet_ops())
|
||||
pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
|
||||
/*
|
||||
* Initialise per-cpu ipv4 mibs
|
||||
*/
|
||||
|
Reference in New Issue
Block a user