Codebase list nsntrace / upstream/4.5.g4d02e74 tests / check_namespaced.sh
upstream/4.5.g4d02e74

Tree @upstream/4.5.g4d02e74 (Download .tar.gz)

check_namespaced.sh @upstream/4.5.g4d02e74raw · history · blame

#!/bin/sh

packets=99
filter="udp port 1337"

# start sending packages non-namespaced
 ./udp_send 1337 -1 &

# stop the non-namespaced udp_send on exit
pidof_udp_send=$(pidof udp_send)
trap 'kill "$pidof_udp_send"' EXIT

# make sure we only capture the packets from the namespaced version
sudo ../src/nsntrace -d lo -f "$filter" ./udp_send 1337 "$packets" | grep "$packets packets" || {
    echo "Did not capture $packets packets!"
    exit 1
}

exit 0