-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test setting IPV6_DONTFRAG via setsockopt and cmsg across socket types. Output without the kernel support (this series): Case DONTFRAG ICMP setsock returned 0, expected 1 Case DONTFRAG ICMP cmsg returned 0, expected 1 Case DONTFRAG ICMP both returned 0, expected 1 Case DONTFRAG ICMP diff returned 0, expected 1 FAIL - 4/24 cases failed Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Jakub Kicinski
authored and
David S. Miller
committed
Feb 17, 2022
1 parent
1365122
commit 6f97c7c
Showing
2 changed files
with
147 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
NS=ns | ||
IP6=2001:db8:1::1/64 | ||
TGT6=2001:db8:1::2 | ||
|
||
cleanup() | ||
{ | ||
ip netns del $NS | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
NSEXE="ip netns exec $NS" | ||
|
||
# Namespaces | ||
ip netns add $NS | ||
|
||
$NSEXE sysctl -w net.ipv4.ping_group_range='0 2147483647' > /dev/null | ||
|
||
# Connectivity | ||
ip -netns $NS link add type dummy | ||
ip -netns $NS link set dev dummy0 up | ||
ip -netns $NS addr add $IP6 dev dummy0 | ||
|
||
# Test | ||
BAD=0 | ||
TOTAL=0 | ||
|
||
check_result() { | ||
((TOTAL++)) | ||
if [ $1 -ne $2 ]; then | ||
echo " Case $3 returned $1, expected $2" | ||
((BAD++)) | ||
fi | ||
} | ||
|
||
# IPV6_DONTFRAG | ||
for ovr in setsock cmsg both diff; do | ||
for df in 0 1; do | ||
for p in u i r; do | ||
[ $p == "u" ] && prot=UDP | ||
[ $p == "i" ] && prot=ICMP | ||
[ $p == "r" ] && prot=RAW | ||
|
||
[ $ovr == "setsock" ] && m="-F $df" | ||
[ $ovr == "cmsg" ] && m="-f $df" | ||
[ $ovr == "both" ] && m="-F $df -f $df" | ||
[ $ovr == "diff" ] && m="-F $((1 - df)) -f $df" | ||
|
||
$NSEXE ./cmsg_sender -s -S 2000 -6 -p $p $m $TGT6 1234 | ||
check_result $? $df "DONTFRAG $prot $ovr" | ||
done | ||
done | ||
done | ||
|
||
# Summary | ||
if [ $BAD -ne 0 ]; then | ||
echo "FAIL - $BAD/$TOTAL cases failed" | ||
exit 1 | ||
else | ||
echo "OK" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters