From a6dc75428c1e3a47700b5c164a16385b5c640b48 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 6 Dec 2019 15:28:36 +0100 Subject: [PATCH 1/3] mwan3: switch to procd init script This enables the procd handling for mwan3 on config change. Signed-off-by: Florian Eckert --- net/mwan3/files/etc/init.d/mwan3 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/net/mwan3/files/etc/init.d/mwan3 b/net/mwan3/files/etc/init.d/mwan3 index 2dccef363..af750e55e 100755 --- a/net/mwan3/files/etc/init.d/mwan3 +++ b/net/mwan3/files/etc/init.d/mwan3 @@ -1,20 +1,28 @@ #!/bin/sh /etc/rc.common START=19 - -reload() { - /usr/sbin/mwan3 restart -} +USE_PROCD=1 boot() { . /lib/config/uci.sh uci_toggle_state mwan3 globals enabled "1" + mwan3_boot=1 + rc_procd start_service +} + +reload_service() { + /usr/sbin/mwan3 restart } -start() { +start_service() { + [ -n "${mwan3_boot}" ] && return 0 /usr/sbin/mwan3 start } -stop() { +stop_service() { /usr/sbin/mwan3 stop } + +service_triggers() { + procd_add_reload_trigger 'mwan3' +} From e30f16beef36259c30223fc9986120f176f404ce Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 23 Jan 2020 10:24:19 +0100 Subject: [PATCH 2/3] mwan3: set status to unknown in rpcd if status file not found If the status file is not found then set then return the value unknown. Signed-off-by: Florian Eckert --- net/mwan3/files/usr/libexec/rpcd/mwan3 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/mwan3/files/usr/libexec/rpcd/mwan3 b/net/mwan3/files/usr/libexec/rpcd/mwan3 index b8b55212a..33e3e0284 100755 --- a/net/mwan3/files/usr/libexec/rpcd/mwan3 +++ b/net/mwan3/files/usr/libexec/rpcd/mwan3 @@ -77,7 +77,7 @@ get_mwan3_status() { local online=0 local offline=0 local up="0" - local enabled pid device time_p time_n time_u time_d + local enabled pid device time_p time_n time_u time_d status network_get_device device $1 @@ -111,6 +111,12 @@ get_mwan3_status() { 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="unknown" + fi + json_add_object "${iface}" json_add_int age "$age" json_add_int online "${online}" @@ -119,7 +125,7 @@ get_mwan3_status() { json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")" json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")" json_add_int "turn" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TURN")" - json_add_string "status" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS")" + json_add_string "status" "${status}" json_add_boolean "enabled" "${enabled}" json_add_boolean "running" "${running}" json_add_boolean "up" "${up}" From 8030814267746ca0c09c74e23a0d9bf0877277fa Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 17 Jun 2020 13:04:38 +0200 Subject: [PATCH 3/3] mwan3: update version to 2.8.7 Signed-off-by: Florian Eckert --- net/mwan3/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 8c7e849f6..c78df6221 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.8.6 +PKG_VERSION:=2.8.7 PKG_RELEASE:=1 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPL-2.0