1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-09 05:46:32 +00:00

TCP based clients try all results of name resolution until a connection succeeded

This commit is contained in:
Gerhard Rieger 2023-10-22 23:15:49 +02:00
parent 2a9623d61c
commit cb6e16b360
16 changed files with 456 additions and 262 deletions

View file

@ -382,7 +382,7 @@ int _xioopen_udp_sendto(const char *hostname, const char *servname,
xfd->salen = sizeof(xfd->peersa);
if ((result =
xiogetaddrinfo(hostname, servname, pf, socktype, ipproto,
xioresolve(hostname, servname, pf, socktype, ipproto,
&xfd->peersa, &xfd->salen,
xfd->para.socket.ip.res_opts[0],
xfd->para.socket.ip.res_opts[1]))
@ -515,7 +515,7 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
}
if ((result =
xiogetaddrinfo(NULL, argv[1], pf, socktype, ipproto,
xioresolve(NULL, argv[1], pf, socktype, ipproto,
&us, &uslen, xfd->stream.para.socket.ip.res_opts[0],
xfd->stream.para.socket.ip.res_opts[1]))
!= STAT_OK) {
@ -588,7 +588,7 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
}
if ((result =
xiogetaddrinfo(NULL, argv[1], pf, socktype, ipproto,
xioresolve(NULL, argv[1], pf, socktype, ipproto,
&us, &uslen, xfd->stream.para.socket.ip.res_opts[0],
xfd->stream.para.socket.ip.res_opts[1]))
!= STAT_OK) {
@ -627,6 +627,7 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
#if WITH_IP4 /*|| WITH_IP6*/
if (retropt_string(opts, OPT_RANGE, &rangename) >= 0) {
if (xioparserange(rangename, pf, &xfd->stream.para.socket.range) < 0) {
free(rangename);
return STAT_NORETRY;
}
xfd->stream.para.socket.dorange = true;