From: Jason A. Donenfeld Date: Tue, 24 Jan 2017 03:11:56 +0000 (+0100) Subject: wg: setconf should remove existing psk X-Git-Tag: v1.0.20191226~282 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=666623a82e32f82e9c165bffc691a21b4d47e739;p=thirdparty%2Fwireguard-tools.git wg: setconf should remove existing psk Signed-off-by: Jason A. Donenfeld --- diff --git a/src/config.c b/src/config.c index ddeec15..e6db6ad 100644 --- a/src/config.c +++ b/src/config.c @@ -370,6 +370,9 @@ bool config_read_finish(struct config_ctx *ctx) fprintf(stderr, "No private key configured\n"); goto err; } + if (ctx->buf.dev->flags & WGDEVICE_REPLACE_PEERS && !key_is_valid(ctx->buf.dev->preshared_key)) + ctx->buf.dev->flags |= WGDEVICE_REMOVE_PRESHARED_KEY; + for_each_wgpeer(ctx->buf.dev, peer, i) { if (!key_is_valid(peer->public_key)) { fprintf(stderr, "A peer is missing a public key\n");