diff options
author | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-20 08:55:08 +1000 |
---|---|---|
committer | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-20 10:52:36 +1000 |
commit | 0fa8645fe431c29a8d9371679398bf7839bffec1 (patch) | |
tree | 05b69fe7b654c16dc4c9349d7164fb6e8f8c942b /src/if_wg.c | |
parent | if_wg: add missing return parens to follow style(9) (diff) | |
download | wireguard-freebsd-0fa8645fe431c29a8d9371679398bf7839bffec1.tar.xz wireguard-freebsd-0fa8645fe431c29a8d9371679398bf7839bffec1.zip |
wg_noise: lookup both keypair and handshake index at once
Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to 'src/if_wg.c')
-rw-r--r-- | src/if_wg.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/if_wg.c b/src/if_wg.c index c1ebb0c..a64403b 100644 --- a/src/if_wg.c +++ b/src/if_wg.c @@ -1260,7 +1260,6 @@ wg_handshake(struct wg_softc *sc, struct wg_packet *pkt) struct wg_endpoint *e; struct wg_peer *peer; struct mbuf *m; - struct noise_keypair *keypair; struct noise_remote *remote = NULL; int res, underload = 0; static struct timeval wg_last_underload; /* microuptime */ @@ -1353,12 +1352,8 @@ wg_handshake(struct wg_softc *sc, struct wg_packet *pkt) cook = mtod(m, struct wg_pkt_cookie *); if ((remote = noise_remote_index_lookup(sc->sc_local, cook->r_idx)) == NULL) { - if ((keypair = noise_keypair_lookup(sc->sc_local, cook->r_idx)) == NULL) { - DPRINTF(sc, "Unknown cookie index\n"); - goto error; - } - remote = noise_keypair_remote(keypair); - noise_keypair_put(keypair); + DPRINTF(sc, "Unknown cookie index\n"); + goto error; } peer = noise_remote_arg(remote); |