From ae4c130c74cc70ea0a62d6b97e9c6ce7416223fd Mon Sep 17 00:00:00 2001
From: Nils Schneider <nils@nilsschneider.net>
Date: Sun, 13 Jul 2014 09:02:02 +0200
Subject: [PATCH] gluon-mesh-batman-adv: announce MAC of mesh ifaces

This will make a node announce all MACs of its interfaces participating
in the batman-adv mesh. This enables other nodes to associate the
announced object with both the data reported by batadv-vis as well as a
simple list of neighbours as output by `iw dev $IFACE station dump`.
---
 .../announce/announce.d/network/mesh_interfaces   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces

diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces
new file mode 100644
index 000000000..d078fcb16
--- /dev/null
+++ b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces
@@ -0,0 +1,15 @@
+require 'ubus'
+
+local conn = ubus.connect()
+local list = util.exec('batctl if')
+
+local interfaces = {}
+for _, line in ipairs(util.split(list)) do
+	local ifname = line:match('^(.-):')
+	if ifname ~= nil then
+		local status = conn:call("network.device", "status", { name = ifname })
+		table.insert(interfaces, status['macaddr'])
+	end
+end
+
+return interfaces
-- 
GitLab