mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add VLAN support in wizard
This commit is contained in:
		
							parent
							
								
									51cae2dac9
								
							
						
					
					
						commit
						3a28ad66e5
					
				
					 2 changed files with 25 additions and 3 deletions
				
			
		|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
| 
 | ||||
| %> | ||||
| <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> | ||||
|  | @ -537,20 +548,27 @@ | |||
| 			    <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1"> | ||||
| 			<% | ||||
| 			    iffind=0 | ||||
| 			    uciifname=uci:get("network",ifname,"ifname") | ||||
| 			    ifname=splitstring(uciifname,'.')[1] or "" | ||||
| 			    vlan=splitstring(uciifname,'.')[2] or "" | ||||
| 			    for _, ifacea in ipairs(ifaces) do | ||||
| 				if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then | ||||
| 			%> | ||||
| 			<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option> | ||||
| 			<option value="<%=ifacea%>"<% if ifname == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option> | ||||
| 			<% | ||||
| 				end | ||||
| 			    end | ||||
| 			    if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then | ||||
| 			%> | ||||
| 				<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option> | ||||
| 				<option value="<%=ifname%>" selected="selected"><%=ifname%></option> | ||||
| 			<% | ||||
| 			    end | ||||
| 			%> | ||||
| 			    </select> | ||||
| 		    </div> | ||||
| 		    <label class="cbi-value-title"><%:VLAN%></label> | ||||
| 		    <div class="cbi-value-field"> | ||||
| 			    <input type="text" id="cbid.network.<%=ifname%>.vlan" name="cbid.network.<%=ifname%>.vlan" class="cbi-input-text" placeholder="<%:VLAN%>" value="<%=vlan%>" data-type="uinteger" data-optional="false"> | ||||
| 			<br /> | ||||
| 			<div class="cbi-value-description"> | ||||
| 			    <%: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 | ||||
| 			%> | ||||
| 			<option value="<%='@' .. ifacea:name()%>"><%='@' .. ifacea:name() .. ' (alias)'%></option> | ||||
| 			<% | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue