lib: keep conn IP information together

new struct ip_quadruple for holding local/remote addr+port

- used in data->info and conn and cf-socket.c
- copy back and forth complete struct
- add 'secondary' to conn
- use secondary in reporting success for ftp 2nd connection

Reported-by: DasKutti on github
Fixes #13084
Closes #13090
This commit is contained in:
Stefan Eissing 2024-03-08 10:45:14 +01:00 committed by Daniel Stenberg
parent 1ccf1cd993
commit fcef00db1a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
20 changed files with 148 additions and 200 deletions

View file

@ -1903,7 +1903,7 @@ static char *control_address(struct connectdata *conn)
if(conn->bits.tunnel_proxy || conn->bits.socksproxy)
return conn->host.name;
#endif
return conn->primary_ip;
return conn->primary.remote_ip;
}
static bool match_pasv_6nums(const char *p,
@ -2040,14 +2040,14 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
*/
const char * const host_name = conn->bits.socksproxy ?
conn->socks_proxy.host.name : conn->http_proxy.host.name;
rc = Curl_resolv(data, host_name, conn->port, FALSE, &addr);
rc = Curl_resolv(data, host_name, conn->primary.remote_port, FALSE, &addr);
if(rc == CURLRESOLV_PENDING)
/* BLOCKING, ignores the return code but 'addr' will be NULL in
case of failure */
(void)Curl_resolver_wait_resolv(data, &addr);
connectport =
(unsigned short)conn->port; /* we connect to the proxy's port */
/* we connect to the proxy's port */
connectport = (unsigned short)conn->primary.remote_port;
if(!addr) {
failf(data, "Can't resolve proxy host %s:%hu", host_name, connectport);