Skip to content

Commit

Permalink
[NETFILTER]: xt_limit: don't reset state on unrelated rule updates
Browse files Browse the repository at this point in the history
The limit match reinitializes its state whenever the ruleset changes,
which means it will forget about previously used credits.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 22, 2006
1 parent ecb70c9 commit 57dab5d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions net/netfilter/xt_limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ ipt_limit_checkentry(const char *tablename,
return 0;
}

/* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
128. */
r->prev = jiffies;
r->credit = user2credits(r->avg * r->burst); /* Credits full. */
r->credit_cap = user2credits(r->avg * r->burst); /* Credits full. */
r->cost = user2credits(r->avg);

/* For SMP, we only want to use one set of counters. */
r->master = r;

if (r->cost == 0) {
/* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
128. */
r->prev = jiffies;
r->credit = user2credits(r->avg * r->burst); /* Credits full. */
r->credit_cap = user2credits(r->avg * r->burst); /* Credits full. */
r->cost = user2credits(r->avg);
}
return 1;
}

Expand Down

0 comments on commit 57dab5d

Please sign in to comment.