gluon-web-network: update wired mesh settings for new role-based configuration
This commit is contained in:
		
							parent
							
								
									316e96a467
								
							
						
					
					
						commit
						6dcee2e324
					
				| @ -28,6 +28,9 @@ msgstr "PoE-Passthrough aktivieren" | |||||||
| msgid "Enable PoE Power Port %s" | msgid "Enable PoE Power Port %s" | ||||||
| msgstr "PoE-Ausgabe auf Port %s aktivieren" | msgstr "PoE-Ausgabe auf Port %s aktivieren" | ||||||
| 
 | 
 | ||||||
|  | msgid "Enable meshing on the Ethernet interface" | ||||||
|  | msgstr "Mesh auf dem Ethernet-Port aktivieren" | ||||||
|  | 
 | ||||||
| msgid "Enable meshing on the LAN interface" | msgid "Enable meshing on the LAN interface" | ||||||
| msgstr "Mesh auf dem LAN-Port aktivieren" | msgstr "Mesh auf dem LAN-Port aktivieren" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -28,6 +28,9 @@ msgstr "" | |||||||
| msgid "Enable PoE Power Port %s" | msgid "Enable PoE Power Port %s" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | msgid "Enable meshing on the Ethernet interface" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "Enable meshing on the LAN interface" | msgid "Enable meshing on the LAN interface" | ||||||
| msgstr "Activer le réseau MESH sur le port LAN" | msgstr "Activer le réseau MESH sur le port LAN" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,6 +19,9 @@ msgstr "" | |||||||
| msgid "Enable PoE Power Port %s" | msgid "Enable PoE Power Port %s" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | msgid "Enable meshing on the Ethernet interface" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "Enable meshing on the LAN interface" | msgid "Enable meshing on the LAN interface" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -76,36 +76,37 @@ end | |||||||
| 
 | 
 | ||||||
| s = f:section(Section) | s = f:section(Section) | ||||||
| 
 | 
 | ||||||
| local mesh_wan = s:option(Flag, "mesh_wan", translate("Enable meshing on the WAN interface")) | local wired_mesh_help = { | ||||||
| mesh_wan.default = not uci:get_bool("network", "mesh_wan", "disabled") | 	single = translate('Enable meshing on the Ethernet interface'), | ||||||
|  | 	wan = translate('Enable meshing on the WAN interface'), | ||||||
|  | 	lan = translate('Enable meshing on the LAN interface'), | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| function mesh_wan:write(data) | local function wired_mesh(iface) | ||||||
| 	uci:set("network", "mesh_wan", "disabled", not data) | 	if not sysconfig[iface .. '_ifname'] then return end | ||||||
| end | 	local iface_roles = uci:get_list('gluon', 'iface_' .. iface, 'role') | ||||||
| 
 | 
 | ||||||
| if sysconfig.lan_ifname then | 	local option = s:option(Flag, 'mesh_' .. iface, wired_mesh_help[iface]) | ||||||
| 	s = f:section(Section) | 	option.default = util.contains(iface_roles, 'mesh') ~= false | ||||||
| 
 | 
 | ||||||
| 	local mesh_lan = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface")) | 	function option:write(data) | ||||||
| 	mesh_lan.default = not uci:get_bool("network", "mesh_lan", "disabled") | 		local roles = uci:get_list('gluon', 'iface_' .. iface, 'role') | ||||||
| 
 | 		if data then | ||||||
| 	function mesh_lan:write(data) | 			util.add_to_set(roles, 'mesh') | ||||||
| 		uci:set("network", "mesh_lan", "disabled", not data) | 		else | ||||||
| 
 | 			util.remove_from_set(roles, 'mesh') | ||||||
| 		local interfaces = uci:get_list("network", "client", "ifname") |  | ||||||
| 
 |  | ||||||
| 		for lanif in sysconfig.lan_ifname:gmatch('%S+') do |  | ||||||
| 			if data then |  | ||||||
| 				util.remove_from_set(interfaces, lanif) |  | ||||||
| 			else |  | ||||||
| 				util.add_to_set(interfaces, lanif) |  | ||||||
| 			end |  | ||||||
| 		end | 		end | ||||||
|  | 		uci:set_list('gluon', 'iface_' .. iface, 'role', roles) | ||||||
| 
 | 
 | ||||||
| 		uci:set_list("network", "client", "ifname", interfaces) | 		-- Reconfigure on next reboot | ||||||
|  | 		uci:set('gluon', 'core', 'reconfigure', true) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | wired_mesh('single') | ||||||
|  | wired_mesh('wan') | ||||||
|  | wired_mesh('lan') | ||||||
|  | 
 | ||||||
| local section | local section | ||||||
| uci:foreach("system", "gpio_switch", function(si) | uci:foreach("system", "gpio_switch", function(si) | ||||||
| 	if si[".name"]:match("poe") then | 	if si[".name"]:match("poe") then | ||||||
| @ -160,7 +161,7 @@ function f:write() | |||||||
| 		uci:delete("network", "wan6", "ip6gw") | 		uci:delete("network", "wan6", "ip6gw") | ||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 
 | 	uci:commit('gluon') | ||||||
| 	uci:commit("network") | 	uci:commit("network") | ||||||
| 	uci:commit('system') | 	uci:commit('system') | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user