]> git.kaiwu.me - nginx.git/commitdiff
Limited max udp payload size for outgoing packets.
authorVladimir Homutov <vl@nginx.com>
Wed, 10 Jun 2020 18:37:08 +0000 (21:37 +0300)
committerVladimir Homutov <vl@nginx.com>
Wed, 10 Jun 2020 18:37:08 +0000 (21:37 +0300)
This allows to avoid problems with packet fragmentation in real networks.
This is a temporary workaround.

src/event/ngx_event_quic.c
src/event/ngx_event_quic.h

index 56cf9d06f3eecb04f35e48e7bd595bfbc3e037d8..d685d45140f02882f06337f8a34bf6c44b92404a 100644 (file)
@@ -430,6 +430,12 @@ ngx_quic_add_handshake_data(ngx_ssl_conn_t *ssl_conn,
                 return 0;
             }
 
+            if (qc->ctp.max_udp_payload_size > NGX_QUIC_MAX_UDP_PAYLOAD_OUT) {
+                qc->ctp.max_udp_payload_size = NGX_QUIC_MAX_UDP_PAYLOAD_OUT;
+                ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
+                              "quic client maximum packet size truncated");
+            }
+
 #if (NGX_QUIC_DRAFT_VERSION >= 28)
             if (qc->scid.len != qc->ctp.initial_scid.len
                 || ngx_memcmp(qc->scid.data, qc->ctp.initial_scid.data,
@@ -640,7 +646,7 @@ ngx_quic_new_connection(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_tp_t *tp,
     qc->streams.handler = handler;
 
     ctp = &qc->ctp;
-    ctp->max_udp_payload_size = NGX_QUIC_MAX_UDP_PAYLOAD_SIZE;
+    ctp->max_udp_payload_size = NGX_QUIC_MAX_UDP_PAYLOAD_OUT;
     ctp->ack_delay_exponent = NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT;
     ctp->max_ack_delay = NGX_QUIC_DEFAULT_MAX_ACK_DELAY;
 
index 17ea6470099e103fd189ab69fb764c7c72a7f87a..495e079964e4df284bd20d20b5d58ea36ceeece7 100644 (file)
@@ -23,6 +23,8 @@
     /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */
 
 #define NGX_QUIC_MAX_UDP_PAYLOAD_SIZE        65527
+#define NGX_QUIC_MAX_UDP_PAYLOAD_OUT         1300  /* TODO */
+
 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT  3
 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY       25