提交 8fc02781 编写于 作者: G Gao feng 提交者: Pablo Neira Ayuso

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: NGao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 a9082b45
...@@ -333,22 +333,31 @@ static struct ctl_table icmpv6_sysctl_table[] = { ...@@ -333,22 +333,31 @@ static struct ctl_table icmpv6_sysctl_table[] = {
}; };
#endif /* CONFIG_SYSCTL */ #endif /* CONFIG_SYSCTL */
static int icmpv6_init_net(struct net *net, u_int16_t proto) static int icmpv6_kmemdup_sysctl_table(struct nf_proto_net *pn,
struct nf_icmp_net *in)
{ {
struct nf_icmp_net *in = icmpv6_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)in;
in->timeout = nf_ct_icmpv6_timeout;
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
pn->ctl_table = kmemdup(icmpv6_sysctl_table, pn->ctl_table = kmemdup(icmpv6_sysctl_table,
sizeof(icmpv6_sysctl_table), sizeof(icmpv6_sysctl_table),
GFP_KERNEL); GFP_KERNEL);
if (!pn->ctl_table) if (!pn->ctl_table)
return -ENOMEM; return -ENOMEM;
pn->ctl_table[0].data = &in->timeout; pn->ctl_table[0].data = &in->timeout;
#endif #endif
return 0; return 0;
} }
static int icmpv6_init_net(struct net *net, u_int16_t proto)
{
struct nf_icmp_net *in = icmpv6_pernet(net);
struct nf_proto_net *pn = &in->pn;
in->timeout = nf_ct_icmpv6_timeout;
return icmpv6_kmemdup_sysctl_table(pn, in);
}
struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
{ {
.l3proto = PF_INET6, .l3proto = PF_INET6,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册