summaryrefslogtreecommitdiffstats
path: root/libebtc.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-01-24 21:11:24 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-01-24 21:11:24 +0000
commit93f36bab8bbdfb51bc064dc0e26cf19f9a7a23fd (patch)
treed40b37124203ba7524b54fa8e7fafae107a77133 /libebtc.c
parentd1c9cec0a7fdcd9204be7daa8c4a7acc044b9e8f (diff)
really zero counters
Diffstat (limited to 'libebtc.c')
-rw-r--r--libebtc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libebtc.c b/libebtc.c
index 03b7bfe..4c702cb 100644
--- a/libebtc.c
+++ b/libebtc.c
@@ -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;
+ }
}
}