From 0a05dfb6615313ab0b0b8cd9f190e4d3a088694e Mon Sep 17 00:00:00 2001 From: Bapt Abl Date: Wed, 10 Nov 2021 02:32:21 +0100 Subject: [PATCH] Better setting of new_internet_device --- conf/ynh-hotspot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/ynh-hotspot b/conf/ynh-hotspot index 9e4cb52..374c363 100644 --- a/conf/ynh-hotspot +++ b/conf/ynh-hotspot @@ -327,7 +327,7 @@ if [ "$1" != restart ]; then done old_internet_device=$(ynh_setting_get hotspot internet_device) - new_internet_device=$(ip route | awk '/default via/ { print $NF; }') + new_internet_device=$(ip --json route | jq -r '.[] | select(.dst == "default") | .dev') # Switch the NAT interface if there is a VPN ip link show dev tun0 &> /dev/null