diff options
author | Bart De Schuymer <bdschuym@pandora.be> | 2003-09-18 18:55:11 +0000 |
---|---|---|
committer | Bart De Schuymer <bdschuym@pandora.be> | 2003-09-18 18:55:11 +0000 |
commit | f5a692f4f68582dfd17161798d8dda9d9464a9e4 (patch) | |
tree | c55fcdae9a4dae2cd7da633a1298733467b90f43 | |
parent | 1da662b8735070809afacaba9e51ac171452c757 (diff) |
*** empty log message ***
-rw-r--r-- | kernel/linux/net/bridge/netfilter/ebt_limit.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/kernel/linux/net/bridge/netfilter/ebt_limit.c b/kernel/linux/net/bridge/netfilter/ebt_limit.c index 5947e56..f130203 100644 --- a/kernel/linux/net/bridge/netfilter/ebt_limit.c +++ b/kernel/linux/net/bridge/netfilter/ebt_limit.c @@ -4,7 +4,7 @@ * Authors: * Tom Marshall <tommy@home.tig-grr.com> * - * Mostly copied from netfilter's ipt_limit.c + * Mostly copied from netfilter's ipt_limit.c, see that file for explanation * * September, 2003 * @@ -17,30 +17,8 @@ #include <linux/netdevice.h> #include <linux/spinlock.h> -/* The algorithm used is the Simple Token Bucket Filter (TBF) - * see net/sched/sch_tbf.c in the linux source tree - */ - static spinlock_t limit_lock = SPIN_LOCK_UNLOCKED; -/* Rusty: This is my (non-mathematically-inclined) understanding of - this algorithm. The `average rate' in jiffies becomes your initial - amount of credit `credit' and the most credit you can ever have - `credit_cap'. The `peak rate' becomes the cost of passing the - test, `cost'. - - `prev' tracks the last packet hit: you gain one credit per jiffy. - If you get credit balance more than this, the extra credit is - discarded. Every time the match passes, you lose `cost' credits; - if you don't have that many, the test fails. - - See Alexey's formal explanation in net/sched/sch_tbf.c. - - To avoid underflow, we multiply by 128 (ie. you get 128 credits per - jiffy). Hence a cost of 2^32-1, means one pass per 32768 seconds - at 1024HZ (or one every 9 hours). A cost of 1 means 12800 passes - per second at 100HZ. */ - #define CREDITS_PER_JIFFY 128 static int ebt_limit_match(const struct sk_buff *skb, const struct net_device *in, |