1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-17 16:43:24 +00:00

SENDTO addresses now prefer IPv4 over IPv6 name resolution

This commit is contained in:
Gerhard Rieger 2024-08-20 16:10:22 +02:00
parent 868998eb60
commit 127280088c
4 changed files with 99 additions and 25 deletions

View file

@ -230,18 +230,24 @@ int
bool *lowport,
int socktype) {
uint16_t port;
int result;
int rc;
retropt_socket_pf(opts, pf);
if (hostname != NULL || portname != NULL) {
if ((result =
xiogetaddrinfo(hostname, portname,
*pf, socktype, protocol,
themlist, ai_flags))
!= STAT_OK) {
return STAT_NORETRY; /*! STAT_RETRYLATER? */
}
rc = xiogetaddrinfo(hostname, portname, *pf, socktype, protocol,
themlist, ai_flags);
if (rc == EAI_AGAIN) {
Warn4("_xioopen_ipapp_prepare(node=\"%s\", service=\"%s\", pf=%d, ...): %s",
hostname?hostname:"NULL", portname?portname:"NULL",
*pf, gai_strerror(rc));
return STAT_RETRYLATER;
} else if (rc != 0) {
Error4("_xioopen_ipapp_prepare(node=\"%s\", service=\"%s\", pf=%d, ...): %s",
hostname?hostname:"NULL", portname?portname:"NULL",
*pf, (rc == EAI_SYSTEM)?strerror(errno):gai_strerror(rc));
return STAT_NORETRY; /*! STAT_RETRYLATER? */
}
}
applyopts(NULL, -1, opts, PH_EARLY);