aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/netfilter/ip6table_raw.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2008-01-31 07:02:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:27:36 -0500
commit44d34e721e2c81ccdfb13cf34996309247ae2981 (patch)
treefec2063c8573700fd01cb6c11875769751744603 /net/ipv6/netfilter/ip6table_raw.c
parent8d870052079d255917ec4f8431f5ec102707b7af (diff)
[NETFILTER]: x_tables: return new table from {arp,ip,ip6}t_register_table()
Typical table module registers xt_table structure (i.e. packet_filter) and link it to list during it. We can't use one template for it because corresponding list_head will become corrupted. We also can't unregister with template because it wasn't changed at all and thus doesn't know in which list it is. So, we duplicate template at the very first step of table registration. Table modules will save it for use during unregistration time and actual filtering. Do it at once to not screw bisection. P.S.: renaming i.e. packet_filter => __packet_filter is temporary until full netnsization of table modules is done. Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/netfilter/ip6table_raw.c')
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index eccbaaa104a..7f55b236440 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -35,13 +35,14 @@ static struct
35 .term = IP6T_ERROR_INIT, /* ERROR */ 35 .term = IP6T_ERROR_INIT, /* ERROR */
36}; 36};
37 37
38static struct xt_table packet_raw = { 38static struct xt_table __packet_raw = {
39 .name = "raw", 39 .name = "raw",
40 .valid_hooks = RAW_VALID_HOOKS, 40 .valid_hooks = RAW_VALID_HOOKS,
41 .lock = RW_LOCK_UNLOCKED, 41 .lock = RW_LOCK_UNLOCKED,
42 .me = THIS_MODULE, 42 .me = THIS_MODULE,
43 .af = AF_INET6, 43 .af = AF_INET6,
44}; 44};
45static struct xt_table *packet_raw;
45 46
46/* The work comes in here from netfilter.c. */ 47/* The work comes in here from netfilter.c. */
47static unsigned int 48static unsigned int
@@ -51,7 +52,7 @@ ip6t_hook(unsigned int hook,
51 const struct net_device *out, 52 const struct net_device *out,
52 int (*okfn)(struct sk_buff *)) 53 int (*okfn)(struct sk_buff *))
53{ 54{
54 return ip6t_do_table(skb, hook, in, out, &packet_raw); 55 return ip6t_do_table(skb, hook, in, out, packet_raw);
55} 56}
56 57
57static struct nf_hook_ops ip6t_ops[] __read_mostly = { 58static struct nf_hook_ops ip6t_ops[] __read_mostly = {
@@ -76,9 +77,9 @@ static int __init ip6table_raw_init(void)
76 int ret; 77 int ret;
77 78
78 /* Register table */ 79 /* Register table */
79 ret = ip6t_register_table(&packet_raw, &initial_table.repl); 80 packet_raw = ip6t_register_table(&__packet_raw, &initial_table.repl);
80 if (ret < 0) 81 if (IS_ERR(packet_raw))
81 return ret; 82 return PTR_ERR(packet_raw);
82 83
83 /* Register hooks */ 84 /* Register hooks */
84 ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops)); 85 ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
@@ -88,14 +89,14 @@ static int __init ip6table_raw_init(void)
88 return ret; 89 return ret;
89 90
90 cleanup_table: 91 cleanup_table:
91 ip6t_unregister_table(&packet_raw); 92 ip6t_unregister_table(packet_raw);
92 return ret; 93 return ret;
93} 94}
94 95
95static void __exit ip6table_raw_fini(void) 96static void __exit ip6table_raw_fini(void)
96{ 97{
97 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops)); 98 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
98 ip6t_unregister_table(&packet_raw); 99 ip6t_unregister_table(packet_raw);
99} 100}
100 101
101module_init(ip6table_raw_init); 102module_init(ip6table_raw_init);