From 99cb40b0869719fb614e828a32b6d3de81ba7409 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Fri, 12 Mar 2021 00:27:40 +0530 Subject: [PATCH] while doing ipset restore, ensure sets are flushed before adding entries --- pkg/utils/ipset.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/utils/ipset.go b/pkg/utils/ipset.go index b62de0ee..ce06674e 100644 --- a/pkg/utils/ipset.go +++ b/pkg/utils/ipset.go @@ -403,6 +403,7 @@ func buildIPSetRestore(ipset *IPSet) string { ipSetRestore := "" for _, set := range ipset.Sets { ipSetRestore += fmt.Sprintf("create %s %s\n", set.Name, strings.Join(set.Options[:], " ")) + ipSetRestore += fmt.Sprintf("flush %s\n", set.Name) for _, entry := range set.Entries { ipSetRestore += fmt.Sprintf("add %s %s\n", set.Name, strings.Join(entry.Options[:], " ")) }