-/* $OpenBSD: if_wg.c,v 1.14 2020/09/01 19:06:59 tb Exp $ */
+/* $OpenBSD: if_wg.c,v 1.15 2021/01/25 09:11:36 yasuoka Exp $ */
/*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
/* Peer must have public key */
if (!(peer_o.p_flags & WG_PEER_HAS_PUBLIC))
- continue;
+ goto next_peer;
/* 0 = latest protocol, 1 = this protocol */
if (peer_o.p_protocol_version != 0) {
/* Get local public and check that peer key doesn't match */
if (noise_local_keys(&sc->sc_local, public, NULL) == 0 &&
bcmp(public, peer_o.p_public, WG_KEY_SIZE) == 0)
- continue;
+ goto next_peer;
/* Lookup peer, or create if it doesn't exist */
if ((peer = wg_peer_lookup(sc, peer_o.p_public)) == NULL) {
* Also, don't create a new one if we only want to
* update. */
if (peer_o.p_flags & (WG_PEER_REMOVE|WG_PEER_UPDATE))
- continue;
+ goto next_peer;
if ((peer = wg_peer_create(sc,
peer_o.p_public)) == NULL) {
/* Remove peer and continue if specified */
if (peer_o.p_flags & WG_PEER_REMOVE) {
wg_peer_destroy(peer);
- continue;
+ goto next_peer;
}
if (peer_o.p_flags & WG_PEER_HAS_ENDPOINT)
}
peer_p = (struct wg_peer_io *)aip_p;
+ continue;
+next_peer:
+ aip_p = &peer_p->p_aips[0];
+ aip_p += peer_o.p_aips_count;
+ peer_p = (struct wg_peer_io *)aip_p;
}
error: