Browse Source

mwan3: set interface unknown to offline

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 6 years ago
parent
commit
10cadcb2af
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      net/mwan3/files/etc/hotplug.d/iface/15-mwan3
  2. +2
    -2
      net/mwan3/files/lib/mwan3/mwan3.sh
  3. +2
    -2
      net/mwan3/files/usr/sbin/mwan3track

+ 1
- 1
net/mwan3/files/etc/hotplug.d/iface/15-mwan3 View File

@ -75,7 +75,7 @@ case "$ACTION" in
else else
$LOG notice "Starting tracker on interface $INTERFACE (${DEVICE:-unknown})" $LOG notice "Starting tracker on interface $INTERFACE (${DEVICE:-unknown})"
mwan3_set_iface_hotplug_state $INTERFACE "offline" mwan3_set_iface_hotplug_state $INTERFACE "offline"
mwan3_track $INTERFACE $DEVICE "unknown" "$src_ip"
mwan3_track $INTERFACE $DEVICE "offline" "$src_ip"
fi fi
mwan3_set_policies_iptables mwan3_set_policies_iptables
mwan3_set_user_rules mwan3_set_user_rules


+ 2
- 2
net/mwan3/files/lib/mwan3/mwan3.sh View File

@ -1112,7 +1112,7 @@ mwan3_set_iface_hotplug_state() {
mwan3_get_iface_hotplug_state() { mwan3_get_iface_hotplug_state() {
local iface=$1 local iface=$1
cat $MWAN3_STATUS_DIR/iface_state/$iface 2>/dev/null || echo "unknown"
cat $MWAN3_STATUS_DIR/iface_state/$iface 2>/dev/null || echo "offline"
} }
mwan3_report_iface_status() mwan3_report_iface_status()
@ -1135,7 +1135,7 @@ mwan3_report_iface_status()
fi fi
if [ -z "$id" -o -z "$device" ]; then if [ -z "$id" -o -z "$device" ]; then
result="unknown"
result="offline"
elif [ -n "$($IP rule | awk '$1 == "'$(($id+1000)):'"')" ] && \ elif [ -n "$($IP rule | awk '$1 == "'$(($id+1000)):'"')" ] && \
[ -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" ] && \ [ -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" ] && \
[ -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" ] && \ [ -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" ] && \


+ 2
- 2
net/mwan3/files/usr/sbin/mwan3track View File

@ -112,8 +112,8 @@ main() {
local loss=0 local loss=0
local latency=0 local latency=0
if [ "$STATUS" = "unknown" ]; then
echo "unknown" > /var/run/mwan3track/$1/STATUS
if [ "$STATUS" = "offline" ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/UPTIME echo "0" > /var/run/mwan3track/$1/UPTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
score=0 score=0


Loading…
Cancel
Save