wg-quick: add support for openbsd kernel implementation

Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
This commit is contained in:
Matt Dunwoodie 2020-05-10 02:06:14 -06:00 committed by Jason A. Donenfeld
parent d4a32c97fd
commit 9eda95d084
1 changed files with 19 additions and 4 deletions

View File

@ -100,10 +100,25 @@ get_real_interface() {
}
add_if() {
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() {