Option ipv6-join-group is in PH_PASTSOCKET

This commit is contained in:
Gerhard Rieger 2019-03-03 10:01:32 +01:00
parent e1a5931827
commit b5be579187
3 changed files with 17 additions and 8 deletions

View file

@ -26,6 +26,11 @@ corrections:
Introduces functions diag_sock_pair(), diag_fork() Introduces functions diag_sock_pair(), diag_fork()
Thanks to Darren Zhao for analysing and reporting this problem. Thanks to Darren Zhao for analysing and reporting this problem.
Option ipv6-join-group did not work because it was applied in the wrong
phase
Test: UDP6MULTICAST_UNIDIR
Thanks to Angus Gratton for sending a patch.
testing: testing:
test.sh: Show a warning when phase-1 (insecure phase) of a security test.sh: Show a warning when phase-1 (insecure phase) of a security
test fails test fails

18
test.sh
View file

@ -77,7 +77,8 @@ else
*) INTERFACE="$(netstat -rn |grep -e "^default" -e "^0\.0\.0\.0" |awk '{print($4);}')" ;; *) INTERFACE="$(netstat -rn |grep -e "^default" -e "^0\.0\.0\.0" |awk '{print($4);}')" ;;
esac esac
fi fi
MCINTERFACE=lo # !!! Linux only MCINTERFACE=lo # !!! Linux only - and not always
MCINTERFACE=$INTERFACE
#LOCALHOST=192.168.58.1 #LOCALHOST=192.168.58.1
LOCALHOST=localhost LOCALHOST=localhost
#LOCALHOST=127.0.0.1 #LOCALHOST=127.0.0.1
@ -8606,7 +8607,7 @@ esac
PROTO=$((PROTO+1)) PROTO=$((PROTO+1))
N=$((N+1)) N=$((N+1))
if false; then if true; then
NAME=UDP6MULTICAST_UNIDIR NAME=UDP6MULTICAST_UNIDIR
case "$TESTS" in case "$TESTS" in
*%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%multicast%*|*%$NAME%*) *%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%multicast%*|*%$NAME%*)
@ -8624,7 +8625,8 @@ if1="$MCINTERFACE"
ts1a="[::1]" ts1a="[::1]"
da="test$N $(date) $RANDOM" da="test$N $(date) $RANDOM"
CMD1="$TRACE $SOCAT -u $opts UDP6-RECV:$ts1p,reuseaddr,ipv6-join-group=[ff02::2]:$if1 -" CMD1="$TRACE $SOCAT -u $opts UDP6-RECV:$ts1p,reuseaddr,ipv6-join-group=[ff02::2]:$if1 -"
CMD2="$TRACE $SOCAT -u $opts - UDP6-SENDTO:[ff02::2]:$ts1p,bind=$ts1a" #CMD2="$TRACE $SOCAT -u $opts - UDP6-SENDTO:[ff02::2]:$ts1p,bind=$ts1a"
CMD2="$TRACE $SOCAT -u $opts - UDP6-SENDTO:[ff02::2]:$ts1p"
printf "test $F_n $TEST... " $N printf "test $F_n $TEST... " $N
$CMD1 2>"${te}1" >"${tf}" & $CMD1 2>"${te}1" >"${tf}" &
pid1="$!" pid1="$!"
@ -8635,19 +8637,21 @@ usleep $MICROS
kill "$pid1" 2>/dev/null; wait; kill "$pid1" 2>/dev/null; wait;
if [ "$rc2" -ne 0 ]; then if [ "$rc2" -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n" $PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &" echo -e "$CMD1 &\n$CMD2"
echo "$CMD2"
cat "${te}1" cat "${te}1"
cat "${te}2" cat "${te}2"
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
$PRINTF "$FAILED\n" $PRINTF "$FAILED\n"
echo "$CMD1 &"
echo "$CMD2"
cat "$tdiff" cat "$tdiff"
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
else else
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ "$VERBOSE" ]; then echo -e "$CMD1 &\n$CMD2"; fi
if [ -n "$debug" ]; then cat $te; fi if [ -n "$debug" ]; then cat $te; fi
numOK=$((numOK+1)) numOK=$((numOK+1))
fi fi
@ -8695,7 +8699,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
else else
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ -n "$tut" ]; then if [ -n "$VERBOSE" ]; then
echo "$CMD1 &" echo "$CMD1 &"
echo "$CMD2" echo "$CMD2"
fi fi

View file

@ -23,7 +23,7 @@ static char *inet6addr_info(const struct in6_addr *sa, char *buff, size_t blen);
const struct optdesc opt_ipv6_v6only = { "ipv6-v6only", "ipv6only", OPT_IPV6_V6ONLY, GROUP_SOCK_IP6, PH_PREBIND, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_V6ONLY }; const struct optdesc opt_ipv6_v6only = { "ipv6-v6only", "ipv6only", OPT_IPV6_V6ONLY, GROUP_SOCK_IP6, PH_PREBIND, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_V6ONLY };
#endif #endif
#ifdef IPV6_JOIN_GROUP #ifdef IPV6_JOIN_GROUP
const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTBIND, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP }; const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP };
#endif #endif
#ifdef IPV6_PKTINFO #ifdef IPV6_PKTINFO
const struct optdesc opt_ipv6_pktinfo = { "ipv6-pktinfo", "pktinfo", OPT_IPV6_PKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_PKTINFO }; const struct optdesc opt_ipv6_pktinfo = { "ipv6-pktinfo", "pktinfo", OPT_IPV6_PKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_PKTINFO };