Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion npm/pkg/dataplane/policies/chain-management_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (pMgr *PolicyManager) detectIptablesVersion() error {
}

klog.Info("second attempt detecting iptables version. looking for hint/canary chain in iptables-legacy")
if pMgr.hintOrCanaryChainExist(util.IptablesLegacy) {
if pMgr.hintOrCanaryChainExist(util.IptablesLegacyCmd) {
util.SetIptablesToLegacy()
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions npm/pkg/dataplane/policies/chain-management_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ func TestDetectIptablesVersion(t *testing.T) {
ExitCode: 1,
},
{
Cmd: []string{"iptables", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
Cmd: []string{"iptables-legacy", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
ExitCode: 0,
},
},
Expand All @@ -954,11 +954,11 @@ func TestDetectIptablesVersion(t *testing.T) {
ExitCode: 1,
},
{
Cmd: []string{"iptables", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
Cmd: []string{"iptables-legacy", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
ExitCode: 1,
},
{
Cmd: []string{"iptables", "-w", "60", "-L", "KUBE-KUBELET-CANARY", "-t", "mangle", "-n"},
Cmd: []string{"iptables-legacy", "-w", "60", "-L", "KUBE-KUBELET-CANARY", "-t", "mangle", "-n"},
ExitCode: 1,
},
},
Expand All @@ -976,11 +976,11 @@ func TestDetectIptablesVersion(t *testing.T) {
ExitCode: 2,
},
{
Cmd: []string{"iptables", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
Cmd: []string{"iptables-legacy", "-w", "60", "-L", "KUBE-IPTABLES-HINT", "-t", "mangle", "-n"},
ExitCode: 2,
},
{
Cmd: []string{"iptables", "-w", "60", "-L", "KUBE-KUBELET-CANARY", "-t", "mangle", "-n"},
Cmd: []string{"iptables-legacy", "-w", "60", "-L", "KUBE-KUBELET-CANARY", "-t", "mangle", "-n"},
ExitCode: 2,
},
},
Expand Down
1 change: 1 addition & 0 deletions npm/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
IptablesSaveNft string = "iptables-nft-save"
IptablesRestoreNft string = "iptables-nft-restore"
IptablesLegacy string = "iptables"
IptablesLegacyCmd string = "iptables-legacy"
IptablesSaveLegacy string = "iptables-save"
IptablesRestoreLegacy string = "iptables-restore"
IptablesRestoreNoFlushFlag string = "--noflush"
Expand Down
Loading