Skip to content

Commit

Permalink
In the Endpoint && Addr topology, we can't assume pseudo nodes have a…
Browse files Browse the repository at this point in the history
…n adjacency coming _from_ them.
  • Loading branch information
Tom Wilkie committed Sep 2, 2015
1 parent 0217351 commit 61f45b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions render/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func MapEndpointIdentity(m report.NodeMetadata, local report.Networks) Renderabl

// We are a 'client' pseudo node if the port is in the ephemeral port range.
// Linux uses 32768 to 61000.
if p, err := strconv.Atoi(port); err == nil && p >= 32768 && p < 61000 {
if p, err := strconv.Atoi(port); err == nil && len(m.Adjacency) > 0 && p >= 32768 && p < 61000 {
// We only exist if there is something in our adjacency
// Generate a single pseudo node for every (client ip, server ip, server port)
dstNodeID := m.Adjacency[0]
Expand Down Expand Up @@ -170,8 +170,11 @@ func MapAddressIdentity(m report.NodeMetadata, local report.Networks) Renderable
}

// Otherwise generate a pseudo node for every
_, dstID, _ := report.ParseAddressNodeID(m.Adjacency[0])
outputID := MakePseudoNodeID(addr, dstID)
outputID := MakePseudoNodeID(addr, "")
if len(m.Adjacency) > 0 {
_, dstAddr, _ := report.ParseAddressNodeID(m.Adjacency[0])
outputID = MakePseudoNodeID(addr, dstAddr)
}
return RenderableNodes{outputID: newPseudoNode(outputID, addr, "")}
}

Expand Down

0 comments on commit 61f45b2

Please sign in to comment.