Skip to content

Commit

Permalink
remove hostname metadata from local end of connection. We should be u…
Browse files Browse the repository at this point in the history
…sing the hostnodeid
  • Loading branch information
paulbellamy committed Feb 19, 2016
1 parent 01b3651 commit 9b280e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
20 changes: 8 additions & 12 deletions probe/endpoint/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ func (r *Reporter) Report() (report.Report, error) {
Conntracked: "true",
})
r.flowWalker.walkFlows(func(f flow) {
var (
fromAddr, fromPort = f.Original.Layer3.SrcIP, uint16(f.Original.Layer4.SrcPort)
toAddr, toPort = f.Original.Layer3.DstIP, uint16(f.Original.Layer4.DstPort)
tuple = fourTuple{fromAddr, toAddr, fromPort, toPort}
)
tuple := fourTuple{
f.Original.Layer3.SrcIP,
f.Original.Layer3.DstIP,
uint16(f.Original.Layer4.SrcPort),
uint16(f.Original.Layer4.DstPort),
}
seenTuples[tuple.key()] = tuple
r.addConnection(&rpt, tuple, &extraNodeInfo, &extraNodeInfo)
})
Expand Down Expand Up @@ -172,13 +173,8 @@ func (r *Reporter) addConnection(rpt *report.Report, t fourTuple, extraFromNode,
var (
fromAddressNodeID = report.MakeAddressNodeID(r.hostID, t.fromAddr)
toAddressNodeID = report.MakeAddressNodeID(r.hostID, t.toAddr)
fromNode = report.MakeNodeWith(map[string]string{
"name": r.hostName,
Addr: t.fromAddr,
}).WithEdge(toAddressNodeID, report.EdgeMetadata{})
toNode = report.MakeNodeWith(map[string]string{
Addr: t.toAddr,
})
fromNode = report.MakeNodeWith(map[string]string{Addr: t.fromAddr}).WithEdge(toAddressNodeID, report.EdgeMetadata{})
toNode = report.MakeNodeWith(map[string]string{Addr: t.toAddr})
)

// In case we have a reverse resolution for the IP, we can use it for
Expand Down
6 changes: 0 additions & 6 deletions probe/endpoint/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strconv"
"testing"

"github.com/weaveworks/scope/probe/docker"
"github.com/weaveworks/scope/probe/endpoint"
"github.com/weaveworks/scope/probe/endpoint/procspy"
"github.com/weaveworks/scope/report"
Expand Down Expand Up @@ -85,11 +84,6 @@ func TestSpyNoProcesses(t *testing.T) {
scopedRemote = report.MakeAddressNodeID(nodeID, fixRemoteAddress.String())
)

have, _ := r.Address.Nodes[scopedLocal].Latest.Lookup(docker.Name)
if want, have := nodeName, have; want != have {
t.Fatalf("want %q, have %q", want, have)
}

if want, have := 1, len(r.Address.Nodes[scopedRemote].Adjacency); want != have {
t.Fatalf("want %d, have %d", want, have)
}
Expand Down

0 comments on commit 9b280e3

Please sign in to comment.