1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Check if a network interface is not used multiple times

This commit is contained in:
Ycarus 2018-10-12 10:49:56 +02:00
parent 8d414c5d8b
commit 406d2ca0e2
2 changed files with 18 additions and 2 deletions

View file

@ -32,7 +32,6 @@ function interface_from_device(dev)
return ""
end
function wizard_add()
local add_interface = luci.http.formvalue("add_interface") or ""
local add_interface_ifname = luci.http.formvalue("add_interface_ifname") or ""
@ -650,6 +649,7 @@ function interfaces_status()
-- overview status
mArray.wans = {}
mArray.tunnels = {}
allintf = {}
uci:foreach("network", "interface", function (section)
local interface = section[".name"]
@ -667,7 +667,16 @@ function interfaces_status()
if ifname == "" then
ifname = get_device(interface)
end
duplicateif = false
if ifname ~= "" and ifname ~= nil then
if allintf[ifname] then
connectivity = "ERROR"
duplicateif = true
else
allintf[ifname] = true
end
end
--if multipath == "off" and not ifname:match("^tun.*") then return end
if multipath == "off" then return end
@ -825,6 +834,7 @@ function interfaces_status()
server_ping = server_ping,
ipv6_discover = ipv6_discover,
multipath_available = multipath_available,
duplicateif = duplicateif,
}
if ifname ~= nil and ifname:match("^tun.*") then

View file

@ -226,6 +226,7 @@
var server_ping = mArray.wans[i].server_ping;
var ipv6_discover = mArray.wans[i].ipv6_discover;
var multipath_available = mArray.wans[i].multipath_available;
var duplicateif = mArray.wans[i].duplicateif;
// Generate template
if(mArray.openmptcprouter.remote_from_lease == true && mArray.wans.length == 1)
{
@ -277,6 +278,11 @@
statusMessage += 'Multipath master already defined<br />';
statusMessageClass = "error";
}
if(duplicateif)
{
statusMessage += 'Network interface duplicated<br />';
statusMessageClass = "error";
}
if(ipv6_discover == 'DETECTED')
{
statusMessage += 'IPv6 route received<br />'