Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic_connection.h @ 8971:1e2f4e9c8195 quic
QUIC: reworked migration handling.
The quic connection now holds active, backup and probe paths instead
of sockets. The number of migration paths is now limited and cannot
be inflated by a bad client or an attacker.
The client id is now associated with path rather than socket. This allows
to simplify processing of output and connection ids handling.
New migration abandons any previously started migrations. This allows to
free consumed client ids and request new for use in future migrations and
make progress in case when connection id limit is hit during migration.
A path now can be revalidated without losing its state.
The patch also fixes various issues with NAT rebinding case handling:
- paths are now validated (previously, there was no validation
and paths were left in limited state)
- attempt to reuse id on different path is now again verified
(this was broken in 40445fc7c403)
- former path is now validated in case of apparent migration
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 19 Jan 2022 22:39:24 +0300 |
parents | fb811b6c76ee |
children | a5aebd51e4c7 |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_connection.h +++ b/src/event/quic/ngx_event_quic_connection.h @@ -69,7 +69,7 @@ struct ngx_quic_client_id_s { size_t len; u_char id[NGX_QUIC_CID_LEN_MAX]; u_char sr_token[NGX_QUIC_SR_TOKEN_LEN]; - ngx_uint_t refcnt; + ngx_uint_t used; /* unsigned used:1; */ }; @@ -83,20 +83,22 @@ struct ngx_quic_server_id_s { struct ngx_quic_path_s { ngx_queue_t queue; struct sockaddr *sockaddr; + ngx_sockaddr_t sa; socklen_t socklen; - ngx_uint_t state; - ngx_uint_t limited; /* unsigned limited:1; */ + ngx_quic_client_id_t *cid; ngx_msec_t expires; - ngx_msec_t last_seen; ngx_uint_t tries; + ngx_uint_t tag; off_t sent; off_t received; u_char challenge1[8]; u_char challenge2[8]; - ngx_uint_t refcnt; uint64_t seqnum; ngx_str_t addr_text; u_char text[NGX_SOCKADDR_STRLEN]; + unsigned validated:1; + unsigned validating:1; + unsigned limited:1; }; @@ -104,11 +106,8 @@ struct ngx_quic_socket_s { ngx_udp_connection_t udp; ngx_quic_connection_t *quic; ngx_queue_t queue; - ngx_quic_server_id_t sid; - - ngx_quic_path_t *path; - ngx_quic_client_id_t *cid; + ngx_uint_t used; /* unsigned used:1; */ }; @@ -184,8 +183,7 @@ struct ngx_quic_send_ctx_s { struct ngx_quic_connection_s { uint32_t version; - ngx_quic_socket_t *socket; - ngx_quic_socket_t *backup; + ngx_quic_path_t *path; ngx_queue_t sockets; ngx_queue_t paths;