Socat did not use option ipv6-join-group

This commit is contained in:
Gerhard Rieger 2016-08-12 17:13:15 +02:00
parent e25ba90e21
commit d6b0e1425e
3 changed files with 41 additions and 1 deletions

View file

@ -31,6 +31,10 @@ corrections:
Nevertheless fixed Socat source.
Issue reported by Hanno Böck.
Socat did not use option ipv6-join-group.
Test: USE_IPV6_JOIN_GROUP
Thanks to Linux Lüssing for sending a patch.
porting:
Type conflict between int and sig_atomic_t between declaration and
definition of diag_immediate_type and diag_immediate_exit broke

37
test.sh
View file

@ -8195,7 +8195,7 @@ NAME=UDP6LISTENBIND
# this tests for a bug in (up to) 1.5.0.0:
# with udp*-listen, the bind option supported only IPv4
case "$TESTS" in
*%$N%*|*%functions%*|*%bugs%*|*%ip6%*|*%ipapp%*|*%udp%*|*%$NAME%*)
*%$N%*|*%functions%*|*%bugs%*|*%ip6%*|*%ipapp%*|*%udp%*|*%udp6%*|*%$NAME%*)
TEST="$NAME: UDP6-LISTEN with bind"
if ! eval $NUMCOND; then :;
elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then
@ -12523,6 +12523,41 @@ PORT=$((PORT+1))
N=$((N+1))
# option ipv6-join-group "could not be used"
# fixed in 1.7.3.2
NAME=USE_IPV6_JOIN_GROUP
case "$TESTS" in
*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%ip6%*|*%udp%*|*%udp6%*|*%dgram%*|*%$NAME%*)
TEST="$NAME: is option ipv6-join-group used"
# Invoke socat with option ipv6-join-group on UDP6 address.
# Terminate immediately, do not transfer data.
# If socat exits with 0 the test succeeds.
# Up to 1.7.3.1 it failed with "1 option(s) could not be used"
if ! eval $NUMCOND; then :; else
tf="$td/test$N.stdout"
te="$td/test$N.stderr"
tdiff="$td/test$N.diff"
da="test$N $(date) $RANDOM"
CMD0="$TRACE $SOCAT $opts UDP6-RECV:$PORT,ipv6-join-group=[ff02::2]:$INTERFACE /dev/null"
printf "test $F_n $TEST... " $N
$CMD0 >/dev/null 2>"${te}0"
rc0=$?
if [ $rc0 -eq 0 ]; then
$PRINTF "$OK\n"
numOK=$((numOK+1))
else
$PRINTF "$FAILED\n"
echo "$CMD0"
cat "${te}0"
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
fi
fi # NUMCOND
;;
esac
PORT=$((PORT+1))
N=$((N+1))
##################################################################################
#=================================================================================
# here come tests that might affect your systems integrity. Put normal tests

View file

@ -1493,6 +1493,7 @@ int _xioopen_dgram_recv(struct single *xfd, int xioflags,
}
#endif
applyopts_single(xfd, opts, PH_PASTBIND);
applyopts(xfd->fd, opts, PH_PASTBIND);
#if WITH_UNIX
if (pf == AF_UNIX && us != NULL) {