luci-portconfig: allow toggling of mesh_on_lan
This commit is contained in:
		
							parent
							
								
									39d0c8f459
								
							
						
					
					
						commit
						d4c3467bc3
					
				| @ -13,6 +13,7 @@ $Id$ | |||||||
| ]]-- | ]]-- | ||||||
| 
 | 
 | ||||||
| local uci = luci.model.uci.cursor() | local uci = luci.model.uci.cursor() | ||||||
|  | local sysconfig = require 'gluon.sysconfig' | ||||||
| 
 | 
 | ||||||
| local wan = uci:get_all("network", "wan") | local wan = uci:get_all("network", "wan") | ||||||
| local wan6 = uci:get_all("network", "wan6") | local wan6 = uci:get_all("network", "wan6") | ||||||
| @ -86,6 +87,13 @@ o = s:option(Flag, "mesh_wan", translate("Enable meshing on the WAN interface")) | |||||||
| o.default = uci:get_bool("network", "mesh_wan", "auto") and o.enabled or o.disabled | o.default = uci:get_bool("network", "mesh_wan", "auto") and o.enabled or o.disabled | ||||||
| o.rmempty = false | o.rmempty = false | ||||||
| 
 | 
 | ||||||
|  | if sysconfig.lan_ifname then | ||||||
|  |   o = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface")) | ||||||
|  |   o.default = uci:get_bool("network", "mesh_lan", "auto") and o.enabled or o.disabled | ||||||
|  |   o.rmempty = false | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| function f.handle(self, state, data) | function f.handle(self, state, data) | ||||||
|   if state == FORM_VALID then |   if state == FORM_VALID then | ||||||
|     uci:set("network", "wan", "proto", data.ipv4) |     uci:set("network", "wan", "proto", data.ipv4) | ||||||
| @ -110,6 +118,16 @@ function f.handle(self, state, data) | |||||||
| 
 | 
 | ||||||
|     uci:set("network", "mesh_wan", "auto", data.mesh_wan) |     uci:set("network", "mesh_wan", "auto", data.mesh_wan) | ||||||
| 
 | 
 | ||||||
|  |     if sysconfig.lan_ifname then | ||||||
|  |       uci:set("network", "mesh_lan", "auto", data.mesh_lan) | ||||||
|  | 
 | ||||||
|  |       if data.mesh_lan == '1' then | ||||||
|  |         uci:set("network", "client", "ifname", "bat0") | ||||||
|  |       else | ||||||
|  |         uci:set("network", "client", "ifname", sysconfig.lan_ifname .. " bat0") | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|     uci:save("network") |     uci:save("network") | ||||||
|     uci:commit("network") |     uci:commit("network") | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,6 +19,9 @@ msgstr "Automatisch (RA/DHCPv6)" | |||||||
| msgid "Enable meshing on the WAN interface" | msgid "Enable meshing on the WAN interface" | ||||||
| msgstr "Mesh auf dem WAN-Port aktivieren" | msgstr "Mesh auf dem WAN-Port aktivieren" | ||||||
| 
 | 
 | ||||||
|  | msgid "Enable meshing on the LAN interface" | ||||||
|  | msgstr "Mesh auf dem LAN-Port aktivieren" | ||||||
|  | 
 | ||||||
| msgid "Static" | msgid "Static" | ||||||
| msgstr "Statisch" | msgstr "Statisch" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -10,6 +10,9 @@ msgstr "" | |||||||
| msgid "Enable meshing on the WAN interface" | msgid "Enable meshing on the WAN interface" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | msgid "Enable meshing on the LAN interface" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "Static" | msgid "Static" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user