mirror of
https://github.com/curl/curl.git
synced 2024-12-15 06:40:09 +08:00
vquic/ngtcp2.h: define local_addr as sockaddr_storage
This field needs to be wide enough to hold sockaddr_in6 when connecting via IPv6. Otherwise, ngtcp2_conn_read_pkt will drop the packets because of the address mismatch: I00000022 [...] con ignore packet from unknown path We can safely assume that struct sockaddr_storage is available, as it is used in the public interface of ngtcp2. Closes #6250
This commit is contained in:
parent
0b60d3685e
commit
0cbd5d5c4f
@ -828,7 +828,8 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
|
||||
if(rv == -1)
|
||||
return CURLE_QUIC_CONNECT_ERROR;
|
||||
|
||||
ngtcp2_addr_init(&path.local, &qs->local_addr, qs->local_addrlen, NULL);
|
||||
ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
|
||||
qs->local_addrlen, NULL);
|
||||
ngtcp2_addr_init(&path.remote, addr, addrlen, NULL);
|
||||
|
||||
rc = ngtcp2_conn_client_new(&qs->qconn, &qs->dcid, &qs->scid, &path,
|
||||
@ -1745,7 +1746,7 @@ static CURLcode ng_process_ingress(struct connectdata *conn,
|
||||
return CURLE_RECV_ERROR;
|
||||
}
|
||||
|
||||
ngtcp2_addr_init(&path.local, &qs->local_addr,
|
||||
ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
|
||||
qs->local_addrlen, NULL);
|
||||
ngtcp2_addr_init(&path.remote, (struct sockaddr *)&remote_addr,
|
||||
remote_addrlen, NULL);
|
||||
@ -1779,7 +1780,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
|
||||
nghttp3_vec vec[16];
|
||||
ssize_t ndatalen;
|
||||
|
||||
switch(qs->local_addr.sa_family) {
|
||||
switch(qs->local_addr.ss_family) {
|
||||
case AF_INET:
|
||||
pktlen = NGTCP2_MAX_PKTLEN_IPV4;
|
||||
break;
|
||||
|
@ -58,7 +58,7 @@ struct quicsocket {
|
||||
struct quic_handshake crypto_data[3];
|
||||
/* the last TLS alert description generated by the local endpoint */
|
||||
uint8_t tls_alert;
|
||||
struct sockaddr local_addr;
|
||||
struct sockaddr_storage local_addr;
|
||||
socklen_t local_addrlen;
|
||||
|
||||
nghttp3_conn *h3conn;
|
||||
|
Loading…
Reference in New Issue
Block a user