Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323068
b: refs/heads/master
c: 2885da7
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 18, 2012
1 parent abe6dde commit 5b3abce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 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: bafa6d9d89072c1a18853afe9ee5de05c491c13a
refs/heads/master: 2885da72966fcb89f48d554339d347fb02b5ea78
19 changes: 2 additions & 17 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,9 @@ static inline bool rt_is_expired(const struct rtable *rth)
return rth->rt_genid != rt_genid(dev_net(rth->dst.dev));
}

/*
* Perturbation of rt_genid by a small quantity [1..256]
* Using 8 bits of shuffling ensure we can call rt_cache_invalidate()
* many times (2^24) without giving recent rt_genid.
* Jenkins hash is strong enough that litle changes of rt_genid are OK.
*/
static void rt_cache_invalidate(struct net *net)
{
unsigned char shuffle;

get_random_bytes(&shuffle, sizeof(shuffle));
atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
}

void rt_cache_flush(struct net *net)
{
rt_cache_invalidate(net);
atomic_inc(&net->ipv4.rt_genid);
}

static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
Expand Down Expand Up @@ -2520,8 +2506,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {

static __net_init int rt_genid_init(struct net *net)
{
get_random_bytes(&net->ipv4.rt_genid,
sizeof(net->ipv4.rt_genid));
atomic_set(&net->ipv4.rt_genid, 0);
get_random_bytes(&net->ipv4.dev_addr_genid,
sizeof(net->ipv4.dev_addr_genid));
return 0;
Expand Down

0 comments on commit 5b3abce

Please sign in to comment.