diff options
author | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-20 10:32:21 +1000 |
---|---|---|
committer | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-20 10:52:36 +1000 |
commit | 5eb396eb68f557abe658062b6662e752459efa08 (patch) | |
tree | 950eb835e11e68568fe0aa1d01e51ed6551185dc /src/wg_noise.c | |
parent | if_wg: remove unused load (diff) | |
download | wireguard-freebsd-5eb396eb68f557abe658062b6662e752459efa08.tar.xz wireguard-freebsd-5eb396eb68f557abe658062b6662e752459efa08.zip |
wg_noise: remove duplicate peer check
Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to '')
-rw-r--r-- | src/wg_noise.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/wg_noise.c b/src/wg_noise.c index 4ecc368..435c56d 100644 --- a/src/wg_noise.c +++ b/src/wg_noise.c @@ -280,7 +280,7 @@ noise_remote_alloc(struct noise_local *l, void *arg, const uint8_t public[NOISE_PUBLIC_KEY_LEN], const uint8_t psk[NOISE_PUBLIC_KEY_LEN]) { - struct noise_remote *r, *ri; + struct noise_remote *r; uint64_t idx; if ((r = malloc(sizeof(*r), M_NOISE, M_NOWAIT)) == NULL) @@ -313,14 +313,10 @@ noise_remote_alloc(struct noise_local *l, void *arg, idx = siphash24(&l->l_hash_key, public, NOISE_PUBLIC_KEY_LEN) & HT_REMOTE_MASK; rw_wlock(&l->l_remote_lock); - CK_LIST_FOREACH(ri, &l->l_remote_hash[idx], r_entry) - if (timingsafe_bcmp(ri->r_public, public, NOISE_PUBLIC_KEY_LEN) == 0) - goto free; if (l->l_remote_num < MAX_REMOTE_PER_LOCAL) { l->l_remote_num++; CK_LIST_INSERT_HEAD(&l->l_remote_hash[idx], r, r_entry); } else { -free: free(r, M_NOISE); noise_local_put(l); r = NULL; |