diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2012-05-28 17:04:15 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-06-07 08:58:40 -0400 |
commit | 7080ba0955438ecd2885c1b73fbd9760b1594a41 (patch) | |
tree | dcb91bea5da6c1cb70bc52acfd3a17db3da259c7 /net/ipv6 | |
parent | 4b626b9c5d35b4f99b073dc5d6457abddcbcf429 (diff) |
netfilter: nf_ct_icmp: add namespace support
This patch adds namespace support for ICMPv6 protocol tracker.
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 3e81904fbbcd..f606355200d8 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -29,6 +29,11 @@ | |||
29 | 29 | ||
30 | static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ; | 30 | static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ; |
31 | 31 | ||
32 | static inline struct nf_icmp_net *icmpv6_pernet(struct net *net) | ||
33 | { | ||
34 | return &net->ct.nf_ct_proto.icmpv6; | ||
35 | } | ||
36 | |||
32 | static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, | 37 | static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, |
33 | unsigned int dataoff, | 38 | unsigned int dataoff, |
34 | struct nf_conntrack_tuple *tuple) | 39 | struct nf_conntrack_tuple *tuple) |
@@ -90,7 +95,7 @@ static int icmpv6_print_tuple(struct seq_file *s, | |||
90 | 95 | ||
91 | static unsigned int *icmpv6_get_timeouts(struct net *net) | 96 | static unsigned int *icmpv6_get_timeouts(struct net *net) |
92 | { | 97 | { |
93 | return &nf_ct_icmpv6_timeout; | 98 | return &icmpv6_pernet(net)->timeout; |
94 | } | 99 | } |
95 | 100 | ||
96 | /* Returns verdict for packet, or -1 for invalid. */ | 101 | /* Returns verdict for packet, or -1 for invalid. */ |
@@ -319,7 +324,6 @@ static struct ctl_table_header *icmpv6_sysctl_header; | |||
319 | static struct ctl_table icmpv6_sysctl_table[] = { | 324 | static struct ctl_table icmpv6_sysctl_table[] = { |
320 | { | 325 | { |
321 | .procname = "nf_conntrack_icmpv6_timeout", | 326 | .procname = "nf_conntrack_icmpv6_timeout", |
322 | .data = &nf_ct_icmpv6_timeout, | ||
323 | .maxlen = sizeof(unsigned int), | 327 | .maxlen = sizeof(unsigned int), |
324 | .mode = 0644, | 328 | .mode = 0644, |
325 | .proc_handler = proc_dointvec_jiffies, | 329 | .proc_handler = proc_dointvec_jiffies, |
@@ -328,6 +332,22 @@ static struct ctl_table icmpv6_sysctl_table[] = { | |||
328 | }; | 332 | }; |
329 | #endif /* CONFIG_SYSCTL */ | 333 | #endif /* CONFIG_SYSCTL */ |
330 | 334 | ||
335 | static int icmpv6_init_net(struct net *net) | ||
336 | { | ||
337 | struct nf_icmp_net *in = icmpv6_pernet(net); | ||
338 | struct nf_proto_net *pn = (struct nf_proto_net *)in; | ||
339 | in->timeout = nf_ct_icmpv6_timeout; | ||
340 | #ifdef CONFIG_SYSCTL | ||
341 | pn->ctl_table = kmemdup(icmpv6_sysctl_table, | ||
342 | sizeof(icmpv6_sysctl_table), | ||
343 | GFP_KERNEL); | ||
344 | if (!pn->ctl_table) | ||
345 | return -ENOMEM; | ||
346 | pn->ctl_table[0].data = &in->timeout; | ||
347 | #endif | ||
348 | return 0; | ||
349 | } | ||
350 | |||
331 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = | 351 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = |
332 | { | 352 | { |
333 | .l3proto = PF_INET6, | 353 | .l3proto = PF_INET6, |
@@ -359,4 +379,5 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = | |||
359 | .ctl_table_header = &icmpv6_sysctl_header, | 379 | .ctl_table_header = &icmpv6_sysctl_header, |
360 | .ctl_table = icmpv6_sysctl_table, | 380 | .ctl_table = icmpv6_sysctl_table, |
361 | #endif | 381 | #endif |
382 | .init_net = icmpv6_init_net, | ||
362 | }; | 383 | }; |