diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-04-15 15:06:05 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2009-05-08 04:30:48 -0400 |
commit | 98e86403162d08a30b03426c54c2a8fca1f695d1 (patch) | |
tree | 0b610ebf8ce2978a9de090435607617f545252ae /net/bridge | |
parent | 4f2f6f236af484ada595ff37d0ee1902aa56221f (diff) |
netfilter: xtables: consolidate open-coded logic
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 820252aee81f..24555834d431 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -142,6 +142,12 @@ static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h, | |||
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | static inline __pure | ||
146 | struct ebt_entry *ebt_next_entry(const struct ebt_entry *entry) | ||
147 | { | ||
148 | return (void *)entry + entry->next_offset; | ||
149 | } | ||
150 | |||
145 | /* Do some firewalling */ | 151 | /* Do some firewalling */ |
146 | unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, | 152 | unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb, |
147 | const struct net_device *in, const struct net_device *out, | 153 | const struct net_device *in, const struct net_device *out, |
@@ -249,8 +255,7 @@ letsreturn: | |||
249 | /* jump to a udc */ | 255 | /* jump to a udc */ |
250 | cs[sp].n = i + 1; | 256 | cs[sp].n = i + 1; |
251 | cs[sp].chaininfo = chaininfo; | 257 | cs[sp].chaininfo = chaininfo; |
252 | cs[sp].e = (struct ebt_entry *) | 258 | cs[sp].e = ebt_next_entry(point); |
253 | (((char *)point) + point->next_offset); | ||
254 | i = 0; | 259 | i = 0; |
255 | chaininfo = (struct ebt_entries *) (base + verdict); | 260 | chaininfo = (struct ebt_entries *) (base + verdict); |
256 | #ifdef CONFIG_NETFILTER_DEBUG | 261 | #ifdef CONFIG_NETFILTER_DEBUG |
@@ -266,8 +271,7 @@ letsreturn: | |||
266 | sp++; | 271 | sp++; |
267 | continue; | 272 | continue; |
268 | letscontinue: | 273 | letscontinue: |
269 | point = (struct ebt_entry *) | 274 | point = ebt_next_entry(point); |
270 | (((char *)point) + point->next_offset); | ||
271 | i++; | 275 | i++; |
272 | } | 276 | } |
273 | 277 | ||
@@ -787,7 +791,7 @@ static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s | |||
787 | /* this can't be 0, so the loop test is correct */ | 791 | /* this can't be 0, so the loop test is correct */ |
788 | cl_s[i].cs.n = pos + 1; | 792 | cl_s[i].cs.n = pos + 1; |
789 | pos = 0; | 793 | pos = 0; |
790 | cl_s[i].cs.e = ((void *)e + e->next_offset); | 794 | cl_s[i].cs.e = ebt_next_entry(e); |
791 | e = (struct ebt_entry *)(hlp2->data); | 795 | e = (struct ebt_entry *)(hlp2->data); |
792 | nentries = hlp2->nentries; | 796 | nentries = hlp2->nentries; |
793 | cl_s[i].from = chain_nr; | 797 | cl_s[i].from = chain_nr; |
@@ -797,7 +801,7 @@ static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s | |||
797 | continue; | 801 | continue; |
798 | } | 802 | } |
799 | letscontinue: | 803 | letscontinue: |
800 | e = (void *)e + e->next_offset; | 804 | e = ebt_next_entry(e); |
801 | pos++; | 805 | pos++; |
802 | } | 806 | } |
803 | return 0; | 807 | return 0; |