From 30b04d90432ee6a6eb274d83df59dde816d52ba0 Mon Sep 17 00:00:00 2001 From: Geno Date: Thu, 17 Mar 2016 11:51:45 +0100 Subject: [PATCH] add mac from nodeinfo (not from neigbours) in graphbuilder --- models/graph.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/models/graph.go b/models/graph.go index 67b1fb4..2414da9 100644 --- a/models/graph.go +++ b/models/graph.go @@ -48,8 +48,24 @@ func (nodes *Nodes) BuildGraph(vpnAddresses []string) *Graph { func (builder *GraphBuilder) readNodes(nodes map[string]*Node) { // Fill mac->id map for sourceId, node := range nodes { - if neighbours := node.Neighbours; neighbours != nil { - for sourceAddress, _ := range neighbours.Batadv { + if nodeinfo := node.Nodeinfo; nodeinfo != nil { + for _, sourceAddress := range nodeinfo.Network.Mesh.Bat0.Interfaces.Tunnel { + builder.macToID[sourceAddress] = sourceId + + // is VPN address? + if _, found := builder.vpn[sourceAddress]; found { + builder.vpn[sourceId] = nil + } + } + for _, sourceAddress := range nodeinfo.Network.Mesh.Bat0.Interfaces.Wireless { + builder.macToID[sourceAddress] = sourceId + + // is VPN address? + if _, found := builder.vpn[sourceAddress]; found { + builder.vpn[sourceId] = nil + } + } + for _, sourceAddress := range nodeinfo.Network.Mesh.Bat0.Interfaces.Other { builder.macToID[sourceAddress] = sourceId // is VPN address?