2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook
10 echo -n "Wait for testing link-local IP to become available "
11 for _i
in $
(seq ${MAX_PING_TRIES}); do
13 if $PING6 -c 1 -W 1 ff02
::1%${TEST_IF} >/dev
/null
2>&1; then
19 echo 1>&2 "ERROR: Timeout waiting for test IP to become available."
25 # Create testing interfaces not to interfere with current environment.
26 ip link add dev
${TEST_IF} type veth peer name
${TEST_IF_PEER}
27 ip link
set ${TEST_IF} up
28 ip link
set ${TEST_IF_PEER} up
32 tc qdisc add dev
${TEST_IF} clsact
33 tc filter add dev
${TEST_IF} egress bpf obj
${BPF_PROG_OBJ} \
34 sec
${BPF_PROG_SECTION} da
36 BPF_PROG_ID
=$
(tc filter show dev
${TEST_IF} egress | \
37 awk '/ id / {sub(/.* id /, "", $0); print($1)}')
42 ip link del
${TEST_IF} 2>/dev
/null ||
:
43 ip link del
${TEST_IF_PEER} 2>/dev
/null ||
:
48 trap cleanup EXIT
2 3 6 15
50 ${PROG} ${TEST_IF} ${BPF_PROG_ID}
55 TEST_IF_PEER
="test_cgid_2"
57 BPF_PROG_OBJ
="${DIR}/test_skb_cgroup_id_kern.o"
58 BPF_PROG_SECTION
="cgroup_id_logger"
60 PROG
="${DIR}/test_skb_cgroup_id_user"
61 type ping6
>/dev
/null
2>&1 && PING6
="ping6" || PING6
="ping -6"