]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: setconf should remove existing psk
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 24 Jan 2017 03:11:56 +0000 (04:11 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 7 Feb 2017 11:21:22 +0000 (12:21 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/config.c

index ddeec1556ea072c21066bf62d9d632db1c31f98e..e6db6ad475f3d32c97d2716bd9afa8e12bade440 100644 (file)
@@ -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");