From ab4e62b885488716e6ef905198ce87b2beab29e4 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 8 May 2018 15:43:34 +0200 Subject: [PATCH] net/mwan3: execute only ifup event if l3_device is found Only execute an ifup event with the command "mwan3 ifup " if the l3_device is found in the ubus "network.interface.". Signed-off-by: Florian Eckert --- net/mwan3/files/usr/sbin/mwan3 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index 681f82de30..a0c296f18e 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -1,6 +1,7 @@ #!/bin/sh . /lib/functions.sh +. /usr/share/libubox/jshn.sh . /lib/functions/network.sh . /lib/mwan3/mwan3.sh @@ -42,7 +43,7 @@ ifdown() ifup() { - local device enabled + local device enabled up l3_device config_load mwan3 @@ -60,12 +61,14 @@ ifup() exit 0 } + json_load $(ubus -S call network.interface.$1 status) + json_get_vars up l3_device config_get enabled "$1" enabled 0 - device=$(uci -p /var/state get network.$1.ifname) &> /dev/null - - if [ -n "$device" ] ; then - [ "$enabled" -eq 1 ] && ACTION=ifup INTERFACE=$1 DEVICE=$device /sbin/hotplug-call iface + if [ "$up" -eq 1 ] \ + && [ -n "$l3_device" ] \ + && [ "$enabled" -eq 1 ]; then + ACTION=ifup INTERFACE=$1 DEVICE=$l3_device /sbin/hotplug-call iface fi } -- 2.30.2