net/mwan3-luci: fix iface_state on on status page

Since commit 4739584c24 the status of the
interface is not reported correctly anymore. To fix this issue do not test
if the routing table is presented use instead the "/var/run/iface_state/[iface]"
to get the interface state because the routing table will not get deleted
anymore if the interface is offline.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2017-10-25 13:46:15 +02:00
parent 58a1a733e5
commit 78acfcc7ed
2 changed files with 3 additions and 2 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-mwan3
PKG_VERSION:=1.4
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
PKG_LICENSE:=GPLv2

View File

@ -65,7 +65,8 @@ end
function getInterfaceStatus(ruleNumber, interfaceName)
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then
if ut.trim(sys.exec(ip .. "route list table " .. ruleNumber)) ~= "" then
local fs = require "nixio.fs"
if fs.readfile("/var/run/mwan3/iface_state/%s" % interfaceName) == "online" then
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then
return "online"
else