Commit bc9259a8 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

inetpeer: fix token initialization

When jiffies wraps around (for example, 5 minutes after the boot, see
INITIAL_JIFFIES) and peer has just been created, now - peer->rate_last can be
< XRLIM_BURST_FACTOR * timeout, so token is not set to the maximum value, thus
some icmp packets can be unexpectedly dropped.

Fix this case by initializing last_rate to 60 seconds in the past.
Signed-off-by: default avatarNicolas Dichtel <>
Signed-off-by: default avatarEric Dumazet <>
Signed-off-by: default avatarDavid S. Miller <>
parent 68b3f28c
......@@ -510,7 +510,10 @@ relookup:
p->rate_tokens = 0;
p->rate_last = 0;
/* 60*HZ is arbitrary, but chosen enough high so that the first
* calculation of tokens is at its maximum.
p->rate_last = jiffies - 60*HZ;
/* Link the node. */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment