diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-24 12:51:12 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-24 12:58:12 -0400 |
commit | 229840974084340dab14fd8b12c4c72b6e8072c0 (patch) | |
tree | 8523a13d6e6da64933b4866265a4d40722393571 /src/selftest | |
parent | if_wg: ensure peer lifetime (diff) | |
download | wireguard-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.c | 2 |
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; } |