Check kernel version

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9024 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-12-13 17:28:34 +00:00
parent 923f06647c
commit f5b950f7a6
2 changed files with 135 additions and 125 deletions

View File

@ -7,7 +7,7 @@ Shorewall 4.3.3
Minimun system requirements: Minimun system requirements:
- Kernel 2.6.20 or later with 2.6.25 or later strongly recommended. - Kernel 2.6.23 or later with 2.6.25 or later strongly recommended.
- iptables 1.4.0 or later with 1.4.1 strongly recommended. - iptables 1.4.0 or later with 1.4.1 strongly recommended.
- Perl 5.10 if you wish to use DNS names in your IPv6 config files. - Perl 5.10 if you wish to use DNS names in your IPv6 config files.
In that case you will also have to install Perl Socket6 support. In that case you will also have to install Perl Socket6 support.
@ -31,6 +31,10 @@ Other changes in 4.3.3
3) Traffic shaping is now enabled in Shorewall6. See below. 3) Traffic shaping is now enabled in Shorewall6. See below.
4) Shorewall6 and Shorewall6 Lite now check the kernel version during
'start' processing. If the kernel version is less than 2.6.25, a
fatal error is generated.
Migration Issues. Migration Issues.
None. None.

View File

@ -64,137 +64,143 @@ COMMAND="$1"
[ -n "${PRODUCT:=Shorewall6}" ] [ -n "${PRODUCT:=Shorewall6}" ]
case "$COMMAND" in kernel=$(printf "%2d%02d%02d\n" $(echo $(uname -r) 2> /dev/null | sed 's/-.*//' | tr '.' ' ' ) | head -n1)
start) if [ $kernel -lt 20625 ]; then
[ $# -ne 1 ] && usage 2 error_message "ERROR: $PRODUCT requires Linux kernel 2.6.25 or later"
if shorewall6_is_started; then status=2
error_message "$PRODUCT is already Running" else
case "$COMMAND" in
start)
[ $# -ne 1 ] && usage 2
if shorewall6_is_started; then
error_message "$PRODUCT is already Running"
status=0
else
progress_message3 "Starting $PRODUCT...."
define_firewall
status=$?
[ -n "$SUBSYSLOCK" -a $status -eq 0 ] && touch $SUBSYSLOCK
progress_message3 "done."
fi
;;
stop)
[ $# -ne 1 ] && usage 2
progress_message3 "Stopping $PRODUCT...."
stop_firewall
status=0 status=0
else [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "Starting $PRODUCT...."
define_firewall
status=$?
[ -n "$SUBSYSLOCK" -a $status -eq 0 ] && touch $SUBSYSLOCK
progress_message3 "done." progress_message3 "done."
fi ;;
;; reset)
stop) if ! shorewall6_is_started ; then
[ $# -ne 1 ] && usage 2 error_message "$PRODUCT is not running"
progress_message3 "Stopping $PRODUCT...." status=2
stop_firewall elif [ $# -eq 1 ]; then
status=0 $IP6TABLES -Z
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK $IP6TABLES -t mangle -Z
progress_message3 "done." date > ${VARDIR}/restarted
;; status=0
reset) progress_message3 "$PRODUCT Counters Reset"
if ! shorewall6_is_started ; then else
error_message "$PRODUCT is not running" shift
status=2 status=0
elif [ $# -eq 1 ]; then for chain in $@; do
$IP6TABLES -Z if chain_exists $chain; then
$IP6TABLES -t mangle -Z if qt $IP6TABLES -Z $chain; then
date > ${VARDIR}/restarted progress_message3 "Filter $chain Counters Reset"
status=0 else
progress_message3 "$PRODUCT Counters Reset" error_message "ERROR: Reset of chain $chain failed"
else status=2
shift break
status=0 fi
for chain in $@; do
if chain_exists $chain; then
if qt $IP6TABLES -Z $chain; then
progress_message3 "Filter $chain Counters Reset"
else else
error_message "ERROR: Reset of chain $chain failed" error_message "WARNING: Filter Chain $chain does not exist"
status=2
break
fi fi
else done
error_message "WARNING: Filter Chain $chain does not exist" fi
fi ;;
done restart)
fi [ $# -ne 1 ] && usage 2
;; if shorewall6_is_started; then
restart) progress_message3 "Restarting $PRODUCT...."
[ $# -ne 1 ] && usage 2 else
if shorewall6_is_started; then error_message "$PRODUCT is not running"
progress_message3 "Restarting $PRODUCT...." progress_message3 "Starting $PRODUCT...."
else fi
error_message "$PRODUCT is not running"
progress_message3 "Starting $PRODUCT...."
fi
define_firewall
status=$?
if [ -n "$SUBSYSLOCK" ]; then
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
fi
progress_message3 "done."
;;
refresh)
[ $# -ne 1 ] && usage 2
if shorewall6_is_started; then
progress_message3 "Refreshing $PRODUCT...."
define_firewall define_firewall
status=$? status=$?
if [ -n "$SUBSYSLOCK" ]; then
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
fi
progress_message3 "done." progress_message3 "done."
else ;;
echo "$PRODUCT is not running" >&2 refresh)
status=2 [ $# -ne 1 ] && usage 2
fi if shorewall6_is_started; then
;; progress_message3 "Refreshing $PRODUCT...."
restore) define_firewall
[ $# -ne 1 ] && usage 2 status=$?
define_firewall progress_message3 "done."
status=$? else
if [ -n "$SUBSYSLOCK" ]; then echo "$PRODUCT is not running" >&2
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK status=2
fi fi
;; ;;
clear) restore)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
progress_message3 "Clearing $PRODUCT...." define_firewall
clear_firewall status=$?
status=0 if [ -n "$SUBSYSLOCK" ]; then
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK [ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
progress_message3 "done." fi
;; ;;
status) clear)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)" progress_message3 "Clearing $PRODUCT...."
echo clear_firewall
if shorewall6_is_started; then
echo "$PRODUCT is running"
status=0 status=0
else [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
echo "$PRODUCT is stopped" progress_message3 "done."
status=4 ;;
fi status)
[ $# -ne 1 ] && usage 2
if [ -f ${VARDIR}/state ]; then echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)"
state="$(cat ${VARDIR}/state)" echo
case $state in if shorewall6_is_started; then
Stopped*|Clear*) echo "$PRODUCT is running"
status=3 status=0
;; else
esac echo "$PRODUCT is stopped"
else status=4
state=Unknown fi
fi
echo "State:$state" if [ -f ${VARDIR}/state ]; then
echo state="$(cat ${VARDIR}/state)"
;; case $state in
version) Stopped*|Clear*)
[ $# -ne 1 ] && usage 2 status=3
echo $VERSION ;;
status=0 esac
;; else
help) state=Unknown
[ $# -ne 1 ] && usage 2 fi
usage 0 echo "State:$state"
;; echo
*) ;;
usage 2 version)
;; [ $# -ne 1 ] && usage 2
esac echo $VERSION
status=0
;;
help)
[ $# -ne 1 ] && usage 2
usage 0
;;
*)
usage 2
;;
esac
fi
exit $status exit $status