Skip to content

Commit

Permalink
Preserve results when NLM_F_DUMP_INTR is set
Browse files Browse the repository at this point in the history
Similar to #1018, but for
ConntrackDeleteFilters()

Relates to kubernetes/kubernetes#129562
  • Loading branch information
adrianmoisey authored and aboch committed Jan 21, 2025
1 parent 86d2f69 commit 3642538
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions conntrack_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,18 @@ func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFami
// ConntrackDeleteFilters deletes entries on the specified table matching any of the specified filters using the netlink handle passed
// conntrack -D [table] parameters Delete conntrack or expectation
func (h *Handle) ConntrackDeleteFilters(table ConntrackTableType, family InetFamily, filters ...CustomConntrackFilter) (uint, error) {
var errMsgs []string
res, err := h.dumpConntrackTable(table, family)
if err != nil {
return 0, err
if !errors.Is(err, ErrDumpInterrupted) {
return 0, err
}
// This allows us to at least do a best effort to try to clean the
// entries matching the filter.
errMsgs = append(errMsgs, err.Error())
}

var matched uint
var errMsgs []string
for _, dataRaw := range res {
flow := parseRawData(dataRaw)
for _, filter := range filters {
Expand Down

0 comments on commit 3642538

Please sign in to comment.