From e4cd65a3197260527ec0243d742e19aad9256c6f Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 23 Sep 2020 10:11:59 +0200 Subject: [PATCH] Add lan configuration to wizard and fixes --- .../luasrc/controller/openmptcprouter.lua | 7 ++ .../luasrc/view/openmptcprouter/wizard.htm | 90 ++++++++++++++++--- 2 files changed, 87 insertions(+), 10 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index e24773638..cad43d555 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -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 diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 23c6881fc..38869947a 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -342,16 +342,75 @@ end +
+ <%: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[0].network | grep " .. ifname)) + if firewall_lan ~= "" then +%> +

<%=ifname%>

+
+ +
+ +
+ + "> +
+
+ <%:Label for the interface%> +
+
+
+
+ +
+ <% findproto = 0 %> + +
+
+ <%:You can use DHCP if you have multiple real ethernet ports.%> +
+
+
+
+ +
+ " 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 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 %>
@@ -409,13 +468,13 @@ end
<% findproto = 0 %>
@@ -605,6 +664,17 @@ end ">
+
+ +
+ +
+
<% local download = "0" @@ -621,7 +691,7 @@ end end end %> -
+
checked<% end %> /> @@ -631,7 +701,7 @@ end
-
+
checked<% end %> /> @@ -641,7 +711,7 @@ end
-
+
@@ -657,7 +727,7 @@ end -->
-
+