diff options
-rw-r--r-- | include/net/dst.h | 10 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index c45dcc31b3bb..e3ac7d0fc4e1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -56,7 +56,11 @@ struct dst_entry | |||
56 | struct dst_entry *path; | 56 | struct dst_entry *path; |
57 | 57 | ||
58 | unsigned long rate_last; /* rate limiting for ICMP */ | 58 | unsigned long rate_last; /* rate limiting for ICMP */ |
59 | unsigned long rate_tokens; | 59 | unsigned int rate_tokens; |
60 | |||
61 | #ifdef CONFIG_NET_CLS_ROUTE | ||
62 | __u32 tclassid; | ||
63 | #endif | ||
60 | 64 | ||
61 | struct neighbour *neighbour; | 65 | struct neighbour *neighbour; |
62 | struct hh_cache *hh; | 66 | struct hh_cache *hh; |
@@ -65,10 +69,6 @@ struct dst_entry | |||
65 | int (*input)(struct sk_buff*); | 69 | int (*input)(struct sk_buff*); |
66 | int (*output)(struct sk_buff*); | 70 | int (*output)(struct sk_buff*); |
67 | 71 | ||
68 | #ifdef CONFIG_NET_CLS_ROUTE | ||
69 | __u32 tclassid; | ||
70 | #endif | ||
71 | |||
72 | struct dst_ops *ops; | 72 | struct dst_ops *ops; |
73 | 73 | ||
74 | unsigned long lastuse; | 74 | unsigned long lastuse; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index e57f1673bf6b..37cdea0c26b4 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -275,18 +275,19 @@ static inline void icmp_xmit_unlock(void) | |||
275 | #define XRLIM_BURST_FACTOR 6 | 275 | #define XRLIM_BURST_FACTOR 6 |
276 | int xrlim_allow(struct dst_entry *dst, int timeout) | 276 | int xrlim_allow(struct dst_entry *dst, int timeout) |
277 | { | 277 | { |
278 | unsigned long now; | 278 | unsigned long now, token = dst->rate_tokens; |
279 | int rc = 0; | 279 | int rc = 0; |
280 | 280 | ||
281 | now = jiffies; | 281 | now = jiffies; |
282 | dst->rate_tokens += now - dst->rate_last; | 282 | token += now - dst->rate_last; |
283 | dst->rate_last = now; | 283 | dst->rate_last = now; |
284 | if (dst->rate_tokens > XRLIM_BURST_FACTOR * timeout) | 284 | if (token > XRLIM_BURST_FACTOR * timeout) |
285 | dst->rate_tokens = XRLIM_BURST_FACTOR * timeout; | 285 | token = XRLIM_BURST_FACTOR * timeout; |
286 | if (dst->rate_tokens >= timeout) { | 286 | if (token >= timeout) { |
287 | dst->rate_tokens -= timeout; | 287 | token -= timeout; |
288 | rc = 1; | 288 | rc = 1; |
289 | } | 289 | } |
290 | dst->rate_tokens = token; | ||
290 | return rc; | 291 | return rc; |
291 | } | 292 | } |
292 | 293 | ||