aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-01-18 02:25:47 -0500
committerPatrick McHardy <kaber@trash.net>2010-01-18 02:25:47 -0500
commitf54e9367f8499a9bf6b2afbc0dce63e1d53c525a (patch)
treea2e852b0fc05c0e1397136bca29c359163bc2445 /net/bridge
parenta83d8e8d099fc373a5ca7112ad08c553bb2c180f (diff)
netfilter: xtables: add struct xt_mtdtor_param::net
Add ->net to match destructor list like ->net in constructor list. Make sure it's set in ebtables/iptables/ip6tables, this requires to propagate netns up to *_unregister_table(). 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/ebtable_broute.c2
-rw-r--r--net/bridge/netfilter/ebtable_filter.c2
-rw-r--r--net/bridge/netfilter/ebtable_nat.c2
-rw-r--r--net/bridge/netfilter/ebtables.c19
4 files changed, 13 insertions, 12 deletions
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
index d32ab13e728c..ae3f106c3908 100644
--- a/net/bridge/netfilter/ebtable_broute.c
+++ b/net/bridge/netfilter/ebtable_broute.c
@@ -71,7 +71,7 @@ static int __net_init broute_net_init(struct net *net)
71 71
72static void __net_exit broute_net_exit(struct net *net) 72static void __net_exit broute_net_exit(struct net *net)
73{ 73{
74 ebt_unregister_table(net->xt.broute_table); 74 ebt_unregister_table(net, net->xt.broute_table);
75} 75}
76 76
77static struct pernet_operations broute_net_ops = { 77static struct pernet_operations broute_net_ops = {
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
index 60b1a6ca7185..42e6bd094574 100644
--- a/net/bridge/netfilter/ebtable_filter.c
+++ b/net/bridge/netfilter/ebtable_filter.c
@@ -107,7 +107,7 @@ static int __net_init frame_filter_net_init(struct net *net)
107 107
108static void __net_exit frame_filter_net_exit(struct net *net) 108static void __net_exit frame_filter_net_exit(struct net *net)
109{ 109{
110 ebt_unregister_table(net->xt.frame_filter); 110 ebt_unregister_table(net, net->xt.frame_filter);
111} 111}
112 112
113static struct pernet_operations frame_filter_net_ops = { 113static struct pernet_operations frame_filter_net_ops = {
diff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c
index 4a98804203b0..6dc2f878ae05 100644
--- a/net/bridge/netfilter/ebtable_nat.c
+++ b/net/bridge/netfilter/ebtable_nat.c
@@ -107,7 +107,7 @@ static int __net_init frame_nat_net_init(struct net *net)
107 107
108static void __net_exit frame_nat_net_exit(struct net *net) 108static void __net_exit frame_nat_net_exit(struct net *net)
109{ 109{
110 ebt_unregister_table(net->xt.frame_nat); 110 ebt_unregister_table(net, net->xt.frame_nat);
111} 111}
112 112
113static struct pernet_operations frame_nat_net_ops = { 113static struct pernet_operations frame_nat_net_ops = {
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index c77bab986696..1aa0e4c1f52d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -561,13 +561,14 @@ ebt_get_udc_positions(struct ebt_entry *e, struct ebt_table_info *newinfo,
561} 561}
562 562
563static inline int 563static inline int
564ebt_cleanup_match(struct ebt_entry_match *m, unsigned int *i) 564ebt_cleanup_match(struct ebt_entry_match *m, struct net *net, unsigned int *i)
565{ 565{
566 struct xt_mtdtor_param par; 566 struct xt_mtdtor_param par;
567 567
568 if (i && (*i)-- == 0) 568 if (i && (*i)-- == 0)
569 return 1; 569 return 1;
570 570
571 par.net = net;
571 par.match = m->u.match; 572 par.match = m->u.match;
572 par.matchinfo = m->data; 573 par.matchinfo = m->data;
573 par.family = NFPROTO_BRIDGE; 574 par.family = NFPROTO_BRIDGE;
@@ -595,7 +596,7 @@ ebt_cleanup_watcher(struct ebt_entry_watcher *w, unsigned int *i)
595} 596}
596 597
597static inline int 598static inline int
598ebt_cleanup_entry(struct ebt_entry *e, unsigned int *cnt) 599ebt_cleanup_entry(struct ebt_entry *e, struct net *net, unsigned int *cnt)
599{ 600{
600 struct xt_tgdtor_param par; 601 struct xt_tgdtor_param par;
601 struct ebt_entry_target *t; 602 struct ebt_entry_target *t;
@@ -606,7 +607,7 @@ ebt_cleanup_entry(struct ebt_entry *e, unsigned int *cnt)
606 if (cnt && (*cnt)-- == 0) 607 if (cnt && (*cnt)-- == 0)
607 return 1; 608 return 1;
608 EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, NULL); 609 EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, NULL);
609 EBT_MATCH_ITERATE(e, ebt_cleanup_match, NULL); 610 EBT_MATCH_ITERATE(e, ebt_cleanup_match, net, NULL);
610 t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); 611 t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
611 612
612 par.target = t->u.target; 613 par.target = t->u.target;
@@ -731,7 +732,7 @@ ebt_check_entry(struct ebt_entry *e,
731cleanup_watchers: 732cleanup_watchers:
732 EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, &j); 733 EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, &j);
733cleanup_matches: 734cleanup_matches:
734 EBT_MATCH_ITERATE(e, ebt_cleanup_match, &i); 735 EBT_MATCH_ITERATE(e, ebt_cleanup_match, net, &i);
735 return ret; 736 return ret;
736} 737}
737 738
@@ -924,7 +925,7 @@ static int translate_table(struct net *net, char *name,
924 ebt_check_entry, net, newinfo, name, &i, cl_s, udc_cnt); 925 ebt_check_entry, net, newinfo, name, &i, cl_s, udc_cnt);
925 if (ret != 0) { 926 if (ret != 0) {
926 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, 927 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
927 ebt_cleanup_entry, &i); 928 ebt_cleanup_entry, net, &i);
928 } 929 }
929 vfree(cl_s); 930 vfree(cl_s);
930 return ret; 931 return ret;
@@ -1074,7 +1075,7 @@ static int do_replace(struct net *net, void __user *user, unsigned int len)
1074 1075
1075 /* decrease module count and free resources */ 1076 /* decrease module count and free resources */
1076 EBT_ENTRY_ITERATE(table->entries, table->entries_size, 1077 EBT_ENTRY_ITERATE(table->entries, table->entries_size,
1077 ebt_cleanup_entry, NULL); 1078 ebt_cleanup_entry, net, NULL);
1078 1079
1079 vfree(table->entries); 1080 vfree(table->entries);
1080 if (table->chainstack) { 1081 if (table->chainstack) {
@@ -1091,7 +1092,7 @@ free_unlock:
1091 mutex_unlock(&ebt_mutex); 1092 mutex_unlock(&ebt_mutex);
1092free_iterate: 1093free_iterate:
1093 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, 1094 EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
1094 ebt_cleanup_entry, NULL); 1095 ebt_cleanup_entry, net, NULL);
1095free_counterstmp: 1096free_counterstmp:
1096 vfree(counterstmp); 1097 vfree(counterstmp);
1097 /* can be initialized in translate_table() */ 1098 /* can be initialized in translate_table() */
@@ -1208,7 +1209,7 @@ out:
1208 return ERR_PTR(ret); 1209 return ERR_PTR(ret);
1209} 1210}
1210 1211
1211void ebt_unregister_table(struct ebt_table *table) 1212void ebt_unregister_table(struct net *net, struct ebt_table *table)
1212{ 1213{
1213 int i; 1214 int i;
1214 1215
@@ -1220,7 +1221,7 @@ void ebt_unregister_table(struct ebt_table *table)
1220 list_del(&table->list); 1221 list_del(&table->list);
1221 mutex_unlock(&ebt_mutex); 1222 mutex_unlock(&ebt_mutex);
1222 EBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size, 1223 EBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size,
1223 ebt_cleanup_entry, NULL); 1224 ebt_cleanup_entry, net, NULL);
1224 if (table->private->nentries) 1225 if (table->private->nentries)
1225 module_put(table->me); 1226 module_put(table->me);
1226 vfree(table->private->entries); 1227 vfree(table->private->entries);