2 # SPDX-License-Identifier: GPL-2.0
21 ip netns
exec $NS sysctl
-w net.ipv4.ping_group_range
='0 2147483647' > /dev
/null
24 ip
-netns $NS link add
type dummy
25 ip
-netns $NS link
set dev dummy0 up
26 ip
-netns $NS addr add
$IP4 dev dummy0
27 ip
-netns $NS addr add
$IP6 dev dummy0
30 ip netns
exec $NS tc qdisc replace dev dummy0 root fq
39 echo " Case $4 returned $1, expected 0"
41 elif [ "$2" != "$3" ]; then
42 echo " Case $4 returned '$2', expected '$3'"
47 for i
in "-4 $TGT4" "-6 $TGT6"; do
49 [ $p == "u" ] && prot
=UDPv
${i:1:2}
50 [ $p == "i" ] && prot
=ICMPv
${i:1:2}
51 [ $p == "r" ] && prot
=RAWv
${i:1:2}
53 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234)
54 check_result $?
"$ts" "" "$prot - no options"
56 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234 -t |
wc -l)
57 check_result $?
"$ts" "2" "$prot - ts cnt"
58 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234 -t |
59 sed -n "s/.*SCHED ts0 [0-9].*/OK/p")
60 check_result $?
"$ts" "OK" "$prot - ts0 SCHED"
61 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234 -t |
62 sed -n "s/.*SND ts0 [0-9].*/OK/p")
63 check_result $?
"$ts" "OK" "$prot - ts0 SND"
65 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234 -t -d 1000 |
66 awk '/SND/ { if ($3 > 1000) print "OK"; }')
67 check_result $?
"$ts" "OK" "$prot - TXTIME abs"
69 [ "$KSFT_MACHINE_SLOW" = yes ] && delay
=8000 || delay
=1000
71 ts
=$
(ip netns
exec $NS .
/cmsg_sender
-p $p $i 1234 -t -d $delay |
74 END { if (snd - sch > '$
((delay
/2))') print "OK";
75 else print snd, "-", sch, "<", '$
((delay
/2))'; }')
76 check_result $?
"$ts" "OK" "$prot - TXTIME rel"
81 if [ $BAD -ne 0 ]; then
82 echo "FAIL - $BAD/$TOTAL cases failed"