aboutsummaryrefslogtreecommitdiffstats
path: root/src/if_wg.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-04-24 12:51:12 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2021-04-24 12:58:12 -0400
commit229840974084340dab14fd8b12c4c72b6e8072c0 (patch)
tree8523a13d6e6da64933b4866265a4d40722393571 /src/if_wg.c
parentif_wg: ensure peer lifetime (diff)
downloadwireguard-freebsd-229840974084340dab14fd8b12c4c72b6e8072c0.tar.xz
wireguard-freebsd-229840974084340dab14fd8b12c4c72b6e8072c0.zip
if_wg: count on peers always having a remote
We do a pretty nasty hack in the allowedips selftest to avoid having to allocate more memory. Seems to work. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/if_wg.c')
-rw-r--r--src/if_wg.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index 01888f9..095a4f3 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -634,11 +634,7 @@ wg_aip_lookup(struct wg_softc *sc, sa_family_t af, void *a)
node = root->rnh_matchaddr(&addr, &root->rh);
if (node != NULL) {
peer = ((struct wg_aip *)node)->a_peer;
- /* If we have a remote, we should take a reference. The only
- * cases where we don't have a remote is in the allowedips
- * selftest. */
- if (peer->p_remote != NULL)
- noise_remote_ref(peer->p_remote);
+ noise_remote_ref(peer->p_remote);
} else {
peer = NULL;
}