Skip to content
Snippets Groups Projects
Commit 557a073d authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-mesh-batman-adv-core/gluon-luci-portconfig: fix configuration of...

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.
parent 84b63749
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ $Id$ ...@@ -13,6 +13,7 @@ $Id$
]]-- ]]--
local uci = luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local lutil = require 'luci.util'
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
local wan = uci:get_all("network", "wan") local wan = uci:get_all("network", "wan")
...@@ -121,10 +122,15 @@ function f.handle(self, state, data) ...@@ -121,10 +122,15 @@ function f.handle(self, state, data)
if sysconfig.lan_ifname then if sysconfig.lan_ifname then
uci:set("network", "mesh_lan", "auto", data.mesh_lan) uci:set("network", "mesh_lan", "auto", data.mesh_lan)
local doit
if data.mesh_lan == '1' then if data.mesh_lan == '1' then
uci:remove_from_set("network", "client", "ifname", sysconfig.lan_ifname) doit = uci.remove_from_set
else 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
end end
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
local sysctl = require 'gluon.sysctl' local sysctl = require 'gluon.sysctl'
local site = require 'gluon.site_config' local site = require 'gluon.site_config'
local uci = require('luci.model.uci').cursor() local uci = require('luci.model.uci').cursor()
local lutil = require 'luci.util'
local gw_sel_class local gw_sel_class
...@@ -28,7 +30,9 @@ if not uci:get('network', 'client', 'ifname') then ...@@ -28,7 +30,9 @@ if not uci:get('network', 'client', 'ifname') then
uci:add_to_set('network', 'client', 'ifname', 'bat0') uci:add_to_set('network', 'client', 'ifname', 'bat0')
if sysconfig.lan_ifname and not site.mesh_on_lan then 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
end end
......
...@@ -13,8 +13,13 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then ...@@ -13,8 +13,13 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
if enable then if enable then
local interfaces = uci:get_list('network', 'client', 'ifname') local interfaces = uci:get_list('network', 'client', 'ifname')
if interfaces and lutil.contains(interfaces, sysconfig.lan_ifname) then if interfaces then
enable = false for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
if lutil.contains(interfaces, lanif) then
enable = false
break
end
end
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment