From cbc5f0916c3fc6c29ef76a3e0c6c6adf0c2ccb8e Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 3 May 2021 10:51:44 +0200 Subject: [PATCH 1/2] mwna3: fix whitespace Signed-off-by: Florian Eckert --- net/mwan3/files/etc/hotplug.d/iface/15-mwan3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 index e00cbfa5c..c56f73a57 100644 --- a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 +++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 @@ -66,7 +66,7 @@ case "$ACTION" in mwan3_set_iface_hotplug_state $INTERFACE "$status" if [ "$MWAN3_STARTUP" != "init" ]; then mwan3_create_iface_route $INTERFACE $DEVICE - mwan3_set_general_rules + mwan3_set_general_rules [ "$status" = "online" ] && mwan3_set_policies_iptables fi [ "$ACTION" = ifup ] && procd_running mwan3 "track_$INTERFACE" && procd_send_signal mwan3 "track_$INTERFACE" USR2 From f1da872cd47b1602dc3014d6b4ee40cd5f9fe855 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 3 May 2021 10:52:26 +0200 Subject: [PATCH 2/2] mwan3: update ubus status for not tracked interfaces Signed-off-by: Florian Eckert --- net/mwan3/files/usr/libexec/rpcd/mwan3 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/net/mwan3/files/usr/libexec/rpcd/mwan3 b/net/mwan3/files/usr/libexec/rpcd/mwan3 index d4e7adb6f..4c71fa18f 100755 --- a/net/mwan3/files/usr/libexec/rpcd/mwan3 +++ b/net/mwan3/files/usr/libexec/rpcd/mwan3 @@ -96,8 +96,7 @@ get_mwan3_status() { local age=0 local online=0 local offline=0 - local up="0" - local enabled time_p time_n time_u time_d status track_status + local enabled time_p time_n time_u time_d status track_status up uptime if [ "${iface}" != "${iface_select}" ] && [ "${iface_select}" != "" ]; then return @@ -109,15 +108,19 @@ get_mwan3_status() { online=$(get_online_time "$iface") offline=$(get_offline_time "$iface") - local uptime="0" - config_get enabled "$iface" enabled 0 - network_get_uptime uptime "$iface" - network_is_up "$iface" && up="1" - if [ -f "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS" ]; then - status="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS")" + if [ -d "${MWAN3_STATUS_DIR}" ]; then + network_get_uptime uptime "$iface" + network_is_up "$iface" && up="1" + if [ -f "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS" ]; then + status="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS")" + else + status="notracking" + fi else + uptime=0 + up=0 status="unknown" fi