File tree 2 files changed +7
-6
lines changed
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 {
349
349
return ""
350
350
}
351
351
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 ] == '!' {
356
357
return iptablesBackend
357
358
}
358
359
return nftablesBackend
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ var _ = Describe("portmapping configuration", func() {
44
44
},
45
45
"snat": false,
46
46
"conditionsV4": ["-s", "1.2.3.4"],
47
- "conditionsV6": ["-s", "12::34"],
47
+ "conditionsV6": ["!", " -s", "12::34"],
48
48
"prevResult": {
49
49
"interfaces": [
50
50
{"name": "host"},
@@ -76,7 +76,7 @@ var _ = Describe("portmapping configuration", func() {
76
76
Expect (err ).NotTo (HaveOccurred ())
77
77
Expect (c .CNIVersion ).To (Equal (ver ))
78
78
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" }))
80
80
fvar := false
81
81
Expect (c .SNAT ).To (Equal (& fvar ))
82
82
Expect (c .Name ).To (Equal ("test" ))
You can’t perform that action at this time.
0 commit comments