mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-14 19:41:51 +00:00
Add lan configuration to wizard and fixes
This commit is contained in:
parent
175e97b130
commit
e4cd65a319
2 changed files with 87 additions and 10 deletions
|
@ -228,6 +228,8 @@ function wizard_add()
|
|||
local auth = luci.http.formvalue("cbid.network.%s.auth" % intf) or ""
|
||||
local mode = luci.http.formvalue("cbid.network.%s.mode" % intf) or ""
|
||||
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
|
||||
local multipath = luci.http.formvalue("cbid.sqm.%s.multipath" % intf) or "on"
|
||||
local lan = luci.http.formvalue("cbid.sqm.%s.lan" % intf) or "0"
|
||||
if typeintf == "normal" then
|
||||
typeintf = ""
|
||||
end
|
||||
|
@ -251,6 +253,11 @@ function wizard_add()
|
|||
ucic:set("network",intf,"auth",auth)
|
||||
ucic:set("network",intf,"mode",mode)
|
||||
ucic:set("network",intf,"label",label)
|
||||
if lan == "1" then
|
||||
ucic:set("network",intf,"multipath","off")
|
||||
else
|
||||
ucic:set("network",intf,"multipath",multipath)
|
||||
end
|
||||
ucic:set("network",intf,"defaultroute",0)
|
||||
ucic:set("network",intf,"peerdns",0)
|
||||
if ipaddr ~= "" then
|
||||
|
|
|
@ -342,16 +342,75 @@ end
|
|||
</div>
|
||||
</fieldset>
|
||||
</span>
|
||||
<fieldset class="cbi-section" id="laninterfaces">
|
||||
<legend><%:LAN interfaces settings%></legend>
|
||||
<%
|
||||
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))
|
||||
if firewall_lan ~= "" then
|
||||
%>
|
||||
<h3><%=ifname%></h3>
|
||||
<fieldset class="cbi-section-node" id="cbi-openmptcprouter-<%=ifname%>">
|
||||
<input type="hidden" name="intf.<%=ifname%>" value="<%=ifname%>" />
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-label" data-index="1">
|
||||
<label class="cbi-value-title"><%:Label%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="hidden" id="cbid.network.<%=ifname%>.lan" name="cbid.network.<%=ifname%>.lan" value="1">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.label" name="cbid.network.<%=ifname%>.label" class="cbi-input-text" value="<%=uci:get("network",ifname,"label")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Label for the interface%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-proto" data-index="3">
|
||||
<label class="cbi-value-title"><%:Protocol%></label>
|
||||
<div class="cbi-value-field">
|
||||
<% findproto = 0 %>
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.proto" name="cbid.network.<%=ifname%>.proto" size="1">
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" or uci:get("network",ifname,"proto") == "" then findproto = 1 %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-dhcp" value="dhcp"<% if uci:get("network",ifname,"proto") == "dhcp" then findproto = 1 %> selected="selected"<% end %>><%:DHCP%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= nil and findproto ~= 1 then %> selected="selected"<% end %>><%:Other%></option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:You can use DHCP if you have multiple real ethernet ports.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:IPv4 address%></label>
|
||||
<div class="cbi-value-field">
|
||||
<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">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="6">
|
||||
<label class="cbi-value-title"><%:IPv4 netmask%></label>
|
||||
<div class="cbi-value-field">
|
||||
<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">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
|
||||
<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>
|
||||
<%
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifname = iface:name()
|
||||
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
|
||||
local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.@zone[1].network | 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
|
||||
%>
|
||||
<div class="cbi-section-remove right">
|
||||
<input type="submit" name="delete.<%=ifname%>" value="<%:Delete%>" class="cbi-button" />
|
||||
|
@ -409,13 +468,13 @@ end
|
|||
<div class="cbi-value-field">
|
||||
<% findproto = 0 %>
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.proto" name="cbid.network.<%=ifname%>.proto" size="1">
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" then findproto = 1 %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" or uci:get("network",ifname,"proto") == nil then findproto = 1 %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-dhcp" value="dhcp"<% if uci:get("network",ifname,"proto") == "dhcp" then findproto = 1 %> selected="selected"<% end %>><%:DHCP%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-modemmanager" value="modemmanager"<% if uci:get("network",ifname,"proto") == "modemmanager" then findproto = 1 %> selected="selected"<% end %>><%:ModemManager%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-ncm" value="ncm"<% if uci:get("network",ifname,"proto") == "ncm" then findproto = 1 %> selected="selected"<% end %>><%:NCM%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-pppoe" value="pppoe"<% if uci:get("network",ifname,"proto") == "pppoe" then findproto = 1 %> selected="selected"<% end %>><%:PPPoE%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-qmi" value="qmi"<% if uci:get("network",ifname,"proto") == "qmi" then findproto = 1 %> selected="selected"<% end %>><%:QMI%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= nil and findproto ~= "1" then %> selected="selected"<% end %>><%:Other%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= nil and findproto ~= 1 then %> selected="selected"<% end %>><%:Other%></option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
|
@ -605,6 +664,17 @@ end
|
|||
<input type="text" id="cbid.network.<%=ifname%>.delay" name="cbid.network.<%=ifname%>.delay" class="cbi-input-text" value="<%=uci:get("network",ifname,"delay")%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-multipath" data-index="13">
|
||||
<label class="cbi-value-title"><%:Multipath TCP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.multipath" name="cbid.network.<%=ifname%>.multipath" size="1">
|
||||
<option value="on"<% if uci:get("network",ifname,"multipath") == "on" then %> selected="selected"<% end %>><%:Enabled%></option>
|
||||
<option value="off"<% if uci:get("network",ifname,"multipath") == "off" then %> selected="selected"<% end %>><%:Disabled%></option>
|
||||
<option value="master"<% if uci:get("network",ifname,"multipath") == "master" then %> selected="selected"<% end %>><%:Master%></option>
|
||||
<option value="backup"<% if uci:get("network",ifname,"multipath") == "backup" then %> selected="selected"<% end %>><%:Backup%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
local download = "0"
|
||||
|
@ -621,7 +691,7 @@ end
|
|||
end
|
||||
end
|
||||
%>
|
||||
<div class="cbi-value" data-index="13">
|
||||
<div class="cbi-value" data-index="14">
|
||||
<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 %> />
|
||||
|
@ -631,7 +701,7 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="14">
|
||||
<div class="cbi-value" data-index="15">
|
||||
<label class="cbi-value-title"><%:Enable SQM%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> />
|
||||
|
@ -641,7 +711,7 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="15">
|
||||
<div class="cbi-value" data-index="16">
|
||||
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
|
||||
|
@ -657,7 +727,7 @@ end
|
|||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="16">
|
||||
<div class="cbi-value" data-index="17">
|
||||
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
|
||||
|
|
Loading…
Reference in a new issue