aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-01-18 02:21:13 -0500
committerPatrick McHardy <kaber@trash.net>2010-01-18 02:21:13 -0500
commita83d8e8d099fc373a5ca7112ad08c553bb2c180f (patch)
tree19b7bbeb34ae718f5bac20d1ab42d6280bb20665 /net/bridge
parenta1004d8e3d463012f231bab104325ecb15637f78 (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/bridge')
-rw-r--r--net/bridge/netfilter/ebtables.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index bd1c65425d4f..c77bab986696 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -619,7 +619,9 @@ ebt_cleanup_entry(struct ebt_entry *e, unsigned int *cnt)
619} 619}
620 620
621static inline int 621static inline int
622ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo, 622ebt_check_entry(struct ebt_entry *e,
623 struct net *net,
624 struct ebt_table_info *newinfo,
623 const char *name, unsigned int *cnt, 625 const char *name, unsigned int *cnt,
624 struct ebt_cl_stack *cl_s, unsigned int udc_cnt) 626 struct ebt_cl_stack *cl_s, unsigned int udc_cnt)
625{ 627{
@@ -671,6 +673,7 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo,
671 } 673 }
672 i = 0; 674 i = 0;
673 675
676 mtpar.net = net;
674 mtpar.table = tgpar.table = name; 677 mtpar.table = tgpar.table = name;
675 mtpar.entryinfo = tgpar.entryinfo = e; 678 mtpar.entryinfo = tgpar.entryinfo = e;
676 mtpar.hook_mask = tgpar.hook_mask = hookmask; 679 mtpar.hook_mask = tgpar.hook_mask = hookmask;
@@ -808,7 +811,8 @@ letscontinue:
808} 811}
809 812
810/* do the parsing of the table/chains/entries/matches/watchers/targets, heh */ 813/* do the parsing of the table/chains/entries/matches/watchers/targets, heh */
811static int translate_table(char *name, struct ebt_table_info *newinfo) 814static int translate_table(struct net *net, char *name,
815 struct ebt_table_info *newinfo)
812{ 816{
813 unsigned int i, j, k, udc_cnt; 817 unsigned int i, j, k, udc_cnt;
814 int ret; 818 int ret;
@@ -917,7 +921,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
917 /* used to know what we need to clean up if something goes wrong */ 921 /* used to know what we need to clean up if something goes wrong */
918 i = 0; 922 i = 0;
919 ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, 923 ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
920 ebt_check_entry, newinfo, name, &i, cl_s, udc_cnt); 924 ebt_check_entry, net, newinfo, name, &i, cl_s, udc_cnt);
921 if (ret != 0) { 925 if (ret != 0) {
922 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, 926 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
923 ebt_cleanup_entry, &i); 927 ebt_cleanup_entry, &i);
@@ -1017,7 +1021,7 @@ static int do_replace(struct net *net, void __user *user, unsigned int len)
1017 if (ret != 0) 1021 if (ret != 0)
1018 goto free_counterstmp; 1022 goto free_counterstmp;
1019 1023
1020 ret = translate_table(tmp.name, newinfo); 1024 ret = translate_table(net, tmp.name, newinfo);
1021 1025
1022 if (ret != 0) 1026 if (ret != 0)
1023 goto free_counterstmp; 1027 goto free_counterstmp;
@@ -1154,7 +1158,7 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table)
1154 newinfo->hook_entry[i] = p + 1158 newinfo->hook_entry[i] = p +
1155 ((char *)repl->hook_entry[i] - repl->entries); 1159 ((char *)repl->hook_entry[i] - repl->entries);
1156 } 1160 }
1157 ret = translate_table(repl->name, newinfo); 1161 ret = translate_table(net, repl->name, newinfo);
1158 if (ret != 0) { 1162 if (ret != 0) {
1159 BUGPRINT("Translate_table failed\n"); 1163 BUGPRINT("Translate_table failed\n");
1160 goto free_chainstack; 1164 goto free_chainstack;