gluon-client-bridge: add LAN interfaces to client bridge by default (instead of doing this in the batman-adv-specific scripts)

This allows to weaken the gluon-mesh-batman-adv-core dependency of
gluon-luci-portconfig to gluon-client-bridge.
This commit is contained in:
Matthias Schiffer 2016-05-01 14:21:20 +02:00
parent 8434896014
commit 9a5a8e0ab0
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
3 changed files with 16 additions and 17 deletions

View File

@ -1,16 +1,16 @@
#!/usr/bin/lua #!/usr/bin/lua
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
local lutil = require 'luci.util'
local uci = require('luci.model.uci').cursor() local uci = require('luci.model.uci').cursor()
if not uci:get('network', 'client') then uci:section('network', 'interface', 'client',
uci:section('network', 'interface', 'client',
{ {
type = 'bridge', type = 'bridge',
} }
) )
end
local ifname = uci:get('network', 'client', 'ifname') local ifname = uci:get('network', 'client', 'ifname')
@ -21,6 +21,13 @@ if type(ifname) == 'string' then
end end
end end
if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
uci:add_to_set('network', 'client', 'ifname', lanif)
end
end
uci:set('network', 'client', 'macaddr', sysconfig.primary_mac) uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
uci:save('network') uci:save('network')

View File

@ -18,7 +18,7 @@ define Package/gluon-luci-portconfig
SECTION:=gluon SECTION:=gluon
CATEGORY:=Gluon CATEGORY:=Gluon
TITLE:=Luci module for advanced ethernet port configuration TITLE:=Luci module for advanced ethernet port configuration
DEPENDS:=+gluon-luci-admin +gluon-mesh-batman-adv DEPENDS:=+gluon-luci-admin +gluon-client-bridge
endef endef
define Build/Prepare define Build/Prepare

View File

@ -5,7 +5,6 @@ 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
@ -25,15 +24,8 @@ uci:section('batman-adv', 'mesh', 'bat0',
) )
uci:save('batman-adv') uci:save('batman-adv')
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', 'bat0')
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
uci:add_to_set('network', 'client', 'ifname', lanif)
end
end
end
uci:set('network', 'client', 'proto', 'dhcpv6') uci:set('network', 'client', 'proto', 'dhcpv6')
uci:set('network', 'client', 'reqprefix', 'no') uci:set('network', 'client', 'reqprefix', 'no')