From 3a28ad66e5e4c39f33ced6e0808c96aeae81e522 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 29 Jan 2021 17:29:28 +0100 Subject: [PATCH] Add VLAN support in wizard --- .../luasrc/controller/openmptcprouter.lua | 4 ++++ .../luasrc/view/openmptcprouter/wizard.htm | 24 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 62974d55b..4f06cff5b 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -220,6 +220,7 @@ function wizard_add() 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 vlan = luci.http.formvalue("cbid.network.%s.vlan" % intf) or "" local device_ncm = luci.http.formvalue("cbid.network.%s.device.ncm" % intf) or "" local device_qmi = luci.http.formvalue("cbid.network.%s.device.qmi" % intf) or "" local device_modemmanager = luci.http.formvalue("cbid.network.%s.device.modemmanager" % intf) or "" @@ -244,6 +245,9 @@ function wizard_add() end ucic:set("network",intf,"type",typeintf) end + if vlan ~= "" then + ifname=ifname .. '.' .. vlan + end if typeintf == "macvlan" and masterintf ~= "" then ucic:set("network",intf,"type","macvlan") ucic:set("network",intf,"masterintf",masterintf) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index e1fb06c4c..ad0762c8d 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -21,6 +21,17 @@ end return true end + function splitstring(inputstr, sep) + 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 + %> @@ -537,20 +548,27 @@ + + +
+
<%:Choose physical interface.%> @@ -885,7 +903,7 @@ end end for _, ifacea in ipairs(net:get_networks()) do - if not (ifacea:name() == "loopback" or ifacea:name() == "omr6in4" or ifacea:name() == "omrvpn" or ifacea:name():match("^omrip.*")) then + if not (ifacea:name() == "loopback" or ifacea:name() == "lan" or ifacea:name() == "omr6in4" or ifacea:name() == "omrvpn" or ifacea:name():match("^omrip.*")) then %> <%