From dd938aec0fc0ce69f3f46b4bbb26bb8272fc631b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 10 Sep 2020 21:05:31 +0200 Subject: [PATCH] Allow to configure some proto in wizard --- .../luasrc/controller/openmptcprouter.lua | 20 ++ .../luasrc/view/openmptcprouter/wizard.htm | 181 ++++++++++++++++-- 2 files changed, 186 insertions(+), 15 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 55ea6526d..c496b97af 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -213,13 +213,33 @@ function wizard_add() for intf, _ in pairs(interfaces) do local label = luci.http.formvalue("cbid.network.%s.label" % intf) or "" local proto = luci.http.formvalue("cbid.network.%s.proto" % intf) or "static" + local typeintf = luci.http.formvalue("cbid.network.%s.type" % intf) or "" + local masterintf = luci.http.formvalue("cbid.network.%s.masterintf" % intf) or "" + local ifname = luci.http.formvalue("cbid.network.%s.intf" % intf) or "" + local device = luci.http.formvalue("cbid.network.%s.device" % intf) or "" local ipaddr = luci.http.formvalue("cbid.network.%s.ipaddr" % intf) or "" local netmask = luci.http.formvalue("cbid.network.%s.netmask" % intf) or "" local gateway = luci.http.formvalue("cbid.network.%s.gateway" % intf) or "" + local apn = luci.http.formvalue("cbid.network.%s.apn" % intf) or "" + local pincode = luci.http.formvalue("cbid.network.%s.pincode" % intf) or "" local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0" + if typeintf == "normal" then + typeintf = "" + end + ucic:set("network",intf,"type",typeintf) + if typeintf == "macvlan" then + ucic:set("network",intf,"type","macvlan") + ucic:set("network",intf,"masterintf",masterintf) + elseif typeintf == "" and (proto == "static" or proto == "dhcp" ) then + ucic:set("network",intf,"ifname",ifname) + elseif typeintf == "" and (proto == "ncm" or proto == "qmi" or proto == "modemmanager") then + ucic:set("network",intf,"device",device) + end if proto ~= "other" then ucic:set("network",intf,"proto",proto) end + ucic:set("network",intf,"apn",apn) + ucic:set("network",intf,"pincode",pincode) ucic:set("network",intf,"label",label) if ipaddr ~= "" then ucic:set("network",intf,"ipaddr",ipaddr) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index e0e67d774..2ddbf24b3 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -125,7 +125,7 @@ end
- + @@ -310,7 +310,7 @@ end <% elseif vpn == "dsvpn" then %> <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> <% elseif vpn == "mlvpn" then %> - <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> <% elseif vpn == "ubond" then %> <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> <% elseif vpn == "openvpn" then %> @@ -326,7 +326,7 @@ end <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> - <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> <% if nixio.fs.access("/usr/sbin/openvpn") then %><% end %> @@ -369,13 +369,52 @@ end -
+
+ +
+ +
+
+ <%:Choose MacVLAN if you want to create a virtual interface based on a physical interface.%> +
+
+
+
+ +
+ +
+
+ <%:Choose physical interface.%> +
+
+
+ +
+ <% findproto = 0 %>
@@ -383,7 +422,34 @@ end
-
+
+ +
+ +
+
+ <%:Choose physical interface.%> +
+
+
+ +
" data-type="ip4addr"> @@ -393,13 +459,13 @@ end
-
+
" data-type="ip4addr">
-
+
" data-type="ip4addr"> @@ -409,6 +475,91 @@ end
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ "> +
+
+
+ +
+ "> +
+
+ <% local download = "0" local upload = "0" @@ -424,7 +575,7 @@ end end end %> -
+
checked<% end %> /> @@ -434,7 +585,7 @@ end
-
+
checked<% end %> /> @@ -444,7 +595,7 @@ end
-
+
@@ -460,7 +611,7 @@ end -->
-
+
@@ -486,7 +637,7 @@ end