aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/hashtables.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-08-07 20:45:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-08-08 05:57:25 +0200
commitb2ec36268f0f33dc9f5af77c373014681fafa7f6 (patch)
tree9d2585981d7ffdb1d4cf5ad692a6b9c46680cdd3 /src/hashtables.h
parentcompat: support grsecurity with our compat padata implementation (diff)
downloadwireguard-monolithic-historical-b2ec36268f0f33dc9f5af77c373014681fafa7f6.tar.xz
wireguard-monolithic-historical-b2ec36268f0f33dc9f5af77c373014681fafa7f6.zip
hashtables: allow up to 2^{20} peers per interface
This allows for nearly 1 million peers per interface, which should be more than enough. If needed later, this number could easily be increased beyond this. We also increase the size of the hashtables to accommodate this upper bound. In the future, it might be smart to dynamically expand the hashtable instead of this hard coded compromise value between small systems and large systems. Ongoing work includes figuring out the most optimal scheme for these hashtables and for the insertion to mask their order from timing inference.
Diffstat (limited to 'src/hashtables.h')
-rw-r--r--src/hashtables.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hashtables.h b/src/hashtables.h
index 08a2a5d..2a178a0 100644
--- a/src/hashtables.h
+++ b/src/hashtables.h
@@ -12,7 +12,8 @@
struct wireguard_peer;
struct pubkey_hashtable {
- DECLARE_HASHTABLE(hashtable, 8);
+ /* TODO: move to rhashtable */
+ DECLARE_HASHTABLE(hashtable, 11);
siphash_key_t key;
struct mutex lock;
};
@@ -23,7 +24,8 @@ void pubkey_hashtable_remove(struct pubkey_hashtable *table, struct wireguard_pe
struct wireguard_peer *pubkey_hashtable_lookup(struct pubkey_hashtable *table, const u8 pubkey[NOISE_PUBLIC_KEY_LEN]);
struct index_hashtable {
- DECLARE_HASHTABLE(hashtable, 10);
+ /* TODO: move to rhashtable */
+ DECLARE_HASHTABLE(hashtable, 13);
spinlock_t lock;
};