diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2012-05-28 17:04:10 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-06-07 08:58:39 -0400 |
commit | 524a53e5ad5f34f64ed34281e8b0eca19437db5b (patch) | |
tree | e6ad5ef71a1fe4b95c3ab5690d5e728513765e5d /include | |
parent | 2c352f444ccfa966a1aa4fd8e9ee29381c467448 (diff) |
netfilter: nf_conntrack: prepare namespace support for l3 protocol trackers
This patch prepares the namespace support for layer 3 protocol trackers.
Basically, this modifies the following interfaces:
* nf_ct_l3proto_[un]register_sysctl.
* nf_conntrack_l3proto_[un]register.
We add a new nf_ct_l3proto_net is used to get the pernet data of l3proto.
This adds rhe new struct nf_ip_net that is used to store the sysctl header
and l3proto_ipv4,l4proto_tcp(6),l4proto_udp(6),l4proto_icmp(v6) because the
protos such tcp and tcp6 use the same data,so making nf_ip_net as a field
of netns_ct is the easiest way to manager it.
This patch also adds init_net to struct nf_conntrack_l3proto to initial
the layer 3 protocol pernet data.
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 'include')
-rw-r--r-- | include/net/netfilter/nf_conntrack_l3proto.h | 9 | ||||
-rw-r--r-- | include/net/netns/conntrack.h | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 9699c028b74b..d6df8c71a7fe 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -69,6 +69,9 @@ struct nf_conntrack_l3proto { | |||
69 | struct ctl_table *ctl_table; | 69 | struct ctl_table *ctl_table; |
70 | #endif /* CONFIG_SYSCTL */ | 70 | #endif /* CONFIG_SYSCTL */ |
71 | 71 | ||
72 | /* Init l3proto pernet data */ | ||
73 | int (*init_net)(struct net *net); | ||
74 | |||
72 | /* Module (if any) which this is connected to. */ | 75 | /* Module (if any) which this is connected to. */ |
73 | struct module *me; | 76 | struct module *me; |
74 | }; | 77 | }; |
@@ -76,8 +79,10 @@ struct nf_conntrack_l3proto { | |||
76 | extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; | 79 | extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; |
77 | 80 | ||
78 | /* Protocol registration. */ | 81 | /* Protocol registration. */ |
79 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | 82 | extern int nf_conntrack_l3proto_register(struct net *net, |
80 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | 83 | struct nf_conntrack_l3proto *proto); |
84 | extern void nf_conntrack_l3proto_unregister(struct net *net, | ||
85 | struct nf_conntrack_l3proto *proto); | ||
81 | extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); | 86 | extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); |
82 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); | 87 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); |
83 | 88 | ||
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 1f53038b0d1b..b2dbcc5cd813 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
@@ -20,6 +20,13 @@ struct nf_proto_net { | |||
20 | unsigned int users; | 20 | unsigned int users; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | struct nf_ip_net { | ||
24 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) | ||
25 | struct ctl_table_header *ctl_table_header; | ||
26 | struct ctl_table *ctl_table; | ||
27 | #endif | ||
28 | }; | ||
29 | |||
23 | struct netns_ct { | 30 | struct netns_ct { |
24 | atomic_t count; | 31 | atomic_t count; |
25 | unsigned int expect_count; | 32 | unsigned int expect_count; |
@@ -40,6 +47,7 @@ struct netns_ct { | |||
40 | unsigned int sysctl_log_invalid; /* Log invalid packets */ | 47 | unsigned int sysctl_log_invalid; /* Log invalid packets */ |
41 | int sysctl_auto_assign_helper; | 48 | int sysctl_auto_assign_helper; |
42 | bool auto_assign_helper_warned; | 49 | bool auto_assign_helper_warned; |
50 | struct nf_ip_net nf_ct_proto; | ||
43 | #ifdef CONFIG_SYSCTL | 51 | #ifdef CONFIG_SYSCTL |
44 | struct ctl_table_header *sysctl_header; | 52 | struct ctl_table_header *sysctl_header; |
45 | struct ctl_table_header *acct_sysctl_header; | 53 | struct ctl_table_header *acct_sysctl_header; |