diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 701e5c933..26327c852 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -2332,6 +2332,8 @@ sub determine_kernelversion() { if ( $kernelversion =~ /^(\d+)\.(\d+).(\d+)/ ) { $capabilities{KERNELVERSION} = sprintf "%d%02d%02d", $1 , $2 , $3; + } elsif ( $kernelversion =~ /^(\d+)\.(\d+)/ ) { + $capabilities{KERNELVERSION} = sprintf "%d%02d00", $1 , $2; } else { fatal_error "Unrecognized Kernel Version Format ($kernelversion)"; } diff --git a/Shorewall/lib.cli b/Shorewall/lib.cli index a21aa1008..dbb04334e 100644 --- a/Shorewall/lib.cli +++ b/Shorewall/lib.cli @@ -1882,7 +1882,17 @@ determine_capabilities() { [ -n "$IP" ] && $IP rule add help 2>&1 | grep -q /MASK && FWMARK_RT_MASK=Yes CAPVERSION=$SHOREWALL_CAPVERSION - KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) + + KERNELVERSION=$(uname -r 2> /dev/null | sed -e 's/-.*//') + + case "$KERNELVERSION" in + *.*.*) + KERNELVERSION=$(printf "%d%02d%02d" $(echo $KERNELVERSION | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) + ;; + *) + KERNELVERSION=$(printf "%d%02d00" $(echo $KERNELVERSION | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g')) + ;; + esac } report_capabilities() { diff --git a/Shorewall6/lib.cli b/Shorewall6/lib.cli index 08e4bc7fb..11c79d9e5 100644 --- a/Shorewall6/lib.cli +++ b/Shorewall6/lib.cli @@ -1712,7 +1712,17 @@ determine_capabilities() { [ -n "$IP" ] && $IP rule add help 2>&1 | grep -q /MASK && FWMARK_RT_MASK=Yes CAPVERSION=$SHOREWALL_CAPVERSION - KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) + + KERNELVERSION=$(uname -r 2> /dev/null | sed -e 's/-.*//') + + case "$KERNELVERSION" in + *.*.*) + KERNELVERSION=$(printf "%d%02d%02d" $(echo $KERNELVERSION | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) + ;; + *) + KERNELVERSION=$(printf "%d%02d00" $(echo $KERNELVERSION | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g')) + ;; + esac } report_capabilities() {