summaryrefslogtreecommitdiffstats
path: root/communication.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-02-14 20:20:03 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-02-14 20:20:03 +0000
commitab611e28d2ee6b12670494bb4212679b8c63ce22 (patch)
tree2c6c13e091f186accd0c0dbc379073d6a1a813bc /communication.c
parentff587205009a0d49e2d086765de87dc619b028bb (diff)
complete -c and -C implementation
Diffstat (limited to 'communication.c')
-rw-r--r--communication.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/communication.c b/communication.c
index e93217a..e429d15 100644
--- a/communication.c
+++ b/communication.c
@@ -358,6 +358,8 @@ void ebt_deliver_counters(struct ebt_u_replace *u_repl, int exec_style)
/* 'Normal' rule, meaning we didn't do anything to it
* So, we just copy */
*new = *old;
+ next->cnt = *new;
+ next->cnt_surplus.pcnt = next->cnt_surplus.bcnt = 0;
/* We've used an old counter */
old++;
/* We've set a new counter */
@@ -367,7 +369,16 @@ void ebt_deliver_counters(struct ebt_u_replace *u_repl, int exec_style)
/* Don't use this old counter */
old++;
} else {
- *new = next->cnt;
+ 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;
+ } else
+ *new = next->cnt;
+ next->cnt = *new;
+ next->cnt_surplus.pcnt = next->cnt_surplus.bcnt = 0;
if (cc->type == CNT_ADD)
new++;
else {