diff options
author | Florian Eckert <fe@dev.tdt.de> | 2020-06-23 13:18:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 13:18:04 +0200 |
commit | 6afcb0d0e0172dd633ce30bf8fd9c1595638acd2 (patch) | |
tree | f7290c04fe86ca292008e0a244be76c65b946dbd | |
parent | f061f17ebf0a7dce141991fdcc0436be5e3d6a3b (diff) | |
parent | 8030814267746ca0c09c74e23a0d9bf0877277fa (diff) |
Merge pull request #12533 from TDT-AG/pr/20200617-mwan3
mwan3: improvements
-rw-r--r-- | net/mwan3/Makefile | 2 | ||||
-rwxr-xr-x | net/mwan3/files/etc/init.d/mwan3 | 20 | ||||
-rwxr-xr-x | net/mwan3/files/usr/libexec/rpcd/mwan3 | 10 |
3 files changed, 23 insertions, 9 deletions
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 <fe@dev.tdt.de> PKG_LICENSE:=GPL-2.0 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' +} 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}" |