aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/samples/pktgen/pktgen_sample01_simple.sh
diff options
context:
space:
mode:
authorJ.J. Martzki <mars14850@gmail.com>2023-07-01 22:37:37 +0800
committerDavid S. Miller <davem@davemloft.net>2023-07-03 09:15:26 +0100
commita27ac5390922059867f645eefd978e533d7af902 (patch)
treecc707a1806e2f0e82b1bc8cd9d088dd9e0838ae2 /samples/pktgen/pktgen_sample01_simple.sh
parentselftests/net: Add xt_policy config for xfrm_policy test (diff)
downloadwireguard-linux-a27ac5390922059867f645eefd978e533d7af902.tar.xz
wireguard-linux-a27ac5390922059867f645eefd978e533d7af902.zip
samples: pktgen: fix append mode failed issue
Each sample script sources functions.sh before parameters.sh which makes $APPEND undefined when trapping EXIT no matter in append mode or not. Due to this when sample scripts finished they always do "pgctrl reset" which resets pktgen config. So move trap to each script after sourcing parameters.sh and trap EXIT explicitly. Signed-off-by: J.J. Martzki <mars14850@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/pktgen/pktgen_sample01_simple.sh')
-rwxr-xr-xsamples/pktgen/pktgen_sample01_simple.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh
index 09a92ea963f9..cdb9f497f87d 100755
--- a/samples/pktgen/pktgen_sample01_simple.sh
+++ b/samples/pktgen/pktgen_sample01_simple.sh
@@ -13,6 +13,10 @@ root_check_run_with_sudo "$@"
# - 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