1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-19 09:22:57 +00:00

Use correct IPPROTO with CONNECT

This commit is contained in:
Gerhard 2025-02-17 20:30:26 +01:00
parent 186a323c2d
commit 48f3341d82
2 changed files with 13 additions and 0 deletions

View file

@ -459,6 +459,7 @@ int _xiogetaddrinfo(const char *node, const char *service,
#else /* HAVE_PROTOTYPE_LIB_getipnodebyname || nothing */
struct hostent *host;
#endif
bool restore_proto = false;
int error_num;
Debug8("_xiogetaddrinfo(node=\"%s\", service=\"%s\", family=%d, socktype=%d, protoco=%d, ai_flags={0x%04x/0x%04x} }, res=%p",
@ -585,6 +586,7 @@ int _xiogetaddrinfo(const char *node, const char *service,
return EAI_SERVICE;
}
/* Probably unsupported protocol (e.g. UDP-Lite), fallback to 0 */
restore_proto = true;
hints.ai_protocol = 0;
continue;
}
@ -613,6 +615,14 @@ int _xiogetaddrinfo(const char *node, const char *service,
#endif /* WITH_MSGLEVEL <= E_DEBUG */
}
if (restore_proto) {
struct addrinfo *record = *res;
while (record) {
record->ai_protocol = protocol;
record = record->ai_next;
}
}
#elif HAVE_PROTOTYPE_LIB_getipnodebyname /* !HAVE_GETADDRINFO */
if (node != NULL) {