2018-03-23 19:23:27 +00:00
< %+header%>
< %
local uci = require("luci.model.uci").cursor()
local net = require "luci.model.network".init()
2018-06-29 16:27:21 +00:00
local fs = require "nixio.fs"
2018-09-01 19:59:02 +00:00
local sys = require "luci.sys"
2019-09-22 06:33:54 +00:00
local ut = require "luci.util"
2018-09-01 19:59:02 +00:00
local ifaces = sys.net:devices()
2018-06-26 16:07:36 +00:00
local servers_ip = {}
local server_ip = uci:get("shadowsocks-libev","sss0","server")
if server_ip == '127.0.0.1' then
local upstreams = uci:get("nginx-ha","ShadowSocks","upstreams")
for _, up in pairs(upstreams) do
local a = up:match("^([^:]+):")
table.insert(servers_ip,a)
end
else
table.insert(servers_ip,server_ip)
end
2018-09-01 19:59:02 +00:00
function device_notvirtual(dev)
for _, iface in ipairs(net:get_networks()) do
local ifacen = iface:name()
local ifacename = uci:get("network",ifacen,"ifname")
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
return false
end
end
return true
end
2018-03-23 19:23:27 +00:00
%>
2018-09-01 19:59:02 +00:00
< script type = "text/javascript" src = "<%=resource%>/cbi.js?v=git-18.243.49640-2f13420" data-strings = "{"path":{"resource":"\/luci-static\/resources","browser":"\/cgi-bin\/luci\/admin\/filebrowser"}}" > < / script >
2018-11-27 14:21:47 +00:00
< script src = "/luci-static/resources/xhr.js?v=git-18.324.48426-65adb4e" > < / script >
< script >
function jsshowadv() {
if(document.getElementById('showadv').checked){
document.getElementById('advancedsettings').style.display='inline';
} else {
document.getElementById('advancedsettings').style.display='none';
}
}
< / script >
2018-03-23 19:23:27 +00:00
< % if stderr and #stderr > 0 then %>< pre class = "error" > < %=pcdata(stderr)%>< / pre > < % end %>
2018-06-13 08:47:48 +00:00
< form class = "inline" method = "post" action = "<%=url('admin/system/openmptcprouter/wizard_add')%>" enctype = "multipart/form-data" >
2018-03-30 09:12:43 +00:00
< div class = "cbi-map" >
< h2 name = "content" > < %:Wizard%>< / h2 >
2018-03-30 13:47:27 +00:00
< fieldset class = "cbi-section" id = "server" >
2018-11-27 14:21:47 +00:00
< legend > < %:Server settings%>< / legend >
2018-12-12 20:30:15 +00:00
< %
2018-12-12 20:59:08 +00:00
nbserver=0
uci:foreach("openmptcprouter","server", function(s)
nbserver=nbserver+1
end)
2018-12-12 20:30:15 +00:00
uci:foreach("openmptcprouter","server", function(s)
servername = s[".name"]
%>
< div class = "cbi-section-remove right" >
2018-12-17 19:46:53 +00:00
< input type = "submit" name = "deleteserver.<%=servername%>" value = "<%:Delete%>" class = "cbi-button" / >
2018-12-12 20:30:15 +00:00
< input type = "hidden" name = "server.<%=servername%>" value = "<%=servername%>" / >
< / div >
< h3 > < %=servername%>< / h3 >
< div class = "cbi-section-node" id = "cbi-omr-wizard-<%=servername%>" >
< div class = "cbi-value" >
< label class = "cbi-value-title" for = "server_ip" > < %:Server IP%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input name = "<%=servername%>.server_ip" id = "<%=servername%>.server_ip" placeholder = "<%:Server IP%>" class = "cbi-input-text" value = "<%=uci:get(" openmptcprouter " , servername , " ip " ) % > " data-optional="false">
2018-12-12 20:30:15 +00:00
< div class = "cbi-value-description" >
< %:Server IP will be set for ShadowSocks, Glorytun, OpenVPN and MLVPN%>
< / div >
< / div >
2018-06-26 16:07:36 +00:00
< / div >
2018-12-12 20:30:15 +00:00
< br / >
2019-11-03 18:22:51 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Server username%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "<%=servername%>.openmptcprouter_vps_username" placeholder = "<%:Server username%>" class = "cbi-input-text" value = "<%=uci:get(" openmptcprouter " , servername , " username " ) % > " data-optional="false">
2019-11-03 18:22:51 +00:00
< br / >
< div class = "cbi-value-description" >
2019-11-23 20:34:36 +00:00
< %:Username to retrieve personnalized settings from the server.%>
2019-11-03 18:22:51 +00:00
< / div >
< / div >
< / div >
2018-12-12 20:30:15 +00:00
< div class = "cbi-value" >
2019-07-15 20:36:24 +00:00
< label class = "cbi-value-title" > < %:Server key%>< / label >
2018-12-12 20:30:15 +00:00
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "<%=servername%>.openmptcprouter_vps_key" placeholder = "<%:Server key%>" class = "cbi-input-text" value = "<%=uci:get(" openmptcprouter " , servername , " password " ) % > " data-optional="false">
2018-12-12 20:30:15 +00:00
< br / >
< div class = "cbi-value-description" >
2019-08-05 14:58:42 +00:00
< %:Key to configure and retrieve others keys from Server and to set server settings from OpenMPTCProuter.%>
2018-12-12 20:30:15 +00:00
< / div >
< / div >
< / div >
2018-12-12 20:59:08 +00:00
< %
if nbserver > 1 then
%>
< br / >
< div class = "cbi-value" >
2019-01-14 17:13:04 +00:00
< label class = "cbi-value-title" > < %:Set server as master%>< / label >
2018-12-12 20:59:08 +00:00
< div class = "cbi-value-field" >
2019-01-14 17:13:04 +00:00
< input class = "cbi-input-radio" type = "radio" name = "master" value = "<%=servername%>" < % if uci:get ( " openmptcprouter " , servername , " master " ) = = " 1 " then % > checked< % end %>/>
< br / >
< div class = "cbi-value-description" >
< %:Only one server can be master, else all servers are set as backup.%>
< / div >
2018-12-12 20:59:08 +00:00
< / div >
< / div >
2018-12-12 20:30:15 +00:00
< %
2018-12-12 20:59:08 +00:00
end
2018-12-12 20:30:15 +00:00
end)
%>
< div class = "cbi-section-create" >
< div >
2018-12-14 19:49:07 +00:00
< input type = "text" class = "cbi-section-create-name" id = "cbi.cts.omr-bypass.server." name = "add_server_name" data-type = "uciname" data-optional = "true" / >
2018-12-12 20:30:15 +00:00
< / div >
< input class = "cbi-button cbi-button-add" type = "submit" onclick = "this.form.cbi_state='add-section'; return true" name = "add_server" value = "<%:Add server%>" / >
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-12-12 20:30:15 +00:00
< / fieldset >
< fieldset class = "cbi-section" id = "server_common" >
< legend > < %:Common server settings%>< / legend >
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Enable IPv6%>< / label >
< div class = "cbi-value-field" >
2019-01-15 20:37:11 +00:00
< input class = "cbi-input-checkbox" type = "checkbox" name = "enableipv6" value = "0" < % if uci:get ( " openmptcprouter " , " settings " , " disable_ipv6 " ) = = " 0 " then % > checked< % end %> />
2018-11-27 14:21:47 +00:00
< br / >
< div class = "cbi-value-description" >
< %:You should disable IPv6 here if server doesn't provide IPv6.%>
< / div >
< / div >
< / div >
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Advanced settings%>< / label >
< div class = "cbi-value-field" >
< input type = "checkbox" class = "cbi-input-checkbox" id = "showadv" value = "1" onclick = "jsshowadv()" / >
< / div >
< / div >
< / fieldset >
< span id = "advancedsettings" style = "display:none;" >
< fieldset class = "cbi-section" id = "shadowsocks" >
< legend > < %:ShadowSocks settings%>< / legend >
< div class = "cbi-section-descr" > < %:By default ShadowSocks is used for TCP traffic.%>< / div >
2018-03-23 19:23:27 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:ShadowSocks key%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "shadowsocks_key" placeholder = "<%:ShadowSocks key%>" class = "cbi-input-text" value = "<%=uci:get(" shadowsocks-libev " , " sss0 " , " key " ) % > " />
2018-06-07 14:51:37 +00:00
< br / >
< div class = "cbi-value-description" >
2018-11-27 14:21:47 +00:00
< %:ShadowSocks is used for TCP.%>
2018-06-07 14:51:37 +00:00
< / div >
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Disable ShadowSocks%>< / label >
< div class = "cbi-value-field" >
2019-07-19 16:21:47 +00:00
< input class = "cbi-input-checkbox" type = "checkbox" name = "disableshadowsocks" value = "1" < % if uci:get ( " shadowsocks-libev " , " sss0 " , " disabled " ) = = " 1 " then % > checked< % end %> />
2018-11-27 14:21:47 +00:00
< / div >
< / div >
2019-09-22 06:33:54 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Encryption%>< / label >
< div class = "cbi-value-field" >
< select class = "cbi-input-select" name = "encryption" size = "1" >
< %
local method=uci:get("shadowsocks-libev","sss0","method")
%>
< option value = "none" < % if method = = " none " then % > selected="selected"< % end %>>< %:None%>< / option >
< option value = "aes-256-gcm" < % if method = = " aes-256-gcm " then % > selected="selected"< % end %>>AES-256-GCM< / option >
2019-11-01 08:15:51 +00:00
< option value = "chacha20-ietf-poly1305" < % if method = = " chacha20 " or method = = " chacha20-ietf-poly1305 " then % > selected="selected"< % end %>>chacha20< / option >
< option value = "other" < % if method ~ = " chacha20 " and method ~ = " aes-256-gcm " and method ~ = " chacha20-ietf-poly1305 " and method ~ = " none " then % > selected="selected"< % end %>>< %:other%>< / option >
2019-09-22 06:33:54 +00:00
< / select >
< br / >
< div class = "cbi-value-description" >
< %
if ut.trim(sys.exec("cat /proc/cpuinfo | grep aes")) ~= "" then
%>
< %:An Advanced Encryption Standard (AES) instruction set is integrated in the processor.%>
< % else %>
< %:There is no Advanced Encryption Standard (AES) instruction set integrated in the processor, you should use chacha20.%>
< % end %>
2019-10-04 19:30:57 +00:00
< %:Encryption method is also used for Glorytun.%>
2019-09-22 06:33:54 +00:00
< / div >
< / div >
< / div >
2018-11-27 14:21:47 +00:00
< / fieldset >
< fieldset class = "cbi-section" id = "vpn" >
< legend > < %:VPN settings%>< / legend >
< div class = "cbi-section-descr" > < %:By default VPN is used for any traffic that is not TCP.%>< / div >
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/glorytun") or nixio.fs.access("/usr/sbin/glorytun-udp") then %>
2018-03-23 19:23:27 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Glorytun key%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "glorytun_key" placeholder = "<%:Glorytun key%>" class = "cbi-input-text" value = "<%=uci:get(" glorytun " , " vpn " , " key " ) % > ">
2018-06-07 14:51:37 +00:00
< br / >
< div class = "cbi-value-description" >
2018-06-11 08:21:48 +00:00
< %:Glorytun TCP is used by default for UDP and ICMP%>
2018-06-07 14:51:37 +00:00
< / div >
< / div >
< / div >
2018-06-12 17:22:55 +00:00
< % end %>
2019-08-02 20:37:45 +00:00
< % if nixio.fs.access("/usr/sbin/dsvpn") then %>
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:A Dead Simple VPN key%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "dsvpn_key" placeholder = "<%:A Dead Simple VPN key%>" class = "cbi-input-text" value = "<%=uci:get(" dsvpn " , " vpn " , " key " ) % > ">
2019-08-02 20:37:45 +00:00
< br / >
< div class = "cbi-value-description" >
< %:A Dead Simple VPN is a TCP VPN that can replace Glorytun TCP%>
< / div >
< / div >
< / div >
< % end %>
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/mlvpn") then %>
2018-06-07 14:51:37 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:MLVPN password%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "mlvpn_password" placeholder = "<%:MLVPN password%>" class = "cbi-input-text" value = "<%=uci:get(" mlvpn " , " general " , " password " ) % > ">
2018-06-07 14:51:37 +00:00
< br / >
< div class = "cbi-value-description" >
2018-06-11 08:21:48 +00:00
< %:MLVPN can replace Glorytun with connections with same latency%>
< / div >
< / div >
< / div >
2018-06-12 17:22:55 +00:00
< % end %>
2019-10-27 07:42:52 +00:00
< % if nixio.fs.access("/usr/sbin/ubond") then %>
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:UBOND password%>< / label >
< div class = "cbi-value-field" >
2019-11-07 20:02:51 +00:00
< input type = "text" name = "ubond_password" placeholder = "<%:UBOND password%>" class = "cbi-input-text" value = "<%=uci:get(" ubond " , " general " , " password " ) % > ">
2019-10-27 07:42:52 +00:00
< br / >
< div class = "cbi-value-description" >
< %:UBOND can replace Glorytun with connections with same latency%>
< / div >
< / div >
< / div >
< % end %>
2018-06-11 08:21:48 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Default VPN%>< / label >
< div class = "cbi-value-field" >
< select class = "cbi-input-select" name = "default_vpn" size = "1" >
2018-12-04 15:56:02 +00:00
< %
local available_vpns = uci:get("openmptcprouter","vps","available_vpn") or ""
if available_vpns ~= "" then
if (type(available_vpns) ~= "table") then
available_vpns = {available_vpns}
end
for _, vpn in pairs(available_vpns) do
if vpn == "glorytun-tcp" then
%>
< % if nixio.fs.access("/usr/sbin/glorytun") then %>< option value = "glorytun_tcp" < % if uci:get ( " glorytun " , " vpn " , " enable " ) = = " 1 " and uci:get ( " glorytun " , " vpn " , " proto " ) = = " tcp " then % > selected="selected"< % end %>>Glorytun TCP< / option > < % end %>
< % elseif vpn == "glorytun-udp" then %>
< % if nixio.fs.access("/usr/sbin/glorytun-udp") then %>< option value = "glorytun_udp" < % if uci:get ( " glorytun " , " vpn " , " enable " ) = = " 1 " and uci:get ( " glorytun " , " vpn " , " proto " ) = = " udp " then % > selected="selected"< % end %>>Glorytun UDP< / option > < % end %>
2019-08-02 20:37:45 +00:00
< % elseif vpn == "dsvpn" then %>
< % if nixio.fs.access("/usr/sbin/dsvpn") then %>< option value = "dsvpn" < % if uci:get ( " dsvpn " , " vpn " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>A Dead Simple VPN< / option > < % end %>
2018-12-04 15:56:02 +00:00
< % elseif vpn == "mlvpn" then %>
< % if nixio.fs.access("/usr/sbin/mlvpn") then %>< option value = "mlvpn" < % if uci:get ( " mlvpn " , " general " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>MLVPN< / option > < % end %>
2019-10-27 07:42:52 +00:00
< % elseif vpn == "ubond" then %>
< % if nixio.fs.access("/usr/sbin/ubond") then %>< option value = "ubond" < % if uci:get ( " ubond " , " general " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>UBOND< / option > < % end %>
2018-12-04 15:56:02 +00:00
< % elseif vpn == "openvpn" then %>
< % if nixio.fs.access("/usr/sbin/openvpn") then %>< option value = "openvpn" < % if uci:get ( " openvpn " , " omr " , " enabled " ) = = " 1 " then % > selected="selected"< % end %>>OpenVPN< / option > < % end %>
< %
end
end
%>
< option value = "none" < % if uci:get ( " openmptcprouter " , " settings " , " vpn " ) = = " none " then % > selected="selected"< % end %>>None< / option >
< %
else
%>
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/glorytun") then %>< option value = "glorytun_tcp" < % if uci:get ( " glorytun " , " vpn " , " enable " ) = = " 1 " and uci:get ( " glorytun " , " vpn " , " proto " ) = = " tcp " then % > selected="selected"< % end %>>Glorytun TCP< / option > < % end %>
< % if nixio.fs.access("/usr/sbin/glorytun-udp") then %>< option value = "glorytun_udp" < % if uci:get ( " glorytun " , " vpn " , " enable " ) = = " 1 " and uci:get ( " glorytun " , " vpn " , " proto " ) = = " udp " then % > selected="selected"< % end %>>Glorytun UDP< / option > < % end %>
2019-08-02 20:37:45 +00:00
< % if nixio.fs.access("/usr/sbin/dsvpn") then %>< option value = "dsvpn" < % if uci:get ( " dsvpn " , " vpn " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>A Dead Simple VPN< / option > < % end %>
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/mlvpn") then %>< option value = "mlvpn" < % if uci:get ( " mlvpn " , " general " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>MLVPN< / option > < % end %>
2019-10-27 07:42:52 +00:00
< % if nixio.fs.access("/usr/sbin/ubond") then %>< option value = "ubond" < % if uci:get ( " ubond " , " general " , " enable " ) = = " 1 " then % > selected="selected"< % end %>>UBOND< / option > < % end %>
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/openvpn") then %>< option value = "openvpn" < % if uci:get ( " openvpn " , " omr " , " enabled " ) = = " 1 " then % > selected="selected"< % end %>>OpenVPN< / option > < % end %>
2018-06-29 16:27:21 +00:00
< option value = "none" < % if uci:get ( " openmptcprouter " , " settings " , " vpn " ) = = " none " then % > selected="selected"< % end %>>None< / option >
2018-12-04 15:56:02 +00:00
< %
end
%>
2018-06-11 08:21:48 +00:00
< / select >
< br / >
< div class = "cbi-value-description" >
2019-10-27 07:42:52 +00:00
< %:Set the default VPN used for UDP and ICMP when ShadowSocks is enabled, for all traffic if ShadowSocks is disabled.%> < %:All VPN available here can do aggregation over MPTCP or using own internal method.%>
2018-06-07 14:51:37 +00:00
< / div >
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-03-30 13:47:27 +00:00
< / fieldset >
2018-11-27 14:21:47 +00:00
< / span >
2018-03-30 13:47:27 +00:00
< fieldset class = "cbi-section" id = "interfaces" >
< legend > < %:Interfaces settings%>< / legend >
< div class = "cbi-section-descr" > < %:You must disable DHCP on your modems and set IP in different networks.%>< / div >
2018-03-23 19:23:27 +00:00
< %
2018-08-17 20:03:17 +00:00
for _, iface in ipairs(net:get_networks()) do
2018-03-23 19:23:27 +00:00
local ifname = iface:name()
2019-10-26 07:16:28 +00:00
--local multipath = uci:get("network",ifname,"multipath")
local multipath = uci:get("openmptcprouter",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
2018-03-23 19:23:27 +00:00
%>
2018-04-20 12:56:19 +00:00
< div class = "cbi-section-remove right" >
< input type = "submit" name = "delete.<%=ifname%>" value = "<%:Delete%>" class = "cbi-button" / >
< / div >
2018-03-30 09:12:43 +00:00
< h3 > < %=ifname%>< / h3 >
2018-04-20 12:56:19 +00:00
< fieldset class = "cbi-section-node" id = "cbi-openmptcprouter-<%=ifname%>" >
< input type = "hidden" name = "intf.<%=ifname%>" value = "<%=ifname%>" / >
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" id = "cbi-network-<%=ifname%>-proto" data-index = "1" >
< label class = "cbi-value-title" > < %:Protocol%>< / label >
< div class = "cbi-value-field" >
< select class = "cbi-input-select" data-update = "change" id = "cbid.network.<%=ifname%>.proto" name = "cbid.network.<%=ifname%>.proto" size = "1" >
2018-12-17 19:46:53 +00:00
< option id = "cbid.network.<%=ifname%>.proto-static" value = "static" < % if uci:get ( " network " , ifname , " proto " ) = = " static " then % > selected="selected"< % end %>>< %:Static address%>< / option >
< option id = "cbid.network.<%=ifname%>.proto-dhcp" value = "dhcp" < % if uci:get ( " network " , ifname , " proto " ) = = " dhcp " then % > selected="selected"< % end %>>< %:DHCP%>< / option >
< option id = "cbid.network.<%=ifname%>.proto-other" value = "other" < % if uci:get ( " network " , ifname , " proto " ) ~ = " static " and uci:get ( " network " , ifname , " proto " ) ~ = " dhcp " then % > selected="selected"< % end %>>< %:Other%>< / option >
2018-11-27 14:21:47 +00:00
< / select >
< br / >
< div class = "cbi-value-description" >
< %: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.%>
< / div >
< / div >
< / div >
< div class = "cbi-value" id = "cbi-network-<%=ifname%>-address" data-depends = "[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index = "2" >
2018-04-20 12:56:19 +00:00
< label class = "cbi-value-title" > < %:IPv4 address%>< / label >
< div class = "cbi-value-field" >
2018-11-27 14:21:47 +00:00
< input type = "text" id = "cbid.network.<%=ifname%>.ipaddr" name = "cbid.network.<%=ifname%>.ipaddr" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " ipaddr " ) % > " data-type="ip4addr">
2018-04-20 12:56:19 +00:00
< br / >
< div class = "cbi-value-description" >
< %:Set an IP in the same network as the modem%>
< / div >
2018-04-04 16:08:10 +00:00
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" id = "cbi-network-<%=ifname%>-netmask" data-depends = "[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index = "3" >
2018-04-20 12:56:19 +00:00
< label class = "cbi-value-title" > < %:IPv4 netmask%>< / label >
< div class = "cbi-value-field" >
2018-11-27 14:21:47 +00:00
< input type = "text" id = "cbid.network.<%=ifname%>.netmask" name = "cbid.network.<%=ifname%>.netmask" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " netmask " ) or " 255 . 255 . 255 . 0 " % > " data-type="ip4addr">
2018-04-20 12:56:19 +00:00
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" id = "cbi-network-<%=ifname%>-gateway" data-depends = "[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index = "4" >
2018-04-20 12:56:19 +00:00
< label class = "cbi-value-title" > < %:IPv4 gateway%>< / label >
< div class = "cbi-value-field" >
2018-11-27 14:21:47 +00:00
< input type = "text" id = "cbid.network.<%=ifname%>.gateway" name = "cbid.network.<%=ifname%>.gateway" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " gateway " ) % > " data-type="ip4addr">
2018-04-20 12:56:19 +00:00
< br / >
< div class = "cbi-value-description" >
< %:Set here IP of the modem%>
< / div >
2018-04-04 16:08:10 +00:00
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-08-02 07:39:43 +00:00
< %
2019-03-23 22:17:16 +00:00
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
2019-03-22 19:27:13 +00:00
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
2018-08-20 12:02:56 +00:00
end
2018-08-02 07:39:43 +00:00
%>
2018-11-27 14:21:47 +00:00
< div class = "cbi-value" data-index = "5" >
2019-10-26 07:16:28 +00:00
< label class = "cbi-value-title" > < %:MPTCP over VPN%>< / label >
< div class = "cbi-value-field" >
< input class = "cbi-input-checkbox" type = "checkbox" name = "multipathvpn.<%=ifname%>.enabled" value = "1" < % if uci:get ( " openmptcprouter " , ifname , " multipathvpn " ) = = " 1 " then % > checked< % end %> />
< br / >
< div class = "cbi-value-description" >
< %:You can enable MPTCP over VPN if your provider filter Multipath TCP.%>
< / div >
< / div >
< / div >
< div class = "cbi-value" data-index = "6" >
2019-04-03 21:14:25 +00:00
< label class = "cbi-value-title" > < %:Enable SQM%>< / label >
< div class = "cbi-value-field" >
2019-10-26 07:16:28 +00:00
< input class = "cbi-input-checkbox" type = "checkbox" name = "cbid.sqm.<%=ifname%>.enabled" value = "1" < % if uci:get ( " sqm " , ifname , " enabled " ) = = " 1 " then % > checked< % end %> />
2019-04-03 21:14:25 +00:00
< br / >
< div class = "cbi-value-description" >
< %:You should disable SQM for LTE or any interfaces with variable speed.%>
< / div >
< / div >
< / div >
2019-10-26 07:16:28 +00:00
< div class = "cbi-value" data-index = "7" >
2018-08-02 07:39:43 +00:00
< label class = "cbi-value-title" > < %:Download speed (Kb/s)%>< / label >
< div class = "cbi-value-field" >
2018-08-20 12:02:56 +00:00
< input type = "text" name = "cbid.sqm.<%=ifname%>.download" class = "cbi-input-text" value = "<%=download%>" data-type = "uinteger" >
2018-08-02 07:39:43 +00:00
< br / >
2019-03-22 19:27:13 +00:00
< div class = "cbi-value-description" >
2019-04-03 21:14:25 +00:00
< %:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
2019-03-22 19:27:13 +00:00
< / div >
<!--
< br / >
2018-08-02 07:39:43 +00:00
< div class = "cbi-value-description" >
2018-12-21 15:20:20 +00:00
< %:Set value between 80-95% of max download speed link. 0 to disable SQM/QoS.%>
2018-08-02 07:39:43 +00:00
< / div >
2019-03-22 19:27:13 +00:00
-->
2018-08-02 07:39:43 +00:00
< / div >
< / div >
2019-10-26 07:16:28 +00:00
< div class = "cbi-value" data-index = "8" >
2018-08-02 07:39:43 +00:00
< label class = "cbi-value-title" > < %:Upload speed (Kb/s)%>< / label >
< div class = "cbi-value-field" >
2018-08-20 12:02:56 +00:00
< input type = "text" name = "cbid.sqm.<%=ifname%>.upload" class = "cbi-input-text" value = "<%=upload%>" data-type = "uinteger" >
2018-08-02 07:39:43 +00:00
< br / >
2019-03-22 19:27:13 +00:00
< div class = "cbi-value-description" >
2019-04-03 21:14:25 +00:00
< %:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
2019-03-22 19:27:13 +00:00
< / div >
<!--
< br / >
2018-10-26 14:51:30 +00:00
< div class = "cbi-value-description" >
2018-12-21 15:20:20 +00:00
< %:Set value between 80-95% of max upload speed link. 0 to disable SQM/QoS.%>
2018-10-26 14:51:30 +00:00
< / div >
2019-03-22 19:27:13 +00:00
-->
2018-08-02 07:39:43 +00:00
< / div >
< / div >
2018-04-20 12:56:19 +00:00
< / fieldset >
2018-03-23 19:23:27 +00:00
< %
end
end
%>
2018-04-20 12:56:19 +00:00
< div class = "cbi-section-create" >
2018-09-01 19:59:02 +00:00
< select class = "cbi-section-create-name" name = "add_interface_ifname" >
< %
for _, ifacea in ipairs(ifaces) do
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea:match("^ifb.*") or ifacea:match("^sit.*")) and device_notvirtual(ifacea) then
%>
< option value = "<%=ifacea%>" > < %=ifacea%>< / option >
< %
end
end
%>
< / select >
2018-04-20 12:56:19 +00:00
< input class = "cbi-button cbi-button-add" type = "submit" name = "add_interface" value = "<%:Add an interface%>" title = "<%:Add an interface%>" / >
< / div >
2018-09-01 20:31:00 +00:00
< div class = "cbi-value-description" >
< %:Select the device you want to base the interface on.%>
< / div >
2018-03-30 13:47:27 +00:00
< / fieldset >
2018-03-23 19:23:27 +00:00
< / div >
< div class = "cbi-page-actions" >
< input type = "hidden" name = "token" value = "<%=token%>" / >
2018-07-25 12:44:21 +00:00
< 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')%>'" / >
2018-03-23 19:23:27 +00:00
< / div >
< / form >
2018-06-26 16:07:36 +00:00
< script type = "text/javascript" > cbi _init ( ) ; < / script >
2018-03-23 19:23:27 +00:00
< %+footer%>