1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 19:11:51 +00:00
openmptcprouter-feeds/luci-app-mptcp/luasrc/model/cbi/mptcp.lua

141 lines
6.2 KiB
Lua
Raw Normal View History

2018-03-21 16:30:44 +00:00
local net = require "luci.model.network".init()
local sys = require "luci.sys"
local ifaces = sys.net:devices()
local m, s, o
2019-04-23 16:27:21 +00:00
local uname = nixio.uname()
2018-03-21 16:30:44 +00:00
2018-07-10 15:36:28 +00:00
m = Map("network", translate("MPTCP"), translate("Networks MPTCP settings. Visit <a href='http://multipath-tcp.org/pmwiki.php/Users/ConfigureMPTCP'>http://multipath-tcp.org/pmwiki.php/Users/ConfigureMPTCP</a> for help."))
2018-03-21 16:30:44 +00:00
2019-04-22 19:49:26 +00:00
local unameinfo = nixio.uname() or { }
2018-03-21 16:30:44 +00:00
s = m:section(TypedSection, "globals")
o = s:option(ListValue, "multipath", translate("Multipath TCP"))
o:value("enable", translate("enable"))
o:value("disable", translate("disable"))
o = s:option(ListValue, "mptcp_checksum", translate("Multipath TCP checksum"))
o:value(1, translate("enable"))
o:value(0, translate("disable"))
if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
o = s:option(ListValue, "mptcp_debug", translate("Multipath Debug"))
o:value(1, translate("enable"))
o:value(0, translate("disable"))
end
o = s:option(ListValue, "mptcp_path_manager", translate("Multipath TCP path-manager"), translate("Default is fullmesh"))
o:value("default", translate("default"))
o:value("fullmesh", "fullmesh")
2023-01-09 19:06:30 +00:00
--if tonumber(uname.release:sub(1,4)) <= 5.15 then
2023-07-21 19:40:19 +00:00
if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
2021-08-30 19:51:02 +00:00
o:value("ndiffports", "ndiffports")
o:value("binder", "binder")
if uname.release:sub(1,4) ~= "4.14" then
o:value("netlink", translate("Netlink"))
2021-08-30 19:51:02 +00:00
end
2019-04-22 19:49:26 +00:00
end
o = s:option(ListValue, "mptcp_scheduler", translate("Multipath TCP scheduler"))
o:value("default", translate("default"))
2023-01-09 19:06:30 +00:00
-- if tonumber(uname.release:sub(1,4)) <= 5.15 then
2023-07-21 19:40:19 +00:00
if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
2021-08-30 19:51:02 +00:00
o:value("roundrobin", "round-robin")
o:value("redundant", "redundant")
if uname.release:sub(1,4) ~= "4.14" then
o:value("blest", "BLEST")
o:value("ecf", "ECF")
2021-08-30 19:51:02 +00:00
end
end
2023-01-09 19:06:30 +00:00
-- if tonumber(uname.release:sub(1,4)) <= 5.15 then
2023-07-21 19:40:19 +00:00
if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
2021-08-30 19:51:02 +00:00
o = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SYN retries"))
o.datatype = "uinteger"
o.rmempty = false
2019-04-22 19:49:26 +00:00
end
2023-01-09 19:06:30 +00:00
-- if tonumber(uname.release:sub(1,4)) <= 5.15 then
2023-07-21 19:40:19 +00:00
if uname.release:sub(1,4) ~= "5.15" and uname.release:sub(1,1) ~= "6" then
o = s:option(ListValue, "mptcp_version", translate("Multipath TCP version"))
o:value(0, translate("0"))
o:value(1, translate("1"))
2022-02-18 07:28:39 +00:00
o.default = 0
end
o = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is cubic"))
local availablecong = sys.exec("sysctl -n net.ipv4.tcp_available_congestion_control | xargs -n1 | sort | xargs")
2018-03-21 16:30:44 +00:00
for cong in string.gmatch(availablecong, "[^%s]+") do
o:value(cong, translate(cong))
2018-03-21 16:30:44 +00:00
end
2018-06-08 17:07:53 +00:00
2023-01-09 19:06:30 +00:00
-- if tonumber(uname.release:sub(1,4)) >= 5.15 then
if uname.release:sub(1,4) == "5.15" or uname.release:sub(1,1) == "6" then
if uname.release:sub(1,1) == "6" then
-- Only available since 5.19
o = s:option(ListValue, "mptcp_pm_type", translate("Path Manager type"))
o:value(0, translate("In-kernel path manager"))
o:value(1, translate("Userspace path manager"))
o.default = 0
end
o = s:option(Value, "mptcp_subflows", translate("Max subflows"),translate("specifies the maximum number of additional subflows allowed for each MPTCP connection"))
2021-08-30 19:51:02 +00:00
o.datatype = "uinteger"
o.rmempty = false
o.default = 3
o = s:option(Value, "mptcp_stale_loss_cnt", translate("Retranmission intervals"),translate("The number of MPTCP-level retransmission intervals with no traffic and pending outstanding data on a given subflow required to declare it stale. A low stale_loss_cnt value allows for fast active-backup switch-over, an high value maximize links utilization on edge scenarios e.g. lossy link with high BER or peer pausing the data processing."))
2021-08-30 19:51:02 +00:00
o.datatype = "uinteger"
o.rmempty = false
o.default = 4
o = s:option(Value, "mptcp_add_addr_accepted", translate("Max add address"),translate("specifies the maximum number of ADD_ADDR (add address) suboptions accepted for each MPTCP connection"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
o = s:option(Value, "mptcp_add_addr_timeout", translate("Control message timeout"),translate("Set the timeout after which an ADD_ADDR (add address) control message will be resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message."))
o.datatype = "uinteger"
o.rmempty = false
o.default = 120
2021-08-30 19:51:02 +00:00
else
o = s:option(Value, "mptcp_fullmesh_num_subflows", translate("Fullmesh subflows for each pair of IP addresses"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
--o:depends("mptcp_path_manager","fullmesh")
2021-08-30 19:51:02 +00:00
o = s:option(ListValue, "mptcp_fullmesh_create_on_err", translate("Re-create fullmesh subflows after a timeout"))
o:value(1, translate("enable"))
o:value(0, translate("disable"))
--o:depends("mptcp_path_manager","fullmesh")
2021-08-30 19:51:02 +00:00
o = s:option(Value, "mptcp_ndiffports_num_subflows", translate("ndiffports subflows number"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
--o:depends("mptcp_path_manager","ndiffports")
2021-08-30 19:51:02 +00:00
o = s:option(ListValue, "mptcp_rr_cwnd_limited", translate("Fill the congestion window on all subflows for round robin"))
o:value("Y", translate("enable"))
o:value("N", translate("disable"))
o.default = "Y"
--o:depends("mptcp_scheduler","roundrobin")
2021-08-30 19:51:02 +00:00
o = s:option(Value, "mptcp_rr_num_segments", translate("Consecutive segments that should be sent for round robin"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
--o:depends("mptcp_scheduler","roundrobin")
end
2018-03-21 16:30:44 +00:00
s = m:section(TypedSection, "interface", translate("Interfaces Settings"))
function s.filter(self, section)
return not section:match("^oip.*") and not section:match("^lo.*") and section ~= "omrvpn" and section ~= "omr6in4"
end
o = s:option(ListValue, "multipath", translate("Multipath TCP"), translate("One interface must be set as master"))
o:value("on", translate("enabled"))
o:value("off", translate("disabled"))
o:value("master", translate("master"))
o:value("backup", translate("backup"))
--o:value("handover", translate("handover"))
o.default = "off"
2018-03-21 16:30:44 +00:00
return m