diff options
author | Matt Dunwoodie <ncon@noconroy.net> | 2020-05-10 02:06:14 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-05-10 22:10:02 -0600 |
commit | 9eda95d084d72ef7412e1af359242d6839215c48 (patch) | |
tree | d56790fe3bffbc22916fbd578cf6f2c190a3f5b5 /src/wg-quick | |
parent | ipc: cleanup openbsd support (diff) | |
download | wireguard-tools-9eda95d084d72ef7412e1af359242d6839215c48.tar.xz wireguard-tools-9eda95d084d72ef7412e1af359242d6839215c48.zip |
wg-quick: add support for openbsd kernel implementation
Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to 'src/wg-quick')
-rwxr-xr-x | src/wg-quick/openbsd.bash | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/wg-quick/openbsd.bash b/src/wg-quick/openbsd.bash index 9584902..3b90df2 100755 --- a/src/wg-quick/openbsd.bash +++ b/src/wg-quick/openbsd.bash @@ -100,10 +100,25 @@ get_real_interface() { } add_if() { - export WG_TUN_NAME_FILE="/var/run/wireguard/$INTERFACE.name" - mkdir -p "/var/run/wireguard/" - cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" tun - get_real_interface + local index + echo "find wg" | config -e /bsd 2>/dev/null | grep "wg count 1" >/dev/null + if [[ $? == 0 ]]; then + REAL_INTERFACE="" + index=0 + while [[ $REAL_INTERFACE == "" ]]; do + ifconfig wg$index create + if [[ $? == 0 ]]; then + $REAL_INTERFACE="wg$index" + fi + index=$((index+1)) + done + echo "[+] Interface for $INTERFACE is $REAL_INTERFACE" >&2 + else + export WG_TUN_NAME_FILE="/var/run/wireguard/$INTERFACE.name" + mkdir -p "/var/run/wireguard/" + cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" tun + get_real_interface + fi } del_routes() { |