diff --git a/probe/endpoint/connection_tracker.go b/probe/endpoint/connection_tracker.go index 1c944a1c17..136ee59f58 100644 --- a/probe/endpoint/connection_tracker.go +++ b/probe/endpoint/connection_tracker.go @@ -91,24 +91,17 @@ func (t *connectionTracker) ReportConnections(rpt *report.Report) { t.useProcfs() } - // seenTuples contains information about connections seen by - // conntrack - seenTuples := t.performFlowWalk(rpt) - - if t.conf.WalkProc && t.conf.Scanner != nil { - t.performWalkProc(rpt, hostNodeID, seenTuples) - } -} - -// performFlowWalk consults the flowWalker for short-lived connections -func (t *connectionTracker) performFlowWalk(rpt *report.Report) map[string]fourTuple { + // consult the flowWalker for short-lived (conntracked) connections seenTuples := map[string]fourTuple{} t.flowWalker.walkFlows(func(f flow, alive bool) { tuple := flowToTuple(f) seenTuples[tuple.key()] = tuple t.addConnection(rpt, false, tuple, "", nil, nil) }) - return seenTuples + + if t.conf.WalkProc && t.conf.Scanner != nil { + t.performWalkProc(rpt, hostNodeID, seenTuples) + } } func (t *connectionTracker) existingFlows() map[string]fourTuple {