aboutsummaryrefslogtreecommitdiffstats
path: root/src/selftest
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/selftest
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/selftest')
-rw-r--r--src/selftest/allowedips.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/selftest/allowedips.c b/src/selftest/allowedips.c
index 294bb19..889118a 100644
--- a/src/selftest/allowedips.c
+++ b/src/selftest/allowedips.c
@@ -233,6 +233,7 @@ static bool randomized_test(void)
}
LIST_INIT(&peers[i]->p_aips);
peers[i]->p_aips_num = 0;
+ peers[i]->p_remote = (struct noise_remote *)peers[i];
}
if (!test_aip_init(&sc)) {
@@ -389,6 +390,7 @@ static struct wg_peer *init_peer(void)
return NULL;
LIST_INIT(&peer->p_aips);
peer->p_aips_num = 0;
+ peer->p_remote = (struct noise_remote *)peer; // Kind of dangerous, but probably fine.
return peer;
}