From b5be579187f74b3fea383c167b0dc29a9108c4c4 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sun, 3 Mar 2019 10:01:32 +0100 Subject: [PATCH] Option ipv6-join-group is in PH_PASTSOCKET --- CHANGES | 5 +++++ test.sh | 18 +++++++++++------- xio-ip6.c | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 35e24c5..3c44bae 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,11 @@ corrections: Introduces functions diag_sock_pair(), diag_fork() 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: test.sh: Show a warning when phase-1 (insecure phase) of a security test fails diff --git a/test.sh b/test.sh index 8c6590e..ff105da 100755 --- a/test.sh +++ b/test.sh @@ -77,7 +77,8 @@ else *) INTERFACE="$(netstat -rn |grep -e "^default" -e "^0\.0\.0\.0" |awk '{print($4);}')" ;; esac fi -MCINTERFACE=lo # !!! Linux only +MCINTERFACE=lo # !!! Linux only - and not always +MCINTERFACE=$INTERFACE #LOCALHOST=192.168.58.1 LOCALHOST=localhost #LOCALHOST=127.0.0.1 @@ -8606,7 +8607,7 @@ esac PROTO=$((PROTO+1)) N=$((N+1)) -if false; then +if true; then NAME=UDP6MULTICAST_UNIDIR case "$TESTS" in *%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%multicast%*|*%$NAME%*) @@ -8624,7 +8625,8 @@ if1="$MCINTERFACE" ts1a="[::1]" da="test$N $(date) $RANDOM" 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 $CMD1 2>"${te}1" >"${tf}" & pid1="$!" @@ -8635,19 +8637,21 @@ usleep $MICROS kill "$pid1" 2>/dev/null; wait; if [ "$rc2" -ne 0 ]; then $PRINTF "$FAILED: $TRACE $SOCAT:\n" - echo "$CMD1 &" - echo "$CMD2" + echo -e "$CMD1 &\n$CMD2" cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" + echo "$CMD1 &" + echo "$CMD2" cat "$tdiff" numFAIL=$((numFAIL+1)) listFAIL="$listFAIL $N" else - $PRINTF "$OK\n" + $PRINTF "$OK\n" + if [ "$VERBOSE" ]; then echo -e "$CMD1 &\n$CMD2"; fi if [ -n "$debug" ]; then cat $te; fi numOK=$((numOK+1)) fi @@ -8695,7 +8699,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then listFAIL="$listFAIL $N" else $PRINTF "$OK\n" - if [ -n "$tut" ]; then + if [ -n "$VERBOSE" ]; then echo "$CMD1 &" echo "$CMD2" fi diff --git a/xio-ip6.c b/xio-ip6.c index 0b332a9..20d3da2 100644 --- a/xio-ip6.c +++ b/xio-ip6.c @@ -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 }; #endif #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 #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 };