From 1732e66a168613bc9c6755f211b273fa25eca6df Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sun, 7 Jul 2019 21:47:00 +0200 Subject: [PATCH] Fix display multipath state --- .../luasrc/controller/openmptcprouter.lua | 11 +++++++++++ .../luasrc/view/openmptcprouter/wanstatus.htm | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index ed66d65c8..181e4c07f 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -990,6 +990,17 @@ function interfaces_status() connectivity = "ERROR" end local current_multipath_state = ut.trim(sys.exec("multipath " .. ifname)) + if test_current_multipath_state == ifname .. " is deactivated" then + current_multipath_state = "off" + elseif test_current_multipath_state == ifname .. " is in default mode" then + current_multipath_state = "on" + elseif test_current_multipath_state == ifname .. " is in backup mode" then + current_multipath_state = "backup" + elseif test_current_multipath_state == ifname .. " is in handover mode" then + current_multipath_state = "handover" + else + current_multipath_state = "" + end if ipaddr == "" and ifname ~= nil then ipaddr = ut.trim(sys.exec("ip -4 -br addr ls dev " .. ifname .. " | awk -F'[ /]+' '{print $3}' | tr -d '\n'")) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm index e51c2d2d6..8bb664719 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm @@ -413,7 +413,7 @@ statusMessage += 'Multipath master already defined
'; statusMessageClass = "error"; } - if(multipath !== multipath_state) + if(multipath !== multipath_state && multipath !== 'master' && multipath_state !== 'on') { statusMessage += 'Multipath current state is ' + multipath_state + '
'; statusMessageClass = "error";