1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix multipath status display

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-07-13 23:23:01 +02:00
parent ee769a4eca
commit 46903d6b6a
2 changed files with 21 additions and 12 deletions

View file

@ -997,13 +997,13 @@ function interfaces_status()
connectivity = "ERROR" connectivity = "ERROR"
end end
local current_multipath_state = ut.trim(sys.exec("multipath " .. ifname)) local current_multipath_state = ut.trim(sys.exec("multipath " .. ifname))
if test_current_multipath_state == ifname .. " is deactivated" then if string.find(test_current_multipath_state,"deactivated") then
current_multipath_state = "off" current_multipath_state = "off"
elseif test_current_multipath_state == ifname .. " is in default mode" then elseif string.find(test_current_multipath_state,"default") then
current_multipath_state = "on" current_multipath_state = "on"
elseif test_current_multipath_state == ifname .. " is in backup mode" then elseif string.find(test_current_multipath_state,"backup") then
current_multipath_state = "backup" current_multipath_state = "backup"
elseif test_current_multipath_state == ifname .. " is in handover mode" then elseif string.find(test_current_multipath_state,"handover") then
current_multipath_state = "handover" current_multipath_state = "handover"
else else
current_multipath_state = "" current_multipath_state = ""

View file

@ -408,16 +408,25 @@
statusMessage += 'Wan IP and gateway are identical<br />'; statusMessage += 'Wan IP and gateway are identical<br />';
statusMessageClass = "error"; statusMessageClass = "error";
} }
if(multipath == 'master' && master > 1) if(multipath == 'master')
{
if (master > 1)
{ {
statusMessage += 'Multipath master already defined<br />'; statusMessage += 'Multipath master already defined<br />';
statusMessageClass = "error"; statusMessageClass = "error";
} }
if(multipath !== multipath_state && multipath !== 'master' && multipath_state !== 'on') if(multipath_state !== 'on' && multipath_state !== '')
{ {
statusMessage += 'Multipath current state is ' + multipath_state + '<br />'; statusMessage += 'Multipath current state is ' + multipath_state + '<br />';
statusMessageClass = "error"; statusMessageClass = "error";
} }
} else {
if(multipath !== multipath_state && multipath_state !== '')
{
statusMessage += 'Multipath current state is ' + multipath_state + '<br />';
statusMessageClass = "error";
}
}
if(duplicateif) if(duplicateif)
{ {
statusMessage += 'Network interface duplicated<br />'; statusMessage += 'Network interface duplicated<br />';