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

Merge branch 'test' into ipq60xx

This commit is contained in:
suyuan 2023-04-03 02:54:19 +08:00
commit ce6d8c011c
6 changed files with 76 additions and 9 deletions

View file

@ -258,6 +258,8 @@ function wizard_add()
end
-- Set interfaces settings
local downloadmax = 0
local uploadmax = 0
local interfaces = luci.http.formvaluetable("intf")
for intf, _ in pairs(interfaces) do
local label = luci.http.formvalue("cbid.network.%s.label" % intf) or ""
@ -462,6 +464,7 @@ function wizard_add()
end
ucic:set("network",intf,"downloadspeed",downloadspeed)
ucic:set("qos",intf,"download",math.ceil(downloadspeed*95/100))
downloadmax = downloadmax + tonumber(downloadspeed)
else
ucic:delete("network",intf,"downloadspeed")
ucic:set("sqm",intf,"download","0")
@ -477,6 +480,7 @@ function wizard_add()
end
ucic:set("network",intf,"uploadspeed",uploadspeed)
ucic:set("qos",intf,"upload",math.ceil(uploadspeed*95/100))
uploadmax = uploadmax + tonumber(uploadspeed)
else
ucic:delete("network",intf,"uploadspeed")
ucic:set("sqm",intf,"upload","0")
@ -547,6 +551,14 @@ function wizard_add()
vpn_intf = "bonding-omrvpn"
ucic:set("network","omrvpn","proto","bonding")
end
if downloadmax ~= 0 and uploadmax ~= 0 then
ucic:set("sqm","omrvpn","max_download",downloadmax)
ucic:set("sqm","omrvpn","max_upload",uploadmax)
ucic:set("sqm","omrvpn","download",math.ceil(downloadmax*50/100))
ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
end
if vpn_intf ~= "" then
ucic:set("network","omrvpn","device",vpn_intf)
ucic:set("sqm","omrvpn","interface",vpn_intf)

View file

@ -347,6 +347,12 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
statusMessageClass = "warning";
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
}
if (mArray.openmptcprouter.kernel_match == false)
{
statusMessage += '<%:MPTCP kernel on router and VPS doesn't match%>' + '<br/>';
statusMessageClass = "warning";
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
}
if (mArray.openmptcprouter.wan_addr6)
{
content += '<%:IPv6:%>' + " " + mArray.openmptcprouter.wan_addr6;

View file

@ -761,6 +761,7 @@ function interfaces_status()
mArray.openmptcprouter["local_addr"] = ipaddr
--mArray.openmptcprouter["local_addr"] = uci:get("network", "lan", "ipaddr")
mArray.openmptcprouter["hostname"] = "OpenMPTCProuter"
mArray.openmptcprouter["kernel"] = sys.exec("uname -r")
ucic:foreach("system", "system", function(s)
mArray.openmptcprouter["hostname"] = uci:get("system",s[".name"],"hostname") or "OpenMPTCProuter"
end)
@ -955,6 +956,12 @@ function interfaces_status()
end
end)
mArray.openmptcprouter["kernel_match"] = true
if mArray.openmptcprouter["vps_kernel"] ~= "" then
if mArray.openmptcprouter["kernel"]:sub(1,3) == "5.4" and mArray.openmptcprouter["vps_kernel"]:sub(1,3) ~= "5.4" then
mArray.openmptcprouter["kernel_match"] = false
end
end
if mArray.openmptcprouter["vps_hostname"] == "" then
mArray.openmptcprouter["vps_hostname"] = "Server"