3 # an out-of-bounds read in the BPF expression should exit the bpf program,
4 # regardless of other expressions. Pass an expression to tcpdump which
5 # performs an out-of-bound read and ping with a packet which would cause
6 # the expression to succeed if the out-of-bounds read is not handled.
8 # exit status: 0 - pass, 1 - fail, 2 - skip
11 ADDR
=${ADDR:-127.0.0.1}
13 tcpdump
-c1 -np -i $IFACE \
( link
[34000:2]=0 or icmp \
) and ip
[36:2]=0xcafe > /dev
/null
&
17 if ! kill -0 $TCPDUMP_PID > /dev
/null
2>&1 ; then
18 echo "SKIPPED tcpdump exited - are you root?"; exit 2;
20 if ! ping -c1 -p cafe
$ADDR > /dev
/null
2>&1 ; then
21 echo "SKIPPED not able to ping localhost";
22 kill $TCPDUMP_PID > /dev
/null
2>&1 ; exit 2;
25 if ! kill $TCPDUMP_PID > /dev
/null
2>&1; then
26 echo "FAILED"; exit 1;
28 wait $TCPDUMP_PID; echo "PASSED"; exit 0;