From 3371703487ac8f7a45c7b620ef60bdf91595e5bd Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 28 Jun 2019 12:41:17 +0200 Subject: [PATCH] mwan3: rename downtime to offline Rename downtime ubus output from mwan3 to offline. Signed-off-by: Florian Eckert (cherry picked from commit 6c2cd78c6f5015fe24078b98a7455ae0cc88ff07) --- net/mwan3/files/usr/libexec/rpcd/mwan3 | 8 ++++---- net/mwan3/files/usr/sbin/mwan3track | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/mwan3/files/usr/libexec/rpcd/mwan3 b/net/mwan3/files/usr/libexec/rpcd/mwan3 index 51cc6989ed..12a7319b57 100755 --- a/net/mwan3/files/usr/libexec/rpcd/mwan3 +++ b/net/mwan3/files/usr/libexec/rpcd/mwan3 @@ -75,7 +75,7 @@ get_mwan3_status() { local running="0" local age=0 local online=0 - local downtime=0 + local offline=0 local pid device time_p time_n time_u time_d network_get_device device $1 @@ -98,16 +98,16 @@ get_mwan3_status() { let online=time_n-time_u } - time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/DOWNTIME")" + time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")" [ -z "${time_d}" ] || [ "${time_d}" = "0" ] || { time_n="$(get_uptime)" - let downtime=time_n-time_d + let offline=time_n-time_d } json_add_object "${iface}" json_add_int age "$age" json_add_int online "${online}" - json_add_int downtime "${downtime}" + json_add_int offline "${offline}" 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")" diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index a18bbd4c19..5a36922301 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -115,11 +115,11 @@ main() { if [ "$STATUS" = "offline" ]; then echo "offline" > /var/run/mwan3track/$1/STATUS echo "0" > /var/run/mwan3track/$1/ONLINE - echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME + echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE score=0 else echo "online" > /var/run/mwan3track/$1/STATUS - echo "0" > /var/run/mwan3track/$1/DOWNTIME + echo "0" > /var/run/mwan3track/$1/OFFLINE echo "$(get_uptime)" > /var/run/mwan3track/$1/ONLINE env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface fi @@ -260,7 +260,7 @@ main() { if [ "${IFDOWN_EVENT}" -eq 1 ]; then echo "offline" > /var/run/mwan3track/$1/STATUS - echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME + echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE echo "0" > /var/run/mwan3track/$1/ONLINE $LOG notice "Interface $1 ($2) is offline" env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface -- 2.30.2