<%+header%> <% local uci = require("luci.model.uci").cursor() local net = require "luci.model.network".init() local fs = require "nixio.fs" local sys = require "luci.sys" local ut = require "luci.util" local ifaces = sys.net:devices() local ifttyu = nixio.fs.glob("/dev/ttyUSB*") local ifttyc = nixio.fs.glob("/dev/cdc-wdm*") local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'") local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'") menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter" function device_notvirtual(dev) if dev:match("^eth.*") or dev:match("^wwan.*") or dev:match("^tun.*") or dev:match("/") then return true end networks = net:get_networks() for _, iface in ipairs(networks) do local ifacen = iface:name() local ifacename = uci:get("network",ifacen,"device") local ifacetype = uci:get("network",ifacen,"type") or "" local ifaceproto = uci:get("network",ifacen,"proto") or "" --if ifacename == dev and (ifacetype == "macvlan" or ifacetype == "bridge" or ifaceproto == "6in4") then if ifacename == dev and (ifacetype == "macvlan" or ifaceproto == "6in4") then return false end end return true end function splitstring(inputstr, sep) if inputstr == nil then return "" end if sep == nil then sep = "%s" end local t={} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do table.insert(t, str) end return t end alltty = {} iftty = luci.sys.exec("timeout 1 /usr/bin/mmcli -L") for listtty in iftty:gmatch("([^\r\n]*)[\r\n]") do modemid = luci.util.trim(luci.sys.exec("echo '" .. listtty .. "' | awk -F' ' '{print $1}' | awk -F/ '{print $6}'")) if modemid ~= '' then modeminfo = luci.sys.exec("timeout 1 /usr/bin/mmcli -m " .. modemid .. " --output-keyvalue") tty = luci.util.trim(luci.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'")) table.insert(alltty, tty) end end %> <% if stderr and #stderr > 0 then %>
<%=pcdata(stderr)%>
<% end %>

<%:Wizard%>

<%:Server settings%> <% nbserver=0 uci:foreach("openmptcprouter","server", function(s) nbserver=nbserver+1 end) uci:foreach("openmptcprouter","server", function(s) servername = s[".name"] %>

<%=servername%>

" data-optional="false">
<%:Server IP will be set for proxy and VPN%>
" data-optional="false"> " data-optional="false">
<%:Server IP will be set for proxy and VPN%>
<%:A second server's IP can be set for dual IPv4/IPv6 server if WAN IPv6 are set%>

" data-optional="false">
<%:API username to retrieve personnalized settings from the server.%>
" data-optional="false">
<%:Key to configure and retrieve others keys from Server and to set server settings from OpenMPTCProuter.%>
<% if nbserver > 1 then %>
checked <% end %>/>
<%:Only one server can be master, else all servers are set as backup.%>
<% end %>
checked <% end %>/>
<% end) %>
<%:Advanced settings%>

<%:LAN interfaces settings%> <% 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_lan.network | tr ' ' '\n' | grep \'^" .. ifname .. "$\'")) if firewall_lan ~= "" then %>

<%=ifname%>

">
<%:Label for the interface%>
<% findproto = 0 %>
<%:You can use DHCP if you have multiple real ethernet ports.%>
<% if uci:get("network",ifname,"type") ~= "bridge" then %>

<%:Choose physical interface.%>
<% end %>
" data-type="ip4addr">
" data-type="ip4addr">
<% end end %>
<%:Interfaces settings%>
<%:You must disable DHCP on your modems and set IP in different networks.%>
<% 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_wan.network | tr ' ' '\n' | grep \'^" .. ifname .. "$\'")) if firewall_wan ~= "" then -- local multipath = uci:get("network",ifname,"multipath") -- local multipathvpn = uci:get("openmptcprouter",ifname,"multipathvpn") -- local vpn = uci:get("openmptcprouter",ifname,"vpn") -- if (multipath ~= nil and multipath ~= "off" and vpn ~= "1") or multipathvpn == "1" then %>

<%=ifname%>

">
<%:Label for the interface%>

<%:Choose MacVLAN if you want to create a virtual interface based on a physical interface.%>

<%:Choose physical interface.%>
<% findproto = 0 %>
<%:You can use DHCP if you have multiple real ethernet ports. Select other if you want to use another protocol available in Network Interfaces page.%>

<%:Choose physical interface.%>
" data-type="ip4addr">
<%:Set an IP in the same network as the modem%>
" data-type="ip4addr">
" data-type="ip4addr">
<%:Set here IP of the modem%>
<% ipv6list = uci:get_list("network",ifname,"ip6addr") for key, value in pairs(ipv6list) do %>

<%:Set an IP in the same network as the modem%>
<% end if table.getn(ipv6list) ~= 0 then %>
" data-type="ip6addr" data-optional="true">
<%:Set here IP of the modem%>
<% else %>

<%:Set an IP in the same network as the modem%>
" data-type="ip6addr">
<%:Set here IP of the modem%>
<% end %>
">
">
">
">
">
<% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>

<%:Only one interface must be set as "Master", this should be the most stable interface.%>
<% else %>
<% end %>

<%:You can force a TTL. Some LTE provider detect tethering by inpecting packet TTL value, setting it to 65 often solve the issue.%>
<% local download = "0" local upload = "0" download = uci:get("network",ifname,"downloadspeed") or "0" upload = uci:get("network",ifname,"uploadspeed") or "0" --if download == "0" or upload == "0" then -- if nixio.fs.access("/etc/init.d/sqm") then -- download = uci:get("sqm",ifname,"download") -- upload = uci:get("sqm",ifname,"upload") -- else -- download = uci:get("qos",ifname,"download") -- upload = uci:get("qos",ifname,"upload") -- end --end %>
checked<% end %> />
<%:You can enable MPTCP over VPN if your provider filter Multipath TCP.%>
<% if sqm == "1" then %>
checked<% end %> />
<%:SQM control bufferloat: the undesirable latency that arises when the router buffers too much data.%> <%:You should disable SQM for LTE or any interfaces with variable speed.%>
<% end %> <% if qos == "1" then %>
checked<% end %> />
<%:QoS permit to prioritize any upload traffic.%>
<% end %>

<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>

<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
<% end end %>
<%:Select the device you want to base the interface on.%>
<%+footer%>