Skip to content

Commit

Permalink
Fix the 1.8.9 version check
Browse files Browse the repository at this point in the history
The current version check fails for any version where the patch
version is 9 or greater. 1.4.21 is still in use e.g. on RHEL 7:

    ipt.v1 == 1 && ipt.v2 <= 8 && ipt.v3 < 9

fails there because 21 >= 9.

To handle this, the check needs to distinguish ipt.v2 < 8 (v3 is not
significant then) and ipt.v2 == 8 (v3 needs to be compared).

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Nov 17, 2023
1 parent 9e9711e commit 49b5927
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iptables/iptables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ func runRulesTests(t *testing.T, ipt *IPTables) {
opt := "--"
prot := "0"
if ipt.proto == ProtocolIPv6 &&
ipt.v1 == 1 && ipt.v2 <= 8 && ipt.v3 < 9 {
ipt.v1 == 1 && (ipt.v2 < 8 || (ipt.v2 == 8 && ipt.v3 < 9)) {
// this is fixed in iptables 1.8.9 via iptables/6e41c2d874
opt = " "
// this is fixed in iptables 1.8.9 via iptables/da8ecc62dd
prot = "all"
}
if ipt.proto == ProtocolIPv4 &&
ipt.v1 == 1 && ipt.v2 <= 8 && ipt.v3 < 9 {
ipt.v1 == 1 && (ipt.v2 < 8 || (ipt.v2 == 8 && ipt.v3 < 9)) {
// this is fixed in iptables 1.8.9 via iptables/da8ecc62dd
prot = "all"
}
Expand Down

0 comments on commit 49b5927

Please sign in to comment.