diff options
author | 2025-06-19 16:58:39 +0200 | |
---|---|---|
committer | 2025-06-19 17:08:50 +0200 | |
commit | 0b7d9821f2815973a2930ace28a3f73c205d0e5c (patch) | |
tree | a303913e99e623346e458199bf00b1bf97719221 | |
parent | wg-quick: linux: deal with resolvconf migration more gracefully (diff) | |
download | wireguard-tools-master.tar.xz wireguard-tools-master.zip |
The example in the man page at some point changed:
- \fBPostUp = wg set %i private-key <(pass WireGuard/private-keys/%i)\fP
+ \fBPreUp = wg set %i private-key <(pass WireGuard/private-keys/%i)\fP
This is actually wrong because PreUp is followed by set_config(), which
calls `wg setconf`, which in turn deletes the private key from the
interface because it is missing from the configuration. Replacing this
with `wg addconf` is safe to do because the interface is newly created.
Suggested-by: Matthias Dressel <code@deadcode.eu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/wg-quick/android.c | 2 | ||||
-rwxr-xr-x | src/wg-quick/darwin.bash | 2 | ||||
-rwxr-xr-x | src/wg-quick/freebsd.bash | 2 | ||||
-rwxr-xr-x | src/wg-quick/linux.bash | 2 | ||||
-rwxr-xr-x | src/wg-quick/openbsd.bash | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/wg-quick/android.c b/src/wg-quick/android.c index 1263ee4..3ed05e5 100644 --- a/src/wg-quick/android.c +++ b/src/wg-quick/android.c @@ -1047,7 +1047,7 @@ static void set_routes(const char *iface, unsigned int netid) static void set_config(const char *iface, const char *config) { FILE *config_writer; - _cleanup_free_ char *cmd = concat("wg setconf ", iface, " /proc/self/fd/0", NULL); + _cleanup_free_ char *cmd = concat("wg addconf ", iface, " /proc/self/fd/0", NULL); int ret; printf("[#] %s\n", cmd); diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash index ed6aada..1b7fe5e 100755 --- a/src/wg-quick/darwin.bash +++ b/src/wg-quick/darwin.bash @@ -370,7 +370,7 @@ add_route() { } set_config() { - cmd wg setconf "$REAL_INTERFACE" <(echo "$WG_CONFIG") + cmd wg addconf "$REAL_INTERFACE" <(echo "$WG_CONFIG") } save_config() { diff --git a/src/wg-quick/freebsd.bash b/src/wg-quick/freebsd.bash index af5b174..aeae18d 100755 --- a/src/wg-quick/freebsd.bash +++ b/src/wg-quick/freebsd.bash @@ -338,7 +338,7 @@ add_route() { } set_config() { - echo "$WG_CONFIG" | cmd wg setconf "$INTERFACE" /dev/stdin + echo "$WG_CONFIG" | cmd wg addconf "$INTERFACE" /dev/stdin } save_config() { diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash index af255af..34fa5f9 100755 --- a/src/wg-quick/linux.bash +++ b/src/wg-quick/linux.bash @@ -249,7 +249,7 @@ add_default() { } set_config() { - cmd wg setconf "$INTERFACE" <(echo "$WG_CONFIG") + cmd wg addconf "$INTERFACE" <(echo "$WG_CONFIG") } save_config() { diff --git a/src/wg-quick/openbsd.bash b/src/wg-quick/openbsd.bash index d12f70e..19b9909 100755 --- a/src/wg-quick/openbsd.bash +++ b/src/wg-quick/openbsd.bash @@ -338,7 +338,7 @@ add_route() { } set_config() { - cmd wg setconf "$REAL_INTERFACE" <(echo "$WG_CONFIG") + cmd wg addconf "$REAL_INTERFACE" <(echo "$WG_CONFIG") } save_config() { |