Browse Source

Merge pull request #12533 from TDT-AG/pr/20200617-mwan3

mwan3: improvements
lilik-openwrt-22.03
Florian Eckert 5 years ago
committed by GitHub
parent
commit
6afcb0d0e0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 9 deletions
  1. +1
    -1
      net/mwan3/Makefile
  2. +14
    -6
      net/mwan3/files/etc/init.d/mwan3
  3. +8
    -2
      net/mwan3/files/usr/libexec/rpcd/mwan3

+ 1
- 1
net/mwan3/Makefile View File

@ -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


+ 14
- 6
net/mwan3/files/etc/init.d/mwan3 View File

@ -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'
}

+ 8
- 2
net/mwan3/files/usr/libexec/rpcd/mwan3 View File

@ -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}"


Loading…
Cancel
Save