Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_output.c @ 9145:93aee926d27f
QUIC: removed explicit packet padding for certain frames.
The frames for which the padding is removed are PATH_CHALLENGE and
PATH_RESPONSE, which are sent separately by ngx_quic_frame_sendto().
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 06 Jul 2023 11:30:47 +0400 |
parents | bba136612fe4 |
children | f3412ec3b6d1 |
comparison
equal
deleted
inserted
replaced
9144:bba136612fe4 | 9145:93aee926d27f |
---|---|
523 size_t len, pad, min_payload, max_payload; | 523 size_t len, pad, min_payload, max_payload; |
524 u_char *p; | 524 u_char *p; |
525 ssize_t flen; | 525 ssize_t flen; |
526 ngx_str_t res; | 526 ngx_str_t res; |
527 ngx_int_t rc; | 527 ngx_int_t rc; |
528 ngx_uint_t nframes, expand; | 528 ngx_uint_t nframes; |
529 ngx_msec_t now; | 529 ngx_msec_t now; |
530 ngx_queue_t *q; | 530 ngx_queue_t *q; |
531 ngx_quic_frame_t *f; | 531 ngx_quic_frame_t *f; |
532 ngx_quic_header_t pkt; | 532 ngx_quic_header_t pkt; |
533 ngx_quic_connection_t *qc; | 533 ngx_quic_connection_t *qc; |
558 | 558 |
559 now = ngx_current_msec; | 559 now = ngx_current_msec; |
560 nframes = 0; | 560 nframes = 0; |
561 p = src; | 561 p = src; |
562 len = 0; | 562 len = 0; |
563 expand = 0; | |
564 | 563 |
565 for (q = ngx_queue_head(&ctx->frames); | 564 for (q = ngx_queue_head(&ctx->frames); |
566 q != ngx_queue_sentinel(&ctx->frames); | 565 q != ngx_queue_sentinel(&ctx->frames); |
567 q = ngx_queue_next(q)) | 566 q = ngx_queue_next(q)) |
568 { | 567 { |
569 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 568 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
570 | |
571 if (!expand && (f->type == NGX_QUIC_FT_PATH_RESPONSE | |
572 || f->type == NGX_QUIC_FT_PATH_CHALLENGE)) | |
573 { | |
574 /* | |
575 * RFC 9000, 8.2.1. Initiating Path Validation | |
576 * | |
577 * An endpoint MUST expand datagrams that contain a | |
578 * PATH_CHALLENGE frame to at least the smallest allowed | |
579 * maximum datagram size of 1200 bytes... | |
580 * | |
581 * (same applies to PATH_RESPONSE frames) | |
582 */ | |
583 | |
584 if (max < 1200) { | |
585 /* expanded packet will not fit */ | |
586 break; | |
587 } | |
588 | |
589 if (min < 1200) { | |
590 min = 1200; | |
591 | |
592 min_payload = ngx_quic_payload_size(&pkt, min); | |
593 } | |
594 | |
595 expand = 1; | |
596 } | |
597 | 569 |
598 if (len >= max_payload) { | 570 if (len >= max_payload) { |
599 break; | 571 break; |
600 } | 572 } |
601 | 573 |