mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
IP-SENDTO:*:6 now passes getaddrinfo() without "ai_socktype not supported"
This commit is contained in:
parent
cbeb06b19b
commit
3be18bdc1f
3 changed files with 44 additions and 13 deletions
7
CHANGES
7
CHANGES
|
@ -9,6 +9,7 @@ Corrections:
|
|||
applied to the second address, resulting in error
|
||||
"Inappropriate ioctl for device"
|
||||
This affected version 1.7.3.3 only.
|
||||
Test: TERMIOS_PH_ALL
|
||||
Thanks to Ivan J. for reporting this issue.
|
||||
|
||||
Socat failed to compile when no poll() system call was found by
|
||||
|
@ -19,6 +20,12 @@ Corrections:
|
|||
systems with, e.g., OpenSSL-0.9.8. Thanks to Simon Matter and Moritz B.
|
||||
for reporting this problem and sending initial patches.
|
||||
|
||||
getaddrinfo() in IP4-SENDTO and IP6-SENDTO addresses failed with
|
||||
"ai_socktype not supported" when protocol 6 was addressed.
|
||||
The fix removes the possibility to use service names with SCTP.
|
||||
Test: IP_SENDTO_6
|
||||
Thanks to Sören for sending an initial patch.
|
||||
|
||||
####################### V 1.7.3.3:
|
||||
|
||||
Corrections:
|
||||
|
|
33
test.sh
33
test.sh
|
@ -13061,6 +13061,39 @@ PORT=$((PORT+1))
|
|||
N=$((N+1))
|
||||
|
||||
|
||||
# Due to a fallback logic before calling getaddrinfo(), intended to allow use
|
||||
# of service (port) names with SCTP, raw socket addresses where resolved with
|
||||
# socket type stream, which fails for protocol 6 (TCP)
|
||||
# Fixed after 1.7.3.3
|
||||
NAME=IP_SENDTO_6
|
||||
case "$TESTS" in
|
||||
*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%rawip%*|*%rawip4%*|*%$NAME%*)
|
||||
TEST="$NAME: IP-SENDTO::6 passes getaddrinfo()"
|
||||
# invoke socat with address IP-SENDTO:*:6; when this does not fail with
|
||||
# "ai_socktype not supported", the test succeeded
|
||||
if ! eval $NUMCOND; then :; else
|
||||
tf="$td/test$N.stdout"
|
||||
te="$td/test$N.stderr"
|
||||
tdiff="$td/test$N.diff"
|
||||
CMD0="$TRACE $SOCAT $opts -u /dev/null IP-SENDTO:127.0.0.1:6"
|
||||
printf "test $F_n $TEST... " $N
|
||||
$CMD0 >/dev/null 2>"${te}0"
|
||||
if ! grep -q "ai_socktype not supported" ${te}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
|
||||
N=$((N+1))
|
||||
|
||||
|
||||
##################################################################################
|
||||
#=================================================================================
|
||||
# here come tests that might affect your systems integrity. Put normal tests
|
||||
|
|
17
xio-ip.c
17
xio-ip.c
|
@ -121,7 +121,7 @@ unsigned long res_opts() {
|
|||
hostname.domain (fq hostname resolving to IPv4 or IPv6 address)
|
||||
service: the port specification; may be numeric or symbolic
|
||||
family: PF_INET, PF_INET6, or PF_UNSPEC permitting both
|
||||
socktype: SOCK_STREAM, SOCK_DGRAM
|
||||
socktype: SOCK_STREAM, SOCK_DGRAM, ...
|
||||
protocol: IPPROTO_UDP, IPPROTO_TCP
|
||||
sau: an uninitialized storage for the resulting socket address
|
||||
returns: STAT_OK, STAT_RETRYLATER
|
||||
|
@ -202,18 +202,9 @@ int xiogetaddrinfo(const char *node, const char *service,
|
|||
if (node != NULL || service != NULL) {
|
||||
struct addrinfo *record;
|
||||
|
||||
if (socktype != SOCK_STREAM && socktype != SOCK_DGRAM) {
|
||||
/* actual socket type value is not supported - fallback to a good one */
|
||||
socktype = SOCK_DGRAM;
|
||||
}
|
||||
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
|
||||
/* actual protocol value is not supported - fallback to a good one */
|
||||
if (socktype == SOCK_DGRAM) {
|
||||
protocol = IPPROTO_UDP;
|
||||
} else {
|
||||
protocol = IPPROTO_TCP;
|
||||
}
|
||||
}
|
||||
/* here was code that helped SCTP to use service names.
|
||||
If you need this feature enhance your /etc/services with sctp entries */
|
||||
|
||||
hints.ai_flags |= AI_PASSIVE;
|
||||
hints.ai_family = family;
|
||||
hints.ai_socktype = socktype;
|
||||
|
|
Loading…
Reference in a new issue