]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: add intentionally undocumented userspace implementation knob
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 May 2018 02:12:02 +0000 (04:12 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 May 2018 02:25:42 +0000 (04:25 +0200)
This knob might disappear at some point, and we don't want to encourage
its use, so it's not being documented, but this should help with
development of new implementations.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/darwin.bash
src/wg-quick/linux.bash

index 4a3240c27fd5a0f82fcf94516b841ce91995e173..0eef3d94c35eeb196ade9d55ddd61477b8e0e3bc 100755 (executable)
@@ -101,7 +101,7 @@ get_real_interface() {
 add_if() {
        export WG_DARWIN_UTUN_NAME_FILE="/var/run/wireguard/$INTERFACE.name"
        mkdir -m 0700 -p "/var/run/wireguard/"
-       cmd wireguard-go utun
+       cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" utun
        get_real_interface
 }
 
index 38ccad239c462ba0eeed0826d120d2292396dd1a..9139e7f68ea06583db607ee871f53cf9d9d3a8db 100755 (executable)
@@ -86,9 +86,9 @@ add_if() {
        local ret
        if ! cmd ip link add "$INTERFACE" type wireguard; then
                ret=$?
-               [[ -e /sys/module/wireguard ]] || ! command -v wireguard-go >/dev/null && return $ret
+               [[ -e /sys/module/wireguard ]] || ! command -v "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" >/dev/null && exit $ret
                echo "[!] Missing WireGuard kernel module. Falling back to slow userspace implementation."
-               cmd wireguard-go "$INTERFACE"
+               cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" "$INTERFACE"
        fi
 }