net/mwan3-luci: fix iface_state on on status page 5012/head
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 25 Oct 2017 11:46:15 +0000 (13:46 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 11 Dec 2017 14:21:16 +0000 (15:21 +0100)
Since commit 4739584c2434fda6c4f14b0ef3d38fa055352c0e 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>
net/mwan3-luci/Makefile
net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua

index 8c77394da2bbacd2752fea1a00a157f6bc002a5d..fa2a24409aa069be9bab17935df1d407a3b1f902 100644 (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
 
index 3d5a23dd03aa15f71788646e9bbbededf0fac1ce..bec0e6b27aa1c4d758b1203b5c0eb9e88bacdd33 100644 (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