Skip to content

Commit

Permalink
[BUG] fix target.hostname of links
Browse files Browse the repository at this point in the history
Before this commit, the value of target.hostname was incorrect.
It was accidentially pointing to the hostname of the source of
the link. This means target.hostname was equal to source.hostname.

Fixes: #197
Fixes: 0325aad
PR: #200
  • Loading branch information
lemoer committed Apr 3, 2021
1 parent a76df9b commit 3aac902
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) {
for sourceMAC, batadv := range neighbours.Batadv {
for neighbourMAC, link := range batadv.Neighbours {
if neighbourID := nodes.ifaceToNodeID[neighbourMAC]; neighbourID != "" {
neighbour := nodes.List[neighbours.NodeID]
neighbour := nodes.List[neighbourID]

link := Link{
SourceID: neighbours.NodeID,
Expand All @@ -128,10 +128,10 @@ func (nodes *Nodes) NodeLinks(node *Node) (result []Link) {
}

if neighbour.Nodeinfo != nil {
link.SourceHostname = neighbour.Nodeinfo.Hostname
link.TargetHostname = neighbour.Nodeinfo.Hostname
}
if node.Nodeinfo != nil {
link.TargetHostname = node.Nodeinfo.Hostname
link.SourceHostname = node.Nodeinfo.Hostname
}

result = append(result, link)
Expand Down

0 comments on commit 3aac902

Please sign in to comment.