2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook
4 # Copyright (c) 2019 Cloudflare
11 printf "Wait for IP %s to become available " "$1"
12 for _i
in $
(seq ${MAX_PING_TRIES}); do
14 if ns1_exec
ping -c 1 -W 1 "$1" >/dev
/null
2>&1; then
20 echo 1>&2 "ERROR: Timeout waiting for test IP to become available."
26 awk '/ id / {sub(/.* id /, "", $0); print($1)}'
31 ip netns
exec ns1
"$@"
37 ns1_exec ip link
set lo up
39 ns1_exec sysctl
-w net.ipv4.tcp_syncookies
=2
47 ip netns del ns1
2>/dev
/null ||
:
52 trap cleanup EXIT
2 3 6 15
55 printf "Testing clsact..."
56 ns1_exec tc qdisc add dev
"${TEST_IF}" clsact
57 ns1_exec tc filter add dev
"${TEST_IF}" ingress \
58 bpf obj
"${BPF_PROG_OBJ}" sec
"${CLSACT_SECTION}" da
60 BPF_PROG_ID
=$
(ns1_exec tc filter show dev
"${TEST_IF}" ingress | \
62 ns1_exec
"${PROG}" "${BPF_PROG_ID}"
63 ns1_exec tc qdisc del dev
"${TEST_IF}" clsact
65 printf "Testing XDP..."
66 ns1_exec ip link
set "${TEST_IF}" xdp \
67 object
"${BPF_PROG_OBJ}" section
"${XDP_SECTION}"
68 BPF_PROG_ID
=$
(ns1_exec ip link show
"${TEST_IF}" | get_prog_id
)
69 ns1_exec
"${PROG}" "${BPF_PROG_ID}"
75 BPF_PROG_OBJ
="${DIR}/test_tcp_check_syncookie_kern.o"
76 CLSACT_SECTION
="clsact/check_syncookie"
77 XDP_SECTION
="xdp/check_syncookie"
79 PROG
="${DIR}/test_tcp_check_syncookie_user"