]> git.kaiwu.me - nginx.git/commitdiff
QUIC: simplified sending 1-RTT only frames.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 5 May 2021 16:32:49 +0000 (19:32 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 5 May 2021 16:32:49 +0000 (19:32 +0300)
src/event/quic/ngx_event_quic.c
src/event/quic/ngx_event_quic_connid.c
src/event/quic/ngx_event_quic_connid.h
src/event/quic/ngx_event_quic_migration.c
src/event/quic/ngx_event_quic_migration.h

index e19795487eec2833120add80edb4c6905f7bd6c7..b1aa758ee7f845a451f693b4703b465d259463e7 100644 (file)
@@ -1265,8 +1265,7 @@ ngx_quic_handle_frames(ngx_connection_t *c, ngx_quic_header_t *pkt)
 
         case NGX_QUIC_FT_PATH_CHALLENGE:
 
-            if (ngx_quic_handle_path_challenge_frame(c, pkt,
-                                                     &frame.u.path_challenge)
+            if (ngx_quic_handle_path_challenge_frame(c, &frame.u.path_challenge)
                 != NGX_OK)
             {
                 return NGX_ERROR;
@@ -1276,8 +1275,7 @@ ngx_quic_handle_frames(ngx_connection_t *c, ngx_quic_header_t *pkt)
 
         case NGX_QUIC_FT_PATH_RESPONSE:
 
-            if (ngx_quic_handle_path_response_frame(c, pkt,
-                                                    &frame.u.path_response)
+            if (ngx_quic_handle_path_response_frame(c, &frame.u.path_response)
                 != NGX_OK)
             {
                 return NGX_ERROR;
@@ -1287,7 +1285,7 @@ ngx_quic_handle_frames(ngx_connection_t *c, ngx_quic_header_t *pkt)
 
         case NGX_QUIC_FT_NEW_CONNECTION_ID:
 
-            if (ngx_quic_handle_new_connection_id_frame(c, pkt, &frame.u.ncid)
+            if (ngx_quic_handle_new_connection_id_frame(c, &frame.u.ncid)
                 != NGX_OK)
             {
                 return NGX_ERROR;
@@ -1297,7 +1295,7 @@ ngx_quic_handle_frames(ngx_connection_t *c, ngx_quic_header_t *pkt)
 
         case NGX_QUIC_FT_RETIRE_CONNECTION_ID:
 
-            if (ngx_quic_handle_retire_connection_id_frame(c, pkt,
+            if (ngx_quic_handle_retire_connection_id_frame(c,
                                                            &frame.u.retire_cid)
                 != NGX_OK)
             {
index 4dbb2bbd6582d811c7267b2822583318cf8a84a3..ca9218fcb4053d5eb7fb806b947d938f190058af 100644 (file)
@@ -16,7 +16,7 @@
 static ngx_int_t ngx_quic_bpf_attach_id(ngx_connection_t *c, u_char *id);
 #endif
 static ngx_int_t ngx_quic_send_retire_connection_id(ngx_connection_t *c,
-    enum ssl_encryption_level_t level, uint64_t seqnum);
+    uint64_t seqnum);
 
 static ngx_quic_client_id_t *ngx_quic_alloc_client_id(ngx_connection_t *c,
     ngx_quic_connection_t *qc);
@@ -75,7 +75,7 @@ ngx_quic_bpf_attach_id(ngx_connection_t *c, u_char *id)
 
 ngx_int_t
 ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f)
+    ngx_quic_new_conn_id_frame_t *f)
 {
     ngx_str_t               id;
     ngx_queue_t            *q;
@@ -94,9 +94,7 @@ ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c,
          *  done so for that sequence number.
          */
 
-        if (ngx_quic_send_retire_connection_id(c, pkt->level, f->seqnum)
-            != NGX_OK)
-        {
+        if (ngx_quic_send_retire_connection_id(c, f->seqnum) != NGX_OK) {
             return NGX_ERROR;
         }
 
@@ -174,9 +172,7 @@ retire:
 
         /* this connection id must be retired */
 
-        if (ngx_quic_send_retire_connection_id(c, pkt->level, cid->seqnum)
-            != NGX_OK)
-        {
+        if (ngx_quic_send_retire_connection_id(c, cid->seqnum) != NGX_OK) {
             return NGX_ERROR;
         }
 
@@ -210,8 +206,7 @@ done:
 
 
 static ngx_int_t
-ngx_quic_send_retire_connection_id(ngx_connection_t *c,
-    enum ssl_encryption_level_t level, uint64_t seqnum)
+ngx_quic_send_retire_connection_id(ngx_connection_t *c, uint64_t seqnum)
 {
     ngx_quic_frame_t       *frame;
     ngx_quic_connection_t  *qc;
@@ -223,7 +218,7 @@ ngx_quic_send_retire_connection_id(ngx_connection_t *c,
         return NGX_ERROR;
     }
 
-    frame->level = level;
+    frame->level = ssl_encryption_application;
     frame->type = NGX_QUIC_FT_RETIRE_CONNECTION_ID;
     frame->u.retire_cid.sequence_number = seqnum;
 
@@ -356,7 +351,7 @@ ngx_quic_used_client_id(ngx_connection_t *c, ngx_quic_path_t *path)
 
 ngx_int_t
 ngx_quic_handle_retire_connection_id_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_retire_cid_frame_t *f)
+    ngx_quic_retire_cid_frame_t *f)
 {
     ngx_quic_path_t        *path;
     ngx_quic_socket_t      *qsock, **tmp;
index a0552e9dd419c9d37875688c8d73d8ba3a7722b8..f823e84dca8eca2aed16f2bdefd5b71cfb70b47e 100644 (file)
@@ -13,9 +13,9 @@
 
 
 ngx_int_t ngx_quic_handle_retire_connection_id_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_retire_cid_frame_t *f);
+    ngx_quic_retire_cid_frame_t *f);
 ngx_int_t ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f);
+    ngx_quic_new_conn_id_frame_t *f);
 
 ngx_int_t ngx_quic_create_sockets(ngx_connection_t *c);
 ngx_int_t ngx_quic_create_server_id(ngx_connection_t *c, u_char *id);
index 74dc0113b10ee7fbf6792d7bf556798265ef88c8..d6300012d5e0bcad24d83c269500074f20eb07aa 100644 (file)
@@ -22,7 +22,7 @@ static ngx_quic_path_t *ngx_quic_alloc_path(ngx_connection_t *c);
 
 ngx_int_t
 ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f)
+    ngx_quic_path_challenge_frame_t *f)
 {
     off_t                   max, pad;
     ssize_t                 sent;
@@ -33,7 +33,7 @@ ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
 
     qc = ngx_quic_get_connection(c);
 
-    frame.level = pkt->level;
+    frame.level = ssl_encryption_application;
     frame.type = NGX_QUIC_FT_PATH_RESPONSE;
     frame.u.path_response = *f;
 
@@ -70,7 +70,7 @@ ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
             return NGX_ERROR;
         }
 
-        fp->level = pkt->level;
+        fp->level = ssl_encryption_application;
         fp->type = NGX_QUIC_FT_PING;
 
         ngx_quic_queue_frame(qc, fp);
@@ -82,7 +82,7 @@ ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
 
 ngx_int_t
 ngx_quic_handle_path_response_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f)
+    ngx_quic_path_challenge_frame_t *f)
 {
     ngx_queue_t            *q;
     ngx_quic_path_t        *path, *prev;
@@ -557,7 +557,6 @@ ngx_quic_validate_path(ngx_connection_t *c, ngx_quic_socket_t *qsock)
         ngx_add_timer(&qc->path_validation, pto);
     }
 
-
     return NGX_OK;
 }
 
index 3de1d2c5130e6f63ab71dc6a351c88d1186c8b9a..7c37c90857e56200c8f2a6ca524dad7bd80026a0 100644 (file)
@@ -26,9 +26,9 @@
 
 
 ngx_int_t ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f);
+    ngx_quic_path_challenge_frame_t *f);
 ngx_int_t ngx_quic_handle_path_response_frame(ngx_connection_t *c,
-    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f);
+    ngx_quic_path_challenge_frame_t *f);
 
 ngx_quic_path_t *ngx_quic_add_path(ngx_connection_t *c,
     struct sockaddr *sockaddr, socklen_t socklen);