Skip to content

Commit

Permalink
Don't every store NEW conntrack flows (only every store updates). (#1541
Browse files Browse the repository at this point in the history
)

This closes a small window where we might produce reports which contain flows that are NEW but have never seen an UPDATE, which can potentially be invalid.
  • Loading branch information
tomwilkie committed May 27, 2016
1 parent 7377945 commit 277bd70
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions probe/endpoint/conntrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@ func (c *conntrackWalker) handleFlow(f flow, forceAdd bool) {
c.Lock()
defer c.Unlock()

// Ignore flows for which we never saw an update; they are likely
// incomplete or wrong. See #1462.
switch {
case forceAdd || f.Type == newType || f.Type == updateType:
case forceAdd || f.Type == updateType:
if f.Independent.State != timeWait {
c.activeFlows[f.Independent.ID] = f
} else if _, ok := c.activeFlows[f.Independent.ID]; ok {
Expand All @@ -316,11 +318,7 @@ func (c *conntrackWalker) handleFlow(f flow, forceAdd bool) {
case f.Type == destroyType:
if active, ok := c.activeFlows[f.Independent.ID]; ok {
delete(c.activeFlows, f.Independent.ID)
// Ignore flows for which we never saw an update; they are likely
// incomplete or wrong. See #1462.
if active.Type == updateType {
c.bufferedFlows = append(c.bufferedFlows, active)
}
c.bufferedFlows = append(c.bufferedFlows, active)
}
}
}
Expand Down

0 comments on commit 277bd70

Please sign in to comment.