mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
Check if a network interface is not used multiple times
This commit is contained in:
parent
8d414c5d8b
commit
406d2ca0e2
2 changed files with 18 additions and 2 deletions
|
@ -32,7 +32,6 @@ function interface_from_device(dev)
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function wizard_add()
|
function wizard_add()
|
||||||
local add_interface = luci.http.formvalue("add_interface") or ""
|
local add_interface = luci.http.formvalue("add_interface") or ""
|
||||||
local add_interface_ifname = luci.http.formvalue("add_interface_ifname") or ""
|
local add_interface_ifname = luci.http.formvalue("add_interface_ifname") or ""
|
||||||
|
@ -650,6 +649,7 @@ function interfaces_status()
|
||||||
-- overview status
|
-- overview status
|
||||||
mArray.wans = {}
|
mArray.wans = {}
|
||||||
mArray.tunnels = {}
|
mArray.tunnels = {}
|
||||||
|
allintf = {}
|
||||||
|
|
||||||
uci:foreach("network", "interface", function (section)
|
uci:foreach("network", "interface", function (section)
|
||||||
local interface = section[".name"]
|
local interface = section[".name"]
|
||||||
|
@ -667,6 +667,15 @@ function interfaces_status()
|
||||||
if ifname == "" then
|
if ifname == "" then
|
||||||
ifname = get_device(interface)
|
ifname = get_device(interface)
|
||||||
end
|
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" and not ifname:match("^tun.*") then return end
|
||||||
if multipath == "off" then return end
|
if multipath == "off" then return end
|
||||||
|
@ -825,6 +834,7 @@ function interfaces_status()
|
||||||
server_ping = server_ping,
|
server_ping = server_ping,
|
||||||
ipv6_discover = ipv6_discover,
|
ipv6_discover = ipv6_discover,
|
||||||
multipath_available = multipath_available,
|
multipath_available = multipath_available,
|
||||||
|
duplicateif = duplicateif,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ifname ~= nil and ifname:match("^tun.*") then
|
if ifname ~= nil and ifname:match("^tun.*") then
|
||||||
|
|
|
@ -226,6 +226,7 @@
|
||||||
var server_ping = mArray.wans[i].server_ping;
|
var server_ping = mArray.wans[i].server_ping;
|
||||||
var ipv6_discover = mArray.wans[i].ipv6_discover;
|
var ipv6_discover = mArray.wans[i].ipv6_discover;
|
||||||
var multipath_available = mArray.wans[i].multipath_available;
|
var multipath_available = mArray.wans[i].multipath_available;
|
||||||
|
var duplicateif = mArray.wans[i].duplicateif;
|
||||||
// Generate template
|
// Generate template
|
||||||
if(mArray.openmptcprouter.remote_from_lease == true && mArray.wans.length == 1)
|
if(mArray.openmptcprouter.remote_from_lease == true && mArray.wans.length == 1)
|
||||||
{
|
{
|
||||||
|
@ -277,6 +278,11 @@
|
||||||
statusMessage += 'Multipath master already defined<br />';
|
statusMessage += 'Multipath master already defined<br />';
|
||||||
statusMessageClass = "error";
|
statusMessageClass = "error";
|
||||||
}
|
}
|
||||||
|
if(duplicateif)
|
||||||
|
{
|
||||||
|
statusMessage += 'Network interface duplicated<br />';
|
||||||
|
statusMessageClass = "error";
|
||||||
|
}
|
||||||
if(ipv6_discover == 'DETECTED')
|
if(ipv6_discover == 'DETECTED')
|
||||||
{
|
{
|
||||||
statusMessage += 'IPv6 route received<br />'
|
statusMessage += 'IPv6 route received<br />'
|
||||||
|
|
Loading…
Reference in a new issue