2 # SPDX-License-Identifier: GPL-2.0
5 # Here we setup and teardown configuration required to run
6 # xdping, exercising its options.
8 # Setup is similar to test_tunnel tests but without the tunnel.
12 # root namespace | tc_ns0 namespace
14 # ---------- | ----------
15 # | veth1 | --------- | veth0 |
16 # ---------- peer ----------
18 # Device Configuration
19 # --------------------
20 # Root namespace with BPF
21 # Device names and addresses:
22 # veth1 IP: 10.1.1.200
23 # xdp added to veth1, xdpings originate from here.
25 # Namespace tc_ns0 with BPF
26 # Device names and addresses:
27 # veth0 IPv4: 10.1.1.100
28 # For some tests xdping run in server mode here.
31 readonly TARGET_IP
="10.1.1.100"
32 readonly TARGET_NS
="xdp_ns0"
34 readonly LOCAL_IP
="10.1.1.200"
38 ip netns add
$TARGET_NS
39 ip link add veth0
type veth peer name veth1
40 ip link
set veth0 netns
$TARGET_NS
41 ip netns
exec $TARGET_NS ip addr add
${TARGET_IP}/24 dev veth0
42 ip addr add
${LOCAL_IP}/24 dev veth1
43 ip netns
exec $TARGET_NS ip link
set veth0 up
50 ip netns delete
$TARGET_NS 2>/dev
/null
51 ip link del veth1
2>/dev
/null
52 if [[ $server_pid -ne 0 ]]; then
53 kill -TERM $server_pid
62 echo "Test client args '$client_args'; server args '$server_args'"
65 if [[ -n "$server_args" ]]; then
66 ip netns
exec $TARGET_NS .
/xdping
$server_args &
70 .
/xdping
$client_args $TARGET_IP
72 if [[ $server_pid -ne 0 ]]; then
73 kill -TERM $server_pid
77 echo "Test client args '$client_args'; server args '$server_args': PASS"
88 for server_args
in "" "-I veth0 -s -S" ; do
90 client_args
="-I veth1 -S"
91 test "$client_args" "$server_args"
93 # client with count of 10 RTT measurements.
94 client_args
="-I veth1 -S -c 10"
95 test "$client_args" "$server_args"
98 echo "OK. All tests passed"