From 666623a82e32f82e9c165bffc691a21b4d47e739 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 24 Jan 2017 04:11:56 +0100 Subject: [PATCH] wg: setconf should remove existing psk Signed-off-by: Jason A. Donenfeld --- src/config.c | 3 +++ 1 file changed, 3 insertions(+) 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");