|
@@ -436,13 +436,6 @@ static struct ctl_table ipv4_table[] = {
|
|
|
.mode = 0644,
|
|
|
.proc_handler = proc_dointvec
|
|
|
},
|
|
|
- {
|
|
|
- .procname = "ip_local_reserved_ports",
|
|
|
- .data = NULL, /* initialized in sysctl_ipv4_init */
|
|
|
- .maxlen = 65536,
|
|
|
- .mode = 0644,
|
|
|
- .proc_handler = proc_do_large_bitmap,
|
|
|
- },
|
|
|
{
|
|
|
.procname = "igmp_max_memberships",
|
|
|
.data = &sysctl_igmp_max_memberships,
|
|
@@ -824,6 +817,13 @@ static struct ctl_table ipv4_net_table[] = {
|
|
|
.mode = 0644,
|
|
|
.proc_handler = ipv4_local_port_range,
|
|
|
},
|
|
|
+ {
|
|
|
+ .procname = "ip_local_reserved_ports",
|
|
|
+ .data = &init_net.ipv4.sysctl_local_reserved_ports,
|
|
|
+ .maxlen = 65536,
|
|
|
+ .mode = 0644,
|
|
|
+ .proc_handler = proc_do_large_bitmap,
|
|
|
+ },
|
|
|
{
|
|
|
.procname = "ip_no_pmtu_disc",
|
|
|
.data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
|
|
@@ -876,8 +876,14 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
|
|
|
if (net->ipv4.ipv4_hdr == NULL)
|
|
|
goto err_reg;
|
|
|
|
|
|
+ net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL);
|
|
|
+ if (!net->ipv4.sysctl_local_reserved_ports)
|
|
|
+ goto err_ports;
|
|
|
+
|
|
|
return 0;
|
|
|
|
|
|
+err_ports:
|
|
|
+ unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
|
|
|
err_reg:
|
|
|
if (!net_eq(net, &init_net))
|
|
|
kfree(table);
|
|
@@ -889,6 +895,7 @@ static __net_exit void ipv4_sysctl_exit_net(struct net *net)
|
|
|
{
|
|
|
struct ctl_table *table;
|
|
|
|
|
|
+ kfree(net->ipv4.sysctl_local_reserved_ports);
|
|
|
table = net->ipv4.ipv4_hdr->ctl_table_arg;
|
|
|
unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
|
|
|
kfree(table);
|
|
@@ -902,16 +909,6 @@ static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
|
|
|
static __init int sysctl_ipv4_init(void)
|
|
|
{
|
|
|
struct ctl_table_header *hdr;
|
|
|
- struct ctl_table *i;
|
|
|
-
|
|
|
- for (i = ipv4_table; i->procname; i++) {
|
|
|
- if (strcmp(i->procname, "ip_local_reserved_ports") == 0) {
|
|
|
- i->data = sysctl_local_reserved_ports;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!i->procname)
|
|
|
- return -EINVAL;
|
|
|
|
|
|
hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table);
|
|
|
if (hdr == NULL)
|