From 9a5a8e0ab0715852b3b6fd56a4d8861b851ed674 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 1 May 2016 14:21:20 +0200 Subject: [PATCH] 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. --- .../upgrade/300-gluon-client-bridge-network | 21 ++++++++++++------- package/gluon-luci-portconfig/Makefile | 2 +- .../310-gluon-mesh-batman-adv-core-mesh | 10 +-------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network index 4a897f74..f5ab8582 100755 --- a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network @@ -1,16 +1,16 @@ #!/usr/bin/lua local sysconfig = require 'gluon.sysconfig' + +local lutil = require 'luci.util' local uci = require('luci.model.uci').cursor() -if not uci:get('network', 'client') then - uci:section('network', 'interface', 'client', - { - type = 'bridge', - } - ) -end +uci:section('network', 'interface', 'client', + { + type = 'bridge', + } +) local ifname = uci:get('network', 'client', 'ifname') @@ -21,6 +21,13 @@ if type(ifname) == 'string' then 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:save('network') diff --git a/package/gluon-luci-portconfig/Makefile b/package/gluon-luci-portconfig/Makefile index e2d0a225..d4590864 100644 --- a/package/gluon-luci-portconfig/Makefile +++ b/package/gluon-luci-portconfig/Makefile @@ -18,7 +18,7 @@ define Package/gluon-luci-portconfig SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci module for advanced ethernet port configuration - DEPENDS:=+gluon-luci-admin +gluon-mesh-batman-adv + DEPENDS:=+gluon-luci-admin +gluon-client-bridge endef define Build/Prepare diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh index 3224768c..4710d47c 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh @@ -5,7 +5,6 @@ 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 @@ -25,15 +24,8 @@ uci:section('batman-adv', 'mesh', 'bat0', ) 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 - for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do - uci:add_to_set('network', 'client', 'ifname', lanif) - end - end -end +uci:add_to_set('network', 'client', 'ifname', 'bat0') uci:set('network', 'client', 'proto', 'dhcpv6') uci:set('network', 'client', 'reqprefix', 'no')