aboutsummaryrefslogtreecommitdiffstats
path: root/src/if_wg.c
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2021-04-21 01:02:20 +1000
committerMatt Dunwoodie <ncon@noconroy.net>2021-04-21 01:02:55 +1000
commitc493910bda9547436080993fb559b81c29242b99 (patch)
tree9371765b7807bc2d0bdf2dfb35223275422609a3 /src/if_wg.c
parentwg_noise: avoid handshake/keypair type confusion (diff)
downloadwireguard-freebsd-c493910bda9547436080993fb559b81c29242b99.tar.xz
wireguard-freebsd-c493910bda9547436080993fb559b81c29242b99.zip
wg_noise: ensure we check peer count on hashtable insert
Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to 'src/if_wg.c')
-rw-r--r--src/if_wg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index f41878a..5b5e200 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -2152,7 +2152,8 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl)
}
}
if (need_insert) {
- noise_remote_enable(peer->p_remote);
+ if ((err = noise_remote_enable(peer->p_remote)) != 0)
+ goto out;
TAILQ_INSERT_TAIL(&sc->sc_peers, peer, p_entry);
sc->sc_peers_num++;
if (sc->sc_ifp->if_link_state == LINK_STATE_UP)