Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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: Nicolas Dichtel <>
Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
  • Loading branch information...
commit bc9259a8bae9e814fc1f775a1b3effa13e6ad330 1 parent 68b3f28
@NicolasDichtel NicolasDichtel authored davem330 committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 net/ipv4/inetpeer.c
5 net/ipv4/inetpeer.c
@@ -510,7 +510,10 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
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. */
Please sign in to comment.
Something went wrong with that request. Please try again.