File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -349,10 +349,11 @@ func detectBackendOfConditions(conditions *[]string) string {
349349 return ""
350350 }
351351
352- // The first token of any iptables condition would start with a hyphen (e.g. "-d",
353- // "--sport", "-m"). No nftables condition would start that way. (An nftables
354- // condition might include a negative number, but not as the first token.)
355- if (* conditions )[0 ][0 ] == '-' {
352+ // The first character of any iptables condition would either be an hyphen
353+ // (e.g. "-d", "--sport", "-m") or an exclamation mark.
354+ // No nftables condition would start that way. (An nftables condition might
355+ // include a negative number, but not as the first token.)
356+ if (* conditions )[0 ][0 ] == '-' || (* conditions )[0 ][0 ] == '!' {
356357 return iptablesBackend
357358 }
358359 return nftablesBackend
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ var _ = Describe("portmapping configuration", func() {
4444 },
4545 "snat": false,
4646 "conditionsV4": ["-s", "1.2.3.4"],
47- "conditionsV6": ["-s", "12::34"],
47+ "conditionsV6": ["!", " -s", "12::34"],
4848 "prevResult": {
4949 "interfaces": [
5050 {"name": "host"},
@@ -76,7 +76,7 @@ var _ = Describe("portmapping configuration", func() {
7676 Expect (err ).NotTo (HaveOccurred ())
7777 Expect (c .CNIVersion ).To (Equal (ver ))
7878 Expect (c .ConditionsV4 ).To (Equal (& []string {"-s" , "1.2.3.4" }))
79- Expect (c .ConditionsV6 ).To (Equal (& []string {"-s" , "12::34" }))
79+ Expect (c .ConditionsV6 ).To (Equal (& []string {"!" , " -s" , "12::34" }))
8080 fvar := false
8181 Expect (c .SNAT ).To (Equal (& fvar ))
8282 Expect (c .Name ).To (Equal ("test" ))
You can’t perform that action at this time.
0 commit comments