Use 'disabled' attribute instead of 'auto' to disable wired mesh interfaces
The 'auto' attribute still allows enabling the interface using ifup, which is not intended when wired mesh is disabled.
This commit is contained in:
parent
0b6f433478
commit
18b9174d03
@ -32,12 +32,12 @@ Mesh-on-WAN
|
|||||||
|
|
||||||
It's possible to enable Mesh-on-WAN like this::
|
It's possible to enable Mesh-on-WAN like this::
|
||||||
|
|
||||||
uci set network.mesh_wan.auto=1
|
uci set network.mesh_wan.disabled=0
|
||||||
uci commit network
|
uci commit network
|
||||||
|
|
||||||
It may be disabled by running::
|
It may be disabled by running::
|
||||||
|
|
||||||
uci set network.mesh_wan.auto=0
|
uci set network.mesh_wan.disabled=1
|
||||||
uci commit network
|
uci commit network
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ Mesh-on-LAN
|
|||||||
|
|
||||||
Configuring Mesh-on-LAN is a bit more complicated::
|
Configuring Mesh-on-LAN is a bit more complicated::
|
||||||
|
|
||||||
uci set network.mesh_lan.auto=1
|
uci set network.mesh_lan.disabled=0
|
||||||
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
|
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
|
||||||
uci del_list network.client.ifname=$ifname
|
uci del_list network.client.ifname=$ifname
|
||||||
done
|
done
|
||||||
@ -54,7 +54,7 @@ Configuring Mesh-on-LAN is a bit more complicated::
|
|||||||
|
|
||||||
It may be disabled by running::
|
It may be disabled by running::
|
||||||
|
|
||||||
uci set network.mesh_lan.auto=0
|
uci set network.mesh_lan.disabled=1
|
||||||
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
|
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
|
||||||
uci add_list network.client.ifname=$ifname
|
uci add_list network.client.ifname=$ifname
|
||||||
done
|
done
|
||||||
|
@ -17,7 +17,7 @@ if type(interfaces) == 'string' then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then
|
if sysconfig.lan_ifname and uci:get_bool('network', 'mesh_lan', 'disabled') then
|
||||||
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
||||||
util.add_to_set(interfaces, lanif)
|
util.add_to_set(interfaces, lanif)
|
||||||
end
|
end
|
||||||
|
@ -11,9 +11,14 @@ uci:section('network', 'interface', 'mesh_wan', {
|
|||||||
index = 0,
|
index = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
if uci:get('network', 'mesh_wan', 'auto') == nil then
|
local enable = site.mesh_on_wan(false)
|
||||||
uci:set('network', 'mesh_wan', 'auto', site.mesh_on_wan(false))
|
local old_auto = uci:get('network', 'mesh_wan', 'auto')
|
||||||
|
local old_disabled = uci:get('network', 'mesh_wan', 'disabled')
|
||||||
|
if old_auto ~= nil or old_disabled ~= nil then
|
||||||
|
enable = old_auto ~= '0' and old_disabled ~= '1'
|
||||||
end
|
end
|
||||||
|
uci:set('network', 'mesh_wan', 'disabled', not enable)
|
||||||
|
|
||||||
if uci:get('network', 'mesh_wan', 'transitive') == nil then
|
if uci:get('network', 'mesh_wan', 'transitive') == nil then
|
||||||
uci:set('network', 'mesh_wan', 'transitive', true)
|
uci:set('network', 'mesh_wan', 'transitive', true)
|
||||||
end
|
end
|
||||||
@ -21,6 +26,7 @@ if uci:get('network', 'mesh_wan', 'legacy') == nil then
|
|||||||
uci:set('network', 'mesh_wan', 'legacy', old_proto == 'gluon_mesh')
|
uci:set('network', 'mesh_wan', 'legacy', old_proto == 'gluon_mesh')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uci:delete('network', 'mesh_wan', 'auto')
|
||||||
uci:delete('network', 'mesh_wan', 'fixed_mtu')
|
uci:delete('network', 'mesh_wan', 'fixed_mtu')
|
||||||
|
|
||||||
uci:save('network')
|
uci:save('network')
|
||||||
|
@ -21,25 +21,28 @@ uci:section('network', 'interface', 'mesh_lan', {
|
|||||||
legacy = old_proto == 'gluon_mesh',
|
legacy = old_proto == 'gluon_mesh',
|
||||||
})
|
})
|
||||||
|
|
||||||
if uci:get('network', 'mesh_lan', 'auto') == nil then
|
local enable = site.mesh_on_lan(false)
|
||||||
local enable = site.mesh_on_lan(false)
|
local old_auto = uci:get('network', 'mesh_lan', 'auto')
|
||||||
|
local old_disabled = uci:get('network', 'mesh_lan', 'disabled')
|
||||||
|
if old_auto ~= nil or old_disabled ~= nil then
|
||||||
|
enable = old_auto ~= '0' and old_disabled ~= '1'
|
||||||
|
end
|
||||||
|
|
||||||
if enable then
|
if enable then
|
||||||
local interfaces = uci:get_list('network', 'client', 'ifname')
|
local interfaces = uci:get_list('network', 'client', 'ifname')
|
||||||
|
|
||||||
if interfaces then
|
if interfaces then
|
||||||
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
for lanif in sysconfig.lan_ifname:gmatch('%S+') do
|
||||||
if util.contains(interfaces, lanif) then
|
if util.contains(interfaces, lanif) then
|
||||||
enable = false
|
enable = false
|
||||||
break
|
break
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
uci:set('network', 'mesh_lan', 'auto', enable)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uci:set('network', 'mesh_lan', 'disabled', not enable)
|
||||||
|
|
||||||
if uci:get('network', 'mesh_lan', 'transitive') == nil then
|
if uci:get('network', 'mesh_lan', 'transitive') == nil then
|
||||||
uci:set('network', 'mesh_lan', 'transitive', true)
|
uci:set('network', 'mesh_lan', 'transitive', true)
|
||||||
end
|
end
|
||||||
@ -47,6 +50,7 @@ if uci:get('network', 'mesh_lan', 'legacy') == nil then
|
|||||||
uci:set('network', 'mesh_lan', 'legacy', old_proto == 'gluon_mesh')
|
uci:set('network', 'mesh_lan', 'legacy', old_proto == 'gluon_mesh')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uci:delete('network', 'mesh_lan', 'auto')
|
||||||
uci:delete('network', 'mesh_lan', 'fixed_mtu')
|
uci:delete('network', 'mesh_lan', 'fixed_mtu')
|
||||||
|
|
||||||
uci:save('network')
|
uci:save('network')
|
||||||
|
@ -77,10 +77,10 @@ end
|
|||||||
local s = f:section(Section)
|
local s = f:section(Section)
|
||||||
|
|
||||||
local mesh_wan = s:option(Flag, "mesh_wan", translate("Enable meshing on the WAN interface"))
|
local mesh_wan = s:option(Flag, "mesh_wan", translate("Enable meshing on the WAN interface"))
|
||||||
mesh_wan.default = uci:get_bool("network", "mesh_wan", "auto")
|
mesh_wan.default = not uci:get_bool("network", "mesh_wan", "disabled")
|
||||||
|
|
||||||
function mesh_wan:write(data)
|
function mesh_wan:write(data)
|
||||||
uci:set("network", "mesh_wan", "auto", data)
|
uci:set("network", "mesh_wan", "disabled", not data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local mesh_wan_legacy = s:option(Flag, "mesh_wan_legacy", translate("Use legacy mode for WAN meshing"))
|
local mesh_wan_legacy = s:option(Flag, "mesh_wan_legacy", translate("Use legacy mode for WAN meshing"))
|
||||||
@ -95,10 +95,10 @@ if sysconfig.lan_ifname then
|
|||||||
local s = f:section(Section)
|
local s = f:section(Section)
|
||||||
|
|
||||||
local mesh_lan = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface"))
|
local mesh_lan = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface"))
|
||||||
mesh_lan.default = uci:get_bool("network", "mesh_lan", "auto")
|
mesh_lan.default = not uci:get_bool("network", "mesh_lan", "disabled")
|
||||||
|
|
||||||
function mesh_lan:write(data)
|
function mesh_lan:write(data)
|
||||||
uci:set("network", "mesh_lan", "auto", data)
|
uci:set("network", "mesh_lan", "disabled", not data)
|
||||||
|
|
||||||
local interfaces = uci:get_list("network", "client", "ifname")
|
local interfaces = uci:get_list("network", "client", "ifname")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user