summaryrefslogtreecommitdiff
path: root/libebtc.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2007-02-11 12:47:58 +0000
committerBart De Schuymer <bdschuym@pandora.be>2007-02-11 12:47:58 +0000
commit24816d3c530007d62f72b37ffabc35277c090cd1 (patch)
treedf31904ac018a5ce86eac9e50ed6999cabff7d7d /libebtc.c
parent6c36d705db7023bb1b2595beceb714b15b5de065 (diff)
downloadebtables-24816d3c530007d62f72b37ffabc35277c090cd1.tar.gz
ebtables-24816d3c530007d62f72b37ffabc35277c090cd1.tar.bz2
ebtables-24816d3c530007d62f72b37ffabc35277c090cd1.zip
speedup checking for loops
Diffstat (limited to 'libebtc.c')
-rw-r--r--libebtc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libebtc.c b/libebtc.c
index 02003a7..f76a04c 100644
--- a/libebtc.c
+++ b/libebtc.c
@@ -1019,8 +1019,6 @@ void ebt_check_for_loops(struct ebt_u_replace *replace)
verdict = ((struct ebt_standard_target *)(e->t))->verdict;
if (verdict < 0)
goto letscontinue;
- entries2 = replace->chains[verdict + NF_BR_NUMHOOKS];
- entries2->hook_mask |= entries->hook_mask;
/* Now see if we've been here before */
for (k = 0; k < sp; k++)
if (stack[k].chain_nr == verdict + NF_BR_NUMHOOKS) {
@@ -1029,6 +1027,11 @@ void ebt_check_for_loops(struct ebt_u_replace *replace)
replace->chains[stack[k].chain_nr]->name);
goto free_stack;
}
+ entries2 = replace->chains[verdict + NF_BR_NUMHOOKS];
+ /* check if we've dealt with this chain already */
+ if (entries2->hook_mask & (1<<i))
+ goto letscontinue;
+ entries2->hook_mask |= entries->hook_mask;
/* Jump to the chain, make sure we know how to get back */
stack[sp].chain_nr = chain_nr;
stack[sp].n = j;