aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/reassembly.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-22 09:08:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:37 -0500
commite4a2d5c2bccd5bd29de5ae4f14ff4448fac9cfc8 (patch)
treee6ae6835ec20401b1a59de0c8c0f8519fba3a4b4 /net/ipv6/reassembly.c
parent6ddc082223ef0f73717b4133fa7e648842bbfd02 (diff)
[NETNS][FRAGS]: Duplicate sysctl tables for new namespaces.
Each namespace has to have own tables to tune their different parameters, so duplicate the tables and register them. All the tables in sub-namespaces are temporarily made read-only. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r--net/ipv6/reassembly.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 241b2cc49bf5..0300dcbf1a75 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -670,17 +670,52 @@ static struct ctl_table ip6_frags_ctl_table[] = {
670 670
671static int ip6_frags_sysctl_register(struct net *net) 671static int ip6_frags_sysctl_register(struct net *net)
672{ 672{
673 struct ctl_table *table;
673 struct ctl_table_header *hdr; 674 struct ctl_table_header *hdr;
674 675
675 hdr = register_net_sysctl_table(net, net_ipv6_ctl_path, 676 table = ip6_frags_ctl_table;
676 ip6_frags_ctl_table); 677 if (net != &init_net) {
677 return hdr == NULL ? -ENOMEM : 0; 678 table = kmemdup(table, sizeof(ip6_frags_ctl_table), GFP_KERNEL);
679 if (table == NULL)
680 goto err_alloc;
681
682 table[0].mode &= ~0222;
683 table[1].mode &= ~0222;
684 table[2].mode &= ~0222;
685 table[3].mode &= ~0222;
686 }
687
688 hdr = register_net_sysctl_table(net, net_ipv6_ctl_path, table);
689 if (hdr == NULL)
690 goto err_reg;
691
692 net->ipv6.sysctl.frags_hdr = hdr;
693 return 0;
694
695err_reg:
696 if (net != &init_net)
697 kfree(table);
698err_alloc:
699 return -ENOMEM;
700}
701
702static void ip6_frags_sysctl_unregister(struct net *net)
703{
704 struct ctl_table *table;
705
706 table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
707 unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
708 kfree(table);
678} 709}
679#else 710#else
680static inline int ip6_frags_sysctl_register(struct net *net) 711static inline int ip6_frags_sysctl_register(struct net *net)
681{ 712{
682 return 0; 713 return 0;
683} 714}
715
716static inline void ip6_frags_sysctl_unregister(struct net *net)
717{
718}
684#endif 719#endif
685 720
686static int ipv6_frags_init_net(struct net *net) 721static int ipv6_frags_init_net(struct net *net)