From 6c90ef3ad6dc5781b5755b692a54bbaaa85cc35b Mon Sep 17 00:00:00 2001 From: Andreas Pflug Date: Mon, 7 Jun 2021 16:20:33 +0200 Subject: [PATCH] v0.1.8: IPTABLES_SAVE=iptables-nft-save support --- Makefile | 2 +- iptables/iptables.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index feb0ed2..43e2d26 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build ENVVAR = GOOS=linux GOARCH=amd64 -TAG = v0.1.7 +TAG = v0.1.8 APP_NAME = calico-accountant REPO = andreas-p IMAGE_TAG = $(REPO)/$(APP_NAME):$(TAG) diff --git a/iptables/iptables.go b/iptables/iptables.go index 6e08011..1140c4f 100755 --- a/iptables/iptables.go +++ b/iptables/iptables.go @@ -5,6 +5,7 @@ import ( "bytes" "errors" "io" + "os" "os/exec" "regexp" "sort" @@ -88,7 +89,12 @@ var ( ) func iptablesSave(interfaceToWorkload map[string]*apiv3.WorkloadEndpoint) ([]*Result, error) { - cmd := exec.Command("iptables-save", "-t", "filter", "-c") + saveCommand, ok := os.LookupEnv("IPTABLES_SAVE") + if !ok { + saveCommand = "iptables-save" + } + + cmd := exec.Command(saveCommand, "-t", "filter", "-c") stdout, err := cmd.StdoutPipe() if err != nil {