summaryrefslogtreecommitdiffstats
path: root/userspace/ebtables2/communication.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-03-28 20:29:37 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-03-28 20:29:37 +0000
commitdc2061ed4d7e3c8b32708bfa3b4ededd9317fb87 (patch)
treec88993f75c56db5306add6aa0bf55a2c88b5adda /userspace/ebtables2/communication.c
parentbb71cefa3f267f784edc253b2ddc0759aa82c9db (diff)
more cleanup
Diffstat (limited to 'userspace/ebtables2/communication.c')
-rw-r--r--userspace/ebtables2/communication.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/userspace/ebtables2/communication.c b/userspace/ebtables2/communication.c
index e429d15..6db6858 100644
--- a/userspace/ebtables2/communication.c
+++ b/userspace/ebtables2/communication.c
@@ -369,12 +369,20 @@ void ebt_deliver_counters(struct ebt_u_replace *u_repl, int exec_style)
/* Don't use this old counter */
old++;
} else {
- if (cc->type == CNT_INCR) {
- new->pcnt = old->pcnt + next->cnt_surplus.pcnt;
- new->bcnt = old->bcnt + next->cnt_surplus.bcnt;
- } else if (cc->type == CNT_DECR) {
- new->pcnt = old->pcnt - next->cnt_surplus.pcnt;
- new->bcnt = old->bcnt - next->cnt_surplus.bcnt;
+ if (cc->type == CNT_CHANGE) {
+ new->pcnt = old->pcnt;
+ if (cc->change % 3 == 1)
+ new->pcnt = old->pcnt + next->cnt_surplus.pcnt;
+ else if (cc->change % 3 == 2)
+ new->pcnt = old->pcnt - next->cnt_surplus.pcnt;
+ else
+ new->pcnt = next->cnt.pcnt;
+ if (cc->change / 3 == 1)
+ new->bcnt = old->bcnt + next->cnt_surplus.bcnt;
+ else if (cc->change / 3 == 2)
+ new->bcnt = old->bcnt - next->cnt_surplus.bcnt;
+ else
+ new->bcnt = next->cnt.bcnt;
} else
*new = next->cnt;
next->cnt = *new;
@@ -415,6 +423,7 @@ void ebt_deliver_counters(struct ebt_u_replace *u_repl, int exec_style)
cc = u_repl->counterchanges;
for (i = 0; i < u_repl->nentries; i++) {
cc->type = CNT_NORM;
+ cc->change = 0;
cc3 = &cc->next;
cc = cc->next;
}
@@ -513,6 +522,7 @@ ebt_translate_entry(struct ebt_entry *e, unsigned int *hook, int *n, int *cnt,
if (*totalcnt >= u_repl->nentries)
ebt_print_bug("*totalcnt >= u_repl->nentries");
new->cnt = u_repl->counters[*totalcnt];
+ new->cnt_surplus.pcnt = new->cnt_surplus.bcnt = 0;
new->m_list = NULL;
new->w_list = NULL;
new->next = NULL;
@@ -792,6 +802,7 @@ int ebt_get_table(struct ebt_u_replace *u_repl, int init)
if (!new_cc)
ebt_print_memory();
new_cc->type = CNT_NORM;
+ new_cc->change = 0;
new_cc->next = NULL;
*prev_cc = new_cc;
prev_cc = &(new_cc->next);