From b92dfcb966d64c747fc6fd9bcf7d0ae6e39a32c2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Feb 2017 08:54:48 +0100 Subject: [PATCH] Move creation of local-node device from gluon-mesh-batman-adv-core to gluon-client-bridge Prepare reverting the roles of br-client and local-node to their state before 8c4403ba115f. --- package/gluon-client-bridge/Makefile | 2 +- .../310-gluon-client-bridge-local-node | 32 +++++++++++++++++++ package/gluon-mesh-batman-adv-core/Makefile | 2 +- .../330-gluon-mesh-batman-adv-core-local-node | 23 +++---------- 4 files changed, 38 insertions(+), 21 deletions(-) create mode 100755 package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node diff --git a/package/gluon-client-bridge/Makefile b/package/gluon-client-bridge/Makefile index 57d5b314..7f967ab4 100644 --- a/package/gluon-client-bridge/Makefile +++ b/package/gluon-client-bridge/Makefile @@ -12,7 +12,7 @@ define Package/gluon-client-bridge SECTION:=gluon CATEGORY:=Gluon TITLE:=Provides a bridge and a wireless interface for clients to connect to - DEPENDS:=+gluon-core + DEPENDS:=+gluon-core +kmod-macvlan endef define Build/Prepare diff --git a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node new file mode 100755 index 00000000..57ca68ff --- /dev/null +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node @@ -0,0 +1,32 @@ +#!/usr/bin/lua + +local sysconfig = require 'gluon.sysconfig' + +local uci = require('simple-uci').cursor() + + +uci:delete('network', 'local_node_dev') +uci:section('network', 'device', 'local_node_dev', { + name = 'local-node', + ifname = 'br-client', + type = 'macvlan', + macaddr = sysconfig.primary_mac, +}) + +uci:delete('network', 'local_node') +uci:section('network', 'interface', 'local_node', { + ifname = 'local-node', + proto = 'none', + auto = true, +}) + +uci:save('network') + + +uci:delete('dhcp', 'local_node') +uci:section('dhcp', 'dhcp', 'local_node', { + interface = 'local_node', + ignore = true, +}) + +uci:save('dhcp') diff --git a/package/gluon-mesh-batman-adv-core/Makefile b/package/gluon-mesh-batman-adv-core/Makefile index d476d4f8..cb51f7d5 100644 --- a/package/gluon-mesh-batman-adv-core/Makefile +++ b/package/gluon-mesh-batman-adv-core/Makefile @@ -13,7 +13,7 @@ define Package/gluon-mesh-batman-adv-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for batman-adv meshing (core) - DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +gluon-ebtables +firewall +libiwinfo +kmod-dummy +kmod-macvlan +libnl-tiny + DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +gluon-ebtables +firewall +libiwinfo +kmod-dummy +libnl-tiny endef define Build/Prepare diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node index f26ba1a0..d281b2c1 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node @@ -1,5 +1,9 @@ #!/usr/bin/lua +-- This script must be ordered after 310-gluon-client-bridge-local-node, as +-- it overrides parts of network.local_node + + local site = require 'gluon.site_config' local sysconfig = require 'gluon.sysconfig' local sysctl = require 'gluon.sysctl' @@ -7,17 +11,7 @@ local sysctl = require 'gluon.sysctl' local uci = require('simple-uci').cursor() -uci:delete('network', 'local_node_dev') -uci:section('network', 'device', 'local_node_dev', { - name = 'local-node', - ifname = 'br-client', - type = 'macvlan', - macaddr = sysconfig.primary_mac, -}) - -uci:delete('network', 'local_node') uci:section('network', 'interface', 'local_node', { - ifname = 'local-node', proto = 'dhcpv6', reqprefix = 'no', peerdns = not (site.dns and site.dns.servers), @@ -54,13 +48,4 @@ uci:section('firewall', 'rule', 'local_node_dns', { uci:save('firewall') -uci:delete('dhcp', 'local_node') -uci:section('dhcp', 'dhcp', 'local_node', { - interface = 'local_node', - ignore = true, -}) - -uci:save('dhcp') - - sysctl.set('net.ipv6.conf.local_node.forwarding', 0)