Browse Source

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.
Matthias Schiffer 8 years ago
parent
commit
9a5a8e0ab0

+ 14 - 7
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')

+ 1 - 1
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

+ 1 - 9
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')