diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-01-18 02:21:13 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-01-18 02:21:13 -0500 |
commit | a83d8e8d099fc373a5ca7112ad08c553bb2c180f (patch) | |
tree | 19b7bbeb34ae718f5bac20d1ab42d6280bb20665 /net/ipv6 | |
parent | a1004d8e3d463012f231bab104325ecb15637f78 (diff) |
netfilter: xtables: add struct xt_mtchk_param::net
Some complex match modules (like xt_hashlimit/xt_recent) want netns
information at constructor and destructor time. We propably can play
games at match destruction time, because netns can be passed in object,
but I think it's cleaner to explicitly pass netns.
Add ->net, make sure it's set from ebtables/iptables/ip6tables code.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 480d7f8c9802..a825940a92ef 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -693,8 +693,8 @@ static int check_target(struct ip6t_entry *e, const char *name) | |||
693 | } | 693 | } |
694 | 694 | ||
695 | static int | 695 | static int |
696 | find_check_entry(struct ip6t_entry *e, const char *name, unsigned int size, | 696 | find_check_entry(struct ip6t_entry *e, struct net *net, const char *name, |
697 | unsigned int *i) | 697 | unsigned int size, unsigned int *i) |
698 | { | 698 | { |
699 | struct ip6t_entry_target *t; | 699 | struct ip6t_entry_target *t; |
700 | struct xt_target *target; | 700 | struct xt_target *target; |
@@ -707,6 +707,7 @@ find_check_entry(struct ip6t_entry *e, const char *name, unsigned int size, | |||
707 | return ret; | 707 | return ret; |
708 | 708 | ||
709 | j = 0; | 709 | j = 0; |
710 | mtpar.net = net; | ||
710 | mtpar.table = name; | 711 | mtpar.table = name; |
711 | mtpar.entryinfo = &e->ipv6; | 712 | mtpar.entryinfo = &e->ipv6; |
712 | mtpar.hook_mask = e->comefrom; | 713 | mtpar.hook_mask = e->comefrom; |
@@ -830,7 +831,8 @@ cleanup_entry(struct ip6t_entry *e, unsigned int *i) | |||
830 | /* Checks and translates the user-supplied table segment (held in | 831 | /* Checks and translates the user-supplied table segment (held in |
831 | newinfo) */ | 832 | newinfo) */ |
832 | static int | 833 | static int |
833 | translate_table(const char *name, | 834 | translate_table(struct net *net, |
835 | const char *name, | ||
834 | unsigned int valid_hooks, | 836 | unsigned int valid_hooks, |
835 | struct xt_table_info *newinfo, | 837 | struct xt_table_info *newinfo, |
836 | void *entry0, | 838 | void *entry0, |
@@ -892,7 +894,7 @@ translate_table(const char *name, | |||
892 | /* Finally, each sanity check must pass */ | 894 | /* Finally, each sanity check must pass */ |
893 | i = 0; | 895 | i = 0; |
894 | ret = IP6T_ENTRY_ITERATE(entry0, newinfo->size, | 896 | ret = IP6T_ENTRY_ITERATE(entry0, newinfo->size, |
895 | find_check_entry, name, size, &i); | 897 | find_check_entry, net, name, size, &i); |
896 | 898 | ||
897 | if (ret != 0) { | 899 | if (ret != 0) { |
898 | IP6T_ENTRY_ITERATE(entry0, newinfo->size, | 900 | IP6T_ENTRY_ITERATE(entry0, newinfo->size, |
@@ -1336,7 +1338,7 @@ do_replace(struct net *net, void __user *user, unsigned int len) | |||
1336 | goto free_newinfo; | 1338 | goto free_newinfo; |
1337 | } | 1339 | } |
1338 | 1340 | ||
1339 | ret = translate_table(tmp.name, tmp.valid_hooks, | 1341 | ret = translate_table(net, tmp.name, tmp.valid_hooks, |
1340 | newinfo, loc_cpu_entry, tmp.size, tmp.num_entries, | 1342 | newinfo, loc_cpu_entry, tmp.size, tmp.num_entries, |
1341 | tmp.hook_entry, tmp.underflow); | 1343 | tmp.hook_entry, tmp.underflow); |
1342 | if (ret != 0) | 1344 | if (ret != 0) |
@@ -2121,7 +2123,7 @@ struct xt_table *ip6t_register_table(struct net *net, | |||
2121 | loc_cpu_entry = newinfo->entries[raw_smp_processor_id()]; | 2123 | loc_cpu_entry = newinfo->entries[raw_smp_processor_id()]; |
2122 | memcpy(loc_cpu_entry, repl->entries, repl->size); | 2124 | memcpy(loc_cpu_entry, repl->entries, repl->size); |
2123 | 2125 | ||
2124 | ret = translate_table(table->name, table->valid_hooks, | 2126 | ret = translate_table(net, table->name, table->valid_hooks, |
2125 | newinfo, loc_cpu_entry, repl->size, | 2127 | newinfo, loc_cpu_entry, repl->size, |
2126 | repl->num_entries, | 2128 | repl->num_entries, |
2127 | repl->hook_entry, | 2129 | repl->hook_entry, |