diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-07-05 12:26:37 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-05-11 12:23:43 -0400 |
commit | de74c16996287250f0d947663127f80c6beebd3c (patch) | |
tree | c7e77e254c5812c8561516dd668eaec732a89a0d /net/bridge | |
parent | ef53d702c3614fb919e8a8291033e3dbccfd1aea (diff) |
netfilter: xtables: combine struct xt_match_param and xt_target_param
The structures carried - besides match/target - almost the same data.
It is possible to combine them, as extensions are evaluated serially,
and so, the callers end up a little smaller.
text data bss filename
-15318 740 104 net/ipv4/netfilter/ip_tables.o
+15286 740 104 net/ipv4/netfilter/ip_tables.o
-15333 540 152 net/ipv6/netfilter/ip6_tables.o
+15269 540 152 net/ipv6/netfilter/ip6_tables.o
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 1d8c2c0a7470..290d43541d46 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -86,7 +86,7 @@ static struct xt_target ebt_standard_target = { | |||
86 | 86 | ||
87 | static inline int | 87 | static inline int |
88 | ebt_do_watcher(const struct ebt_entry_watcher *w, struct sk_buff *skb, | 88 | ebt_do_watcher(const struct ebt_entry_watcher *w, struct sk_buff *skb, |
89 | struct xt_target_param *par) | 89 | struct xt_action_param *par) |
90 | { | 90 | { |
91 | par->target = w->u.watcher; | 91 | par->target = w->u.watcher; |
92 | par->targinfo = w->data; | 92 | par->targinfo = w->data; |
@@ -95,8 +95,9 @@ ebt_do_watcher(const struct ebt_entry_watcher *w, struct sk_buff *skb, | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline int ebt_do_match (struct ebt_entry_match *m, | 98 | static inline int |
99 | const struct sk_buff *skb, struct xt_match_param *par) | 99 | ebt_do_match(struct ebt_entry_match *m, const struct sk_buff *skb, |
100 | struct xt_action_param *par) | ||
100 | { | 101 | { |
101 | par->match = m->u.match; | 102 | par->match = m->u.match; |
102 | par->matchinfo = m->data; | 103 | par->matchinfo = m->data; |
@@ -186,14 +187,13 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, | |||
186 | const char *base; | 187 | const char *base; |
187 | const struct ebt_table_info *private; | 188 | const struct ebt_table_info *private; |
188 | bool hotdrop = false; | 189 | bool hotdrop = false; |
189 | struct xt_match_param mtpar; | 190 | struct xt_action_param acpar; |
190 | struct xt_target_param tgpar; | ||
191 | 191 | ||
192 | mtpar.family = tgpar.family = NFPROTO_BRIDGE; | 192 | acpar.family = NFPROTO_BRIDGE; |
193 | mtpar.in = tgpar.in = in; | 193 | acpar.in = in; |
194 | mtpar.out = tgpar.out = out; | 194 | acpar.out = out; |
195 | mtpar.hotdrop = &hotdrop; | 195 | acpar.hotdrop = &hotdrop; |
196 | mtpar.hooknum = tgpar.hooknum = hook; | 196 | acpar.hooknum = hook; |
197 | 197 | ||
198 | read_lock_bh(&table->lock); | 198 | read_lock_bh(&table->lock); |
199 | private = table->private; | 199 | private = table->private; |
@@ -214,7 +214,7 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, | |||
214 | if (ebt_basic_match(point, eth_hdr(skb), in, out)) | 214 | if (ebt_basic_match(point, eth_hdr(skb), in, out)) |
215 | goto letscontinue; | 215 | goto letscontinue; |
216 | 216 | ||
217 | if (EBT_MATCH_ITERATE(point, ebt_do_match, skb, &mtpar) != 0) | 217 | if (EBT_MATCH_ITERATE(point, ebt_do_match, skb, &acpar) != 0) |
218 | goto letscontinue; | 218 | goto letscontinue; |
219 | if (hotdrop) { | 219 | if (hotdrop) { |
220 | read_unlock_bh(&table->lock); | 220 | read_unlock_bh(&table->lock); |
@@ -227,7 +227,7 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, | |||
227 | 227 | ||
228 | /* these should only watch: not modify, nor tell us | 228 | /* these should only watch: not modify, nor tell us |
229 | what to do with the packet */ | 229 | what to do with the packet */ |
230 | EBT_WATCHER_ITERATE(point, ebt_do_watcher, skb, &tgpar); | 230 | EBT_WATCHER_ITERATE(point, ebt_do_watcher, skb, &acpar); |
231 | 231 | ||
232 | t = (struct ebt_entry_target *) | 232 | t = (struct ebt_entry_target *) |
233 | (((char *)point) + point->target_offset); | 233 | (((char *)point) + point->target_offset); |
@@ -235,9 +235,9 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, | |||
235 | if (!t->u.target->target) | 235 | if (!t->u.target->target) |
236 | verdict = ((struct ebt_standard_target *)t)->verdict; | 236 | verdict = ((struct ebt_standard_target *)t)->verdict; |
237 | else { | 237 | else { |
238 | tgpar.target = t->u.target; | 238 | acpar.target = t->u.target; |
239 | tgpar.targinfo = t->data; | 239 | acpar.targinfo = t->data; |
240 | verdict = t->u.target->target(skb, &tgpar); | 240 | verdict = t->u.target->target(skb, &acpar); |
241 | } | 241 | } |
242 | if (verdict == EBT_ACCEPT) { | 242 | if (verdict == EBT_ACCEPT) { |
243 | read_unlock_bh(&table->lock); | 243 | read_unlock_bh(&table->lock); |