add mac from nodeinfo (not from neigbours) in graphbuilder

This commit is contained in:
Geno 2016-03-17 11:51:45 +01:00
parent 9e863ca336
commit 30b04d9043

View File

@ -48,8 +48,24 @@ func (nodes *Nodes) BuildGraph(vpnAddresses []string) *Graph {
func (builder *GraphBuilder) readNodes(nodes map[string]*Node) { func (builder *GraphBuilder) readNodes(nodes map[string]*Node) {
// Fill mac->id map // Fill mac->id map
for sourceId, node := range nodes { for sourceId, node := range nodes {
if neighbours := node.Neighbours; neighbours != nil { if nodeinfo := node.Nodeinfo; nodeinfo != nil {
for sourceAddress, _ := range neighbours.Batadv { 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 builder.macToID[sourceAddress] = sourceId
// is VPN address? // is VPN address?