gluon-mesh-batman-adv-core/gluon-luci-portconfig: fix configuration of br-client ifname with multiple interfaces in lan_ifname
There are a few devices on which lan_ifname contains multiple interface names separated by spaces.
This commit is contained in:
parent
84b6374970
commit
557a073dc7
@ -13,6 +13,7 @@ $Id$
|
||||
]]--
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
local lutil = require 'luci.util'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
|
||||
local wan = uci:get_all("network", "wan")
|
||||
@ -121,10 +122,15 @@ function f.handle(self, state, data)
|
||||
if sysconfig.lan_ifname then
|
||||
uci:set("network", "mesh_lan", "auto", data.mesh_lan)
|
||||
|
||||
local doit
|
||||
if data.mesh_lan == '1' then
|
||||
uci:remove_from_set("network", "client", "ifname", sysconfig.lan_ifname)
|
||||
doit = uci.remove_from_set
|
||||
else
|
||||
uci:add_to_set("network", "client", "ifname", sysconfig.lan_ifname)
|
||||
doit = uci.add_to_set
|
||||
end
|
||||
|
||||
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
|
||||
doit(uci, "network", "client", "ifname", lanif)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local sysctl = require 'gluon.sysctl'
|
||||
local site = require 'gluon.site_config'
|
||||
|
||||
local uci = require('luci.model.uci').cursor()
|
||||
local lutil = require 'luci.util'
|
||||
|
||||
|
||||
local gw_sel_class
|
||||
@ -28,7 +30,9 @@ if not uci:get('network', 'client', 'ifname') then
|
||||
uci:add_to_set('network', 'client', 'ifname', 'bat0')
|
||||
|
||||
if sysconfig.lan_ifname and not site.mesh_on_lan then
|
||||
uci:add_to_set('network', 'client', 'ifname', sysconfig.lan_ifname)
|
||||
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
|
||||
uci:add_to_set('network', 'client', 'ifname', lanif)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -13,8 +13,13 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
|
||||
if enable then
|
||||
local interfaces = uci:get_list('network', 'client', 'ifname')
|
||||
|
||||
if interfaces and lutil.contains(interfaces, sysconfig.lan_ifname) then
|
||||
enable = false
|
||||
if interfaces then
|
||||
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
|
||||
if lutil.contains(interfaces, lanif) then
|
||||
enable = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user