mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Merge branch 'test' into develop
This commit is contained in:
commit
6373102163
49 changed files with 3206 additions and 1953 deletions
|
@ -38,10 +38,10 @@ function wizard_add()
|
|||
local gostatus = true
|
||||
|
||||
-- Force WAN zone firewall members to be a list
|
||||
local fwwan = sys.exec("uci -q get firewall.@zone[1].network")
|
||||
luci.sys.call("uci -q delete firewall.@zone[1].network")
|
||||
local fwwan = sys.exec("uci -q get firewall.zone_wan.network")
|
||||
luci.sys.call("uci -q delete firewall.zone_wan.network")
|
||||
for interface in fwwan:gmatch("%S+") do
|
||||
luci.sys.call("uci -q add_list firewall.@zone[1].network=" .. interface)
|
||||
luci.sys.call("uci -q add_list firewall.zone_wan.network=" .. interface)
|
||||
end
|
||||
ucic:save("firewall")
|
||||
|
||||
|
@ -185,7 +185,7 @@ function wizard_add()
|
|||
luci.sys.call("uci -q commit vnstat")
|
||||
|
||||
-- Dirty way to add new interface to firewall...
|
||||
luci.sys.call("uci -q add_list firewall.@zone[1].network=wan" .. i)
|
||||
luci.sys.call("uci -q add_list firewall.zone_wan.network=wan" .. i)
|
||||
luci.sys.call("uci -q commit firewall")
|
||||
|
||||
luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
|
||||
|
@ -217,7 +217,7 @@ function wizard_add()
|
|||
luci.sys.call("uci -q del_list vnstat.@vnstat[-1].interface=" .. defif)
|
||||
end
|
||||
luci.sys.call("uci -q commit vnstat")
|
||||
luci.sys.call("uci -q del_list firewall.@zone[1].network=" .. intf)
|
||||
luci.sys.call("uci -q del_list firewall.zone_wan.network=" .. intf)
|
||||
luci.sys.call("uci -q commit firewall")
|
||||
gostatus = false
|
||||
end
|
||||
|
|
|
@ -455,6 +455,7 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
var multipath_available = mArray.wans[i].multipath_available;
|
||||
var multipath_state = mArray.wans[i].multipath_state;
|
||||
var duplicateif = mArray.wans[i].duplicateif;
|
||||
var duplicatemac = mArray.wans[i].duplicatemac;
|
||||
// Generate template
|
||||
if(mArray.openmptcprouter.remote_from_lease == true && mArray.wans.length == 1)
|
||||
{
|
||||
|
@ -547,12 +548,12 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
if(gateway == '' && gateway6 == '')
|
||||
{
|
||||
statusMessage += '<%:No gateway defined%>' + '<br />';
|
||||
} else if(gw_ping == 'DOWN')
|
||||
} else if(gateway != '' && gw_ping == 'DOWN')
|
||||
{
|
||||
statusMessage += '<%:Gateway DOWN%>' + '<br />';
|
||||
} else if(gw_ping6 == 'DOWN')
|
||||
} else if(gateway6 != '' && gw_ping6 == 'DOWN')
|
||||
{
|
||||
statusMessage += '<%:Gateway DOWN%>' + '<br />';
|
||||
statusMessage += '<%:Gateway IPv6 DOWN%>' + '<br />';
|
||||
} else if(multipath_available == 'ERROR')
|
||||
{
|
||||
statusMessage += '<%:Multipath seems to be blocked on the connection%>' + '<br />';
|
||||
|
@ -566,7 +567,7 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if (stat == 'Offline' && ip6addr != '' && ipaddr == mArray.wans[i].gateway6)
|
||||
if (stat == 'Offline' && ip6addr != '' && ip6addr == mArray.wans[i].gateway6)
|
||||
{
|
||||
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
|
@ -595,6 +596,11 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusMessage += '<%:Network interface duplicated%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(duplicatemac)
|
||||
{
|
||||
statusMessage += '<%:Network interface MAC address duplicated%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(ipv6_discover == 'DETECTED')
|
||||
{
|
||||
statusMessage += '<%:IPv6 route received%>' + '<br />'
|
||||
|
|
|
@ -372,7 +372,7 @@
|
|||
<%
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifname = iface:name()
|
||||
local firewall_lan = luci.util.trim(luci.sys.exec("uci -q get firewall.@zone[0].network | grep " .. ifname))
|
||||
local firewall_lan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_lan.network | grep " .. ifname))
|
||||
if firewall_lan ~= "" then
|
||||
%>
|
||||
<h3><%=ifname%></h3>
|
||||
|
@ -475,7 +475,7 @@
|
|||
<%
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifname = iface:name()
|
||||
local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.@zone[1].network | grep " .. ifname))
|
||||
local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_wan.network | grep " .. ifname))
|
||||
if firewall_wan ~= "" then
|
||||
|
||||
-- local multipath = uci:get("network",ifname,"multipath")
|
||||
|
@ -943,9 +943,10 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="cbi-page-actions">
|
||||
<div class="cbi-page-actions control-group">
|
||||
<input type="hidden" name="token" value="<%=token%>" />
|
||||
<input class="cbi-button cbi-button-apply" type="submit" value="<%:Save & Apply%>" /> <input class="cbi-button cbi-button-reset" type="button" value="Reset" onclick="location.href='<%=url('admin/system/openmptcprouter/wizard')%>'" />
|
||||
<button class="cbi-button cbi-button-apply"><%:Save & Apply%></button>
|
||||
<button class="cbi-button cbi-button-reset"><%:Reset%></button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">cbi_init();</script>
|
||||
|
|
|
@ -1105,6 +1105,7 @@ function interfaces_status()
|
|||
mArray.wans = {}
|
||||
mArray.tunnels = {}
|
||||
allintf = {}
|
||||
allmac = {}
|
||||
|
||||
uci:foreach("network", "interface", function (section)
|
||||
local interface = section[".name"]
|
||||
|
@ -1117,6 +1118,7 @@ function interfaces_status()
|
|||
local enabled = section["auto"]
|
||||
local proto = section["proto"] or ""
|
||||
local ipv6 = section["ipv6"] or "0"
|
||||
local mac = section ["macaddr"] or ""
|
||||
|
||||
--if not ipaddr or not gateway then return end
|
||||
-- Don't show if0 in the overview
|
||||
|
@ -1140,6 +1142,16 @@ function interfaces_status()
|
|||
end
|
||||
end
|
||||
|
||||
duplicatemac = false
|
||||
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
|
||||
if allmac[mac] then
|
||||
connectivity = "ERROR"
|
||||
duplicatemac = true
|
||||
else
|
||||
allmac[mac] = true
|
||||
end
|
||||
end
|
||||
|
||||
--if multipath == "off" and not ifname:match("^tun.*") then return end
|
||||
if multipath == "off" then return end
|
||||
|
||||
|
@ -1237,7 +1249,7 @@ function interfaces_status()
|
|||
if gateway ~= "" then
|
||||
local gw_ping_test = ""
|
||||
if ifname ~= "" and ifname ~= nil then
|
||||
gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 -I " .. ifname .. " " .. gateway .. " | grep '100% packet loss'"))
|
||||
gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 -B -I " .. ifname .. " " .. gateway .. " | grep '100% packet loss'"))
|
||||
else
|
||||
gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway .. " | grep '100% packet loss'"))
|
||||
end
|
||||
|
@ -1247,11 +1259,13 @@ function interfaces_status()
|
|||
connectivity = "WARNING"
|
||||
end
|
||||
end
|
||||
else
|
||||
gw_ping = "DOWN"
|
||||
end
|
||||
if gateway6 ~= "" then
|
||||
local gw_ping6_test = ""
|
||||
if ifname ~= "" and ifname ~= nil then
|
||||
gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 -I " .. ifname .. " " .. gateway6 .. " | grep '100% packet loss'"))
|
||||
gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 -B -I " .. ifname .. " " .. gateway6 .. " | grep '100% packet loss'"))
|
||||
else
|
||||
gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway6 .. " | grep '100% packet loss'"))
|
||||
end
|
||||
|
@ -1261,6 +1275,8 @@ function interfaces_status()
|
|||
connectivity = "WARNING"
|
||||
end
|
||||
end
|
||||
else
|
||||
gw_ping6 = "DOWN"
|
||||
end
|
||||
end
|
||||
if uci:get("openmptcprouter", interface, "manufacturer") == "huawei" then
|
||||
|
@ -1346,6 +1362,10 @@ function interfaces_status()
|
|||
multipath_available = "NO CHECK"
|
||||
end
|
||||
|
||||
local zonewan = "NO"
|
||||
if ut.trim(sys.exec("uci -q get firewall.zone_wan.networks | grep '" .. interface .. "'")) ~= "" then
|
||||
zonewan = "OK"
|
||||
end
|
||||
|
||||
-- Detect if WAN get an IPv6
|
||||
local ipv6_discover = "NONE"
|
||||
|
@ -1449,6 +1469,7 @@ function interfaces_status()
|
|||
multipath_available = multipath_available,
|
||||
multipath_state = current_multipath_state,
|
||||
duplicateif = duplicateif,
|
||||
duplicatemac = duplicatemac,
|
||||
signal = signal,
|
||||
operator = operator,
|
||||
phonenumber = phonenumber,
|
||||
|
@ -1457,6 +1478,7 @@ function interfaces_status()
|
|||
proto = proto,
|
||||
rx = rx,
|
||||
tx = tx,
|
||||
zonewan = zonewan,
|
||||
}
|
||||
if ifname ~= nil and ifname:match("^tun.*") then
|
||||
table.insert(mArray.tunnels, data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue