diff options
author | Bart De Schuymer <bdschuym@pandora.be> | 2005-01-24 21:11:24 +0000 |
---|---|---|
committer | Bart De Schuymer <bdschuym@pandora.be> | 2005-01-24 21:11:24 +0000 |
commit | 93f36bab8bbdfb51bc064dc0e26cf19f9a7a23fd (patch) | |
tree | d40b37124203ba7524b54fa8e7fafae107a77133 /libebtc.c | |
parent | d1c9cec0a7fdcd9204be7daa8c4a7acc044b9e8f (diff) |
really zero counters
Diffstat (limited to 'libebtc.c')
-rw-r--r-- | libebtc.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -892,6 +892,7 @@ void ebt_zero_counters(struct ebt_u_replace *replace) { struct ebt_u_entries *entries = ebt_to_chain(replace); struct ebt_cntchanges *cc = replace->counterchanges; + struct ebt_u_entry *next; int i, j; if (!entries) { @@ -900,7 +901,26 @@ void ebt_zero_counters(struct ebt_u_replace *replace) cc->type = CNT_ZERO; cc = cc->next; } + i = -1; + while (1) { + i++; + if (i < NF_BR_NUMHOOKS && !(replace->valid_hooks & (1 << i))) + continue; + entries = ebt_nr_to_chain(replace, i); + if (!entries) { + if (i < NF_BR_NUMHOOKS) + ebt_print_bug("i < NF_BR_NUMHOOKS"); + break; + } + next = entries->entries; + while (next) { + next->cnt.bcnt = next->cnt.pcnt = 0; + next = next->next; + } + } + } else { + next = entries->entries; if (entries->nentries == 0) return; @@ -923,6 +943,10 @@ void ebt_zero_counters(struct ebt_u_replace *replace) } cc = cc->next; } + while (next) { + next->cnt.bcnt = next->cnt.pcnt = 0; + next = next->next; + } } } |