aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2012-06-21 00:36:50 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2012-06-27 13:16:31 -0400
commit8fc02781688eda937657193ee28caf4914563d27 (patch)
treed2c9fabfcc925831e3e3fea0cb943fbd64e73ff2
parenta9082b45ad3c7284db974a108e7c1f1af7387d7b (diff)
netfilter: nf_ct_icmpv6: add icmpv6_kmemdup_sysctl_table function
Split sysctl function into smaller chucks to cleanup code and prepare patches to reduce ifdef pollution. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 807ae09df0ca..9fc5cf5f3e8b 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -333,22 +333,31 @@ static struct ctl_table icmpv6_sysctl_table[] = {
333}; 333};
334#endif /* CONFIG_SYSCTL */ 334#endif /* CONFIG_SYSCTL */
335 335
336static int icmpv6_init_net(struct net *net, u_int16_t proto) 336static int icmpv6_kmemdup_sysctl_table(struct nf_proto_net *pn,
337 struct nf_icmp_net *in)
337{ 338{
338 struct nf_icmp_net *in = icmpv6_pernet(net);
339 struct nf_proto_net *pn = (struct nf_proto_net *)in;
340 in->timeout = nf_ct_icmpv6_timeout;
341#ifdef CONFIG_SYSCTL 339#ifdef CONFIG_SYSCTL
342 pn->ctl_table = kmemdup(icmpv6_sysctl_table, 340 pn->ctl_table = kmemdup(icmpv6_sysctl_table,
343 sizeof(icmpv6_sysctl_table), 341 sizeof(icmpv6_sysctl_table),
344 GFP_KERNEL); 342 GFP_KERNEL);
345 if (!pn->ctl_table) 343 if (!pn->ctl_table)
346 return -ENOMEM; 344 return -ENOMEM;
345
347 pn->ctl_table[0].data = &in->timeout; 346 pn->ctl_table[0].data = &in->timeout;
348#endif 347#endif
349 return 0; 348 return 0;
350} 349}
351 350
351static int icmpv6_init_net(struct net *net, u_int16_t proto)
352{
353 struct nf_icmp_net *in = icmpv6_pernet(net);
354 struct nf_proto_net *pn = &in->pn;
355
356 in->timeout = nf_ct_icmpv6_timeout;
357
358 return icmpv6_kmemdup_sysctl_table(pn, in);
359}
360
352struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = 361struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
353{ 362{
354 .l3proto = PF_INET6, 363 .l3proto = PF_INET6,