From: pablo@netfilter.org
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 10/25] netfilter: nf_ct_icmp: add namespace support
Date: Mon, 11 Jun 2012 16:43:46 +0200 [thread overview]
Message-ID: <1339425841-24171-11-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1339425841-24171-1-git-send-email-pablo@netfilter.org>
From: Gao feng <gaofeng@cn.fujitsu.com>
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>
---
include/net/netns/conntrack.h | 1 +
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 25 ++++++++++++++++++++++--
net/netfilter/nf_conntrack_proto.c | 2 ++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 3d8e9e3..3aecdc7 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -55,6 +55,7 @@ struct nf_ip_net {
struct nf_tcp_net tcp;
struct nf_udp_net udp;
struct nf_icmp_net icmp;
+ struct nf_icmp_net icmpv6;
#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
struct ctl_table_header *ctl_table_header;
struct ctl_table *ctl_table;
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 3e81904..f606355 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -29,6 +29,11 @@
static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
+static inline struct nf_icmp_net *icmpv6_pernet(struct net *net)
+{
+ return &net->ct.nf_ct_proto.icmpv6;
+}
+
static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
unsigned int dataoff,
struct nf_conntrack_tuple *tuple)
@@ -90,7 +95,7 @@ static int icmpv6_print_tuple(struct seq_file *s,
static unsigned int *icmpv6_get_timeouts(struct net *net)
{
- return &nf_ct_icmpv6_timeout;
+ return &icmpv6_pernet(net)->timeout;
}
/* Returns verdict for packet, or -1 for invalid. */
@@ -319,7 +324,6 @@ static struct ctl_table_header *icmpv6_sysctl_header;
static struct ctl_table icmpv6_sysctl_table[] = {
{
.procname = "nf_conntrack_icmpv6_timeout",
- .data = &nf_ct_icmpv6_timeout,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
@@ -328,6 +332,22 @@ static struct ctl_table icmpv6_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */
+static int icmpv6_init_net(struct net *net)
+{
+ 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
+ pn->ctl_table = kmemdup(icmpv6_sysctl_table,
+ sizeof(icmpv6_sysctl_table),
+ GFP_KERNEL);
+ if (!pn->ctl_table)
+ return -ENOMEM;
+ pn->ctl_table[0].data = &in->timeout;
+#endif
+ return 0;
+}
+
struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
{
.l3proto = PF_INET6,
@@ -359,4 +379,5 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
.ctl_table_header = &icmpv6_sysctl_header,
.ctl_table = icmpv6_sysctl_table,
#endif
+ .init_net = icmpv6_init_net,
};
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index dbade5f..1ea9194 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -309,6 +309,8 @@ static struct nf_proto_net *nf_ct_l4proto_net(struct net *net,
return (struct nf_proto_net *)&net->ct.nf_ct_proto.udp;
case IPPROTO_ICMP:
return (struct nf_proto_net *)&net->ct.nf_ct_proto.icmp;
+ case IPPROTO_ICMPV6:
+ return (struct nf_proto_net *)&net->ct.nf_ct_proto.icmpv6;
case 255: /* l4proto_generic */
return (struct nf_proto_net *)&net->ct.nf_ct_proto.generic;
default:
--
1.7.10
next prev parent reply other threads:[~2012-06-11 14:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 14:43 [PATCH 00/25] netfilter updates from net-next (upcoming 3.6) pablo
2012-06-11 14:43 ` [PATCH 01/25] netfilter: remove include/linux/netfilter_ipv4/ipt_addrtype.h pablo
2012-06-11 14:43 ` [PATCH 02/25] netfilter: xt_connlimit: remove revision 0 pablo
2012-06-11 14:43 ` [PATCH 03/25] netfilter: Add fail-open support pablo
2012-06-11 14:43 ` [PATCH 04/25] netfilter: nf_conntrack: prepare namespace support for l4 protocol trackers pablo
2012-06-11 14:43 ` [PATCH 05/25] netfilter: nf_conntrack: prepare namespace support for l3 " pablo
2012-06-11 14:43 ` [PATCH 06/25] netfilter: nf_ct_generic: add namespace support pablo
2012-06-11 14:43 ` [PATCH 07/25] netfilter: nf_ct_tcp: " pablo
2012-06-11 14:43 ` [PATCH 08/25] netfilter: nf_ct_udp: " pablo
2012-06-11 14:43 ` [PATCH 09/25] netfilter: nf_ct_icmp: " pablo
2012-06-11 14:43 ` pablo [this message]
2012-06-11 14:43 ` [PATCH 11/25] netfilter: nf_ct_ipv4: " pablo
2012-06-11 14:43 ` [PATCH 12/25] netfilter: nf_ct_ipv6: " pablo
2012-06-11 14:43 ` [PATCH 13/25] netfilter: nf_ct_sctp: " pablo
2012-06-11 14:43 ` [PATCH 14/25] netfilter: nf_ct_udplite: " pablo
2012-06-11 14:43 ` [PATCH 15/25] netfilter: nf_ct_dccp: use new " pablo
2012-06-11 14:43 ` [PATCH 16/25] netfilter: nf_ct_gre: " pablo
2012-06-11 14:43 ` [PATCH 17/25] netfilter: nf_conntrack: remove now unused sysctl for nf_conntrack_l[3|4]proto pablo
2012-06-11 14:43 ` [PATCH 18/25] netfilter: nf_conntrack: add namespace support for cttimeout pablo
2012-06-11 14:43 ` [PATCH 19/25] netfilter: NFQUEUE: don't xor src/dst ip address for load distribution pablo
2012-06-11 14:43 ` [PATCH 20/25] netfilter: xt_recent: add address masking option pablo
2012-06-11 14:43 ` [PATCH 21/25] netfilter: decnet: switch hook PFs to nfproto pablo
2012-06-11 14:43 ` [PATCH 22/25] netfilter: bridge: " pablo
2012-06-11 14:43 ` [PATCH 23/25] netfilter: ipv4, defrag: " pablo
2012-06-11 14:44 ` [PATCH 24/25] netfilter: ipvs: " pablo
2012-06-11 14:44 ` [PATCH 25/25] netfilter: selinux: " pablo
2012-06-11 20:08 ` [PATCH 00/25] netfilter updates from net-next (upcoming 3.6) David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339425841-24171-11-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).