Changed iptables version check for fail if version is between 1.8.0 and 1.8.3 and using nf_tables mode (#3425)

Signed-off-by: dereknola <derek.nola@suse.com>
This commit is contained in:
Derek Nola 2021-06-10 10:47:03 -07:00 committed by GitHub
parent f6cec4e75d
commit 2afa3dbe1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,6 +197,9 @@ echo
version_ge() { version_ge() {
[ "$1" = "$2" ] || [ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ] [ "$1" = "$2" ] || [ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]
} }
version_less() {
[ "$(printf '%s\n' "$@" | sort -rV | head -n 1)" != "$1" ]
}
which_iptables() { which_iptables() {
( (
localIPtables=$(command -v iptables) localIPtables=$(command -v iptables)
@ -224,8 +227,8 @@ echo
wrap_warn "- $iptablesCmd" "unknown version: $iptablesInfo" wrap_warn "- $iptablesCmd" "unknown version: $iptablesInfo"
elif version_ge $iptablesVersion v1.8.0; then elif version_ge $iptablesVersion v1.8.0; then
iptablesMode=$(echo $iptablesInfo | awk '{ print $3 }') iptablesMode=$(echo $iptablesInfo | awk '{ print $3 }')
if [ "$iptablesMode" != "(legacy)" ]; then if [ "$iptablesMode" != "(legacy)" ] && version_less $iptablesVersion v1.8.4; then
wrap_bad "- $label" 'should be older than v1.8.0 or in legacy mode' wrap_bad "- $label" 'should be older than v1.8.0, newer than v1.8.3, or in legacy mode'
else else
wrap_good "- $label" 'ok' wrap_good "- $label" 'ok'
fi fi