2 # SPDX-License-Identifier: GPL-2.0
22 ip netns
exec $NS sysctl
-w net.ipv4.ping_group_range
='0 2147483647' > /dev
/null
25 ip
-netns $NS link add
type dummy
26 ip
-netns $NS link
set dev dummy0 up
27 ip
-netns $NS addr add
$IP4 dev dummy0
28 ip
-netns $NS addr add
$IP6 dev dummy0
30 ip
-netns $NS rule add fwmark
$MARK lookup
300
31 ip
-6 -netns $NS rule add fwmark
$MARK lookup
300
32 ip
-netns $NS route add prohibit any table
300
33 ip
-6 -netns $NS route add prohibit any table
300
41 if [ $1 -ne $2 ]; then
42 echo " Case $3 returned $1, expected $2"
47 for ovr
in setsock cmsg both
; do
49 [ $i == 4 ] && TGT
=$TGT4 || TGT
=$TGT6
52 [ $p == "u" ] && prot
=UDP
53 [ $p == "i" ] && prot
=ICMP
54 [ $p == "r" ] && prot
=RAW
56 [ $ovr == "setsock" ] && m
="-M"
57 [ $ovr == "cmsg" ] && m
="-m"
58 [ $ovr == "both" ] && m
="-M $MARK -m"
60 ip netns
exec $NS .
/cmsg_sender
-$i -p $p $m $
((MARK
+ 1)) $TGT 1234
61 check_result $?
0 "$prot $ovr - pass"
63 [ $ovr == "diff" ] && m
="-M $((MARK + 1)) -m"
65 ip netns
exec $NS .
/cmsg_sender
-$i -p $p $m $MARK -s $TGT 1234
66 check_result $?
1 "$prot $ovr - rejection"
72 if [ $BAD -ne 0 ]; then
73 echo "FAIL - $BAD/$TOTAL cases failed"