Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79483
b: refs/heads/master
c: 69a7382
h: refs/heads/master
i:
  79481: c167ada
  79479: 4df9850
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 28, 2008
1 parent ce5841b commit 1662fdd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 81566e8322c3f6c6f9a2277fe0e440fee8d917bd
refs/heads/master: 69a73829dbb10e7c8554e66a80cb4fde57347fff
10 changes: 5 additions & 5 deletions trunk/include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ struct dst_entry
struct dst_entry *path;

unsigned long rate_last; /* rate limiting for ICMP */
unsigned long rate_tokens;
unsigned int rate_tokens;

#ifdef CONFIG_NET_CLS_ROUTE
__u32 tclassid;
#endif

struct neighbour *neighbour;
struct hh_cache *hh;
Expand All @@ -65,10 +69,6 @@ struct dst_entry
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);

#ifdef CONFIG_NET_CLS_ROUTE
__u32 tclassid;
#endif

struct dst_ops *ops;

unsigned long lastuse;
Expand Down
13 changes: 7 additions & 6 deletions trunk/net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,19 @@ static inline void icmp_xmit_unlock(void)
#define XRLIM_BURST_FACTOR 6
int xrlim_allow(struct dst_entry *dst, int timeout)
{
unsigned long now;
unsigned long now, token = dst->rate_tokens;
int rc = 0;

now = jiffies;
dst->rate_tokens += now - dst->rate_last;
token += now - dst->rate_last;
dst->rate_last = now;
if (dst->rate_tokens > XRLIM_BURST_FACTOR * timeout)
dst->rate_tokens = XRLIM_BURST_FACTOR * timeout;
if (dst->rate_tokens >= timeout) {
dst->rate_tokens -= timeout;
if (token > XRLIM_BURST_FACTOR * timeout)
token = XRLIM_BURST_FACTOR * timeout;
if (token >= timeout) {
token -= timeout;
rc = 1;
}
dst->rate_tokens = token;
return rc;
}

Expand Down

0 comments on commit 1662fdd

Please sign in to comment.