Skip to content

Commit

Permalink
while doing ipset restore, ensure sets are flushed before adding entries
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-reddy authored and aauren committed Mar 18, 2021
1 parent 187a3f2 commit 99cb40b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/utils/ipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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[:], " "))
}
Expand Down

0 comments on commit 99cb40b

Please sign in to comment.