Skip to content

Commit

Permalink
endpoint: Skip conntrack clean on endpoint restore
Browse files Browse the repository at this point in the history
The commit cb49db5 introduced conntrack cleaning on the initial endpoint
build to clean eventual state from a previous endpoint build. This is correct
in principle but the commit missed to exclude endpoint builds triggered by
restored endpoints.

Fixes: cb49db5 ("endpoint: Clear conntrack on initial endpoint build")

Signed-off-by: Thomas Graf <thomas@cilium.io>
  • Loading branch information
tgraf committed Oct 15, 2018
1 parent 46292fc commit b6f9dcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions daemon/state.go
Expand Up @@ -130,6 +130,8 @@ func (d *Daemon) restoreOldEndpoints(dir string, clean bool) (*endpointRestoreSt

ep.Unlock()

ep.SkipStateClean()

state.restored = append(state.restored, ep)

delete(existingEndpoints, ep.IPv4.String())
Expand Down
13 changes: 13 additions & 0 deletions pkg/endpoint/endpoint.go
Expand Up @@ -2759,3 +2759,16 @@ func (e *Endpoint) scrubIPsInConntrackTable() {
e.scrubIPsInConntrackTableLocked()
e.Unlock()
}

// SkipStateClean can be called on a endpoint before its first build to skip
// the cleaning of state such as the conntrack table. This is useful when an
// endpoint is being restored from state and the datapath state should not be
// claned.
//
// The endpoint lock must NOT be held.
func (e *Endpoint) SkipStateClean() {
// Mark conntrack as already cleaned
e.UnconditionalLock()
e.ctCleaned = true
e.Unlock()
}

0 comments on commit b6f9dcc

Please sign in to comment.