fi
}
-if [[ -z "$APPEND" ]]; then
- if [[ $EUID -eq 0 ]]; then
- # Cleanup pktgen setup on exit if thats not "append mode"
- trap 'pg_ctrl "reset"' EXIT
- fi
-fi
+function trap_exit()
+{
+ # Cleanup pktgen setup on exit if thats not "append mode"
+ if [[ -z "$APPEND" ]] && [[ $EUID -eq 0 ]]; then
+ trap 'pg_ctrl "reset"' EXIT
+ fi
+}
## -- General shell tricks --
# Parameter parsing via include
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
# Using invalid DST_MAC will cause the packets to get dropped in
# ip_rcv() which is part of the test
if [ -z "$DEST_IP" ]; then
# Parameter parsing via include
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
fi
# - go look in parameters.sh to see which setting are avail
# - required param is the interface "-i" stored in $DEV
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
#
# Set some default params, if they didn't get set
if [ -z "$DEST_IP" ]; then
# Required param: -i dev in $DEV
source ${basedir}/parameters.sh
+# Trap EXIT first
+trap_exit
+
[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
# Base Config
# Parameter parsing via include
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
# Set some default params, if they didn't get set
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
# Parameter parsing via include
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
# Set some default params, if they didn't get set
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
# Parameter parsing via include
source ${basedir}/parameters.sh
+
+# Trap EXIT first
+trap_exit
+
# Set some default params, if they didn't get set
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
# Required param: -i dev in $DEV
source ${basedir}/parameters.sh
+# Trap EXIT first
+trap_exit
+
# Base Config
[ -z "$COUNT" ] && COUNT="20000000" # Zero means indefinitely
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"