aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/hashtables.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-15 20:19:20 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-15 20:19:20 +0100
commit1550e9ba597946c88e3e7e3e8dcf33c13dd76e5b (patch)
treeb21cb0e2fbfeb28f294832e266bdbfa2398b1d7b /src/hashtables.c
parenttests: trim output (diff)
downloadwireguard-monolithic-historical-1550e9ba597946c88e3e7e3e8dcf33c13dd76e5b.tar.xz
wireguard-monolithic-historical-1550e9ba597946c88e3e7e3e8dcf33c13dd76e5b.zip
various: nits from willy
Diffstat (limited to 'src/hashtables.c')
-rw-r--r--src/hashtables.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hashtables.c b/src/hashtables.c
index 8616015..d2a9cf9 100644
--- a/src/hashtables.c
+++ b/src/hashtables.c
@@ -68,7 +68,7 @@ void index_hashtable_init(struct index_hashtable *table)
__le32 index_hashtable_insert(struct index_hashtable *table, struct index_hashtable_entry *entry)
{
struct index_hashtable_entry *existing_entry;
- uint64_t rand;
+ unsigned long rand = get_random_long();
spin_lock(&table->lock);
hlist_del_init_rcu(&entry->index_hash);
@@ -78,7 +78,7 @@ __le32 index_hashtable_insert(struct index_hashtable *table, struct index_hashta
search_unused_slot:
/* First we try to find an unused slot, randomly, while unlocked. */
- rand = get_random_long();
+ ++rand;
entry->index = (__force __le32)siphash24((uint8_t *)&rand, sizeof(rand), table->key);
hlist_for_each_entry_rcu(existing_entry, index_bucket(table, entry->index), index_hash) {
if (existing_entry->index == entry->index)