<div dir="ltr"><div>Hello.</div><div><br></div>This patch is strange.<br>1. ngx_quic_revert_send can set to ctx an uninitialized value from preserved_pnum. (example if min > len and i = 0, only 0 element is filled in preserved_pnum but restored all)<br>2. ngx_quic_revert_send will restored pnum for ctx that have already called ngx_quic_output_packet and the packet with this pnum will be queued. (example if min > len and i = 1)<br><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 2, 2022 at 2:07 PM Sergey Kandaurov <<a href="mailto:pluknet@nginx.com">pluknet@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On 2 Feb 2022, at 13:55, Vladimir Homutov <<a href="mailto:vl@nginx.com" target="_blank">vl@nginx.com</a>> wrote:<br>
> <br>
> # HG changeset patch<br>
> # User Vladimir Homutov <<a href="mailto:vl@nginx.com" target="_blank">vl@nginx.com</a>><br>
> # Date 1643796973 -10800<br>
> #      Wed Feb 02 13:16:13 2022 +0300<br>
> # Branch quic<br>
> # Node ID fbfbcf66990e8964bcf308f3869f37d1a1acceeb<br>
> # Parent  8c6645ecaeb6cbf27976fd9035440bfcab943117<br>
> QUIC: fixed padding of initial packets in case of limited path.<br>
> <br>
> Previously, non-padded initial packet could be sent as a result of the<br>
> following situation:<br>
> <br>
> - initial queue is not empty (so padding to 1200 is required)<br>
> - handhsake queue is not empty (so padding is to be added after h/s packet)<br>
<br>
handshake<br>
<br>
> - path is limited<br>
> <br>
> If serializing handshake packet would violate path limit, such packet was<br>
> omitted, and the non-padded initial packet was sent.<br>
> <br>
> The fix is to avoid sending the packet at all in such case.  This follows the<br>
> original intention introduced in c5155a0cb12f.<br>
> <br>
> diff --git a/src/event/quic/ngx_event_quic_output.c b/src/event/quic/ngx_event_quic_output.c<br>
> --- a/src/event/quic/ngx_event_quic_output.c<br>
> +++ b/src/event/quic/ngx_event_quic_output.c<br>
> @@ -158,7 +158,14 @@ ngx_quic_create_datagrams(ngx_connection<br>
>                   ? NGX_QUIC_MIN_INITIAL_SIZE - (p - dst) : 0;<br>
> <br>
>             if (min > len) {<br>
> -                continue;<br>
> +                /* padding can't be applied - avoid sending the packet */<br>
> +<br>
> +                for (i = 0; i < NGX_QUIC_SEND_CTX_LAST; i++) {<br>
> +                    ctx = &qc->send_ctx[i];<br>
> +                    ngx_quic_revert_send(c, ctx, preserved_pnum[i]);<br>
<br>
this could be simplified to reduce ctx variable:<br>
    ngx_quic_revert_send(c, &qc->send_ctx[i], preserved_pnum[i]);<br>
<br>
but it won't fit into 80 line, so that's good just as well<br>
<br>
> +                }<br>
> +<br>
> +                return NGX_OK;<br>
>             }<br>
> <br>
>             n = ngx_quic_output_packet(c, ctx, p, len, min);<br>
> <br>
<br>
-- <br>
Sergey Kandaurov<br>
<br>
_______________________________________________<br>
nginx-devel mailing list -- <a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
To unsubscribe send an email to <a href="mailto:nginx-devel-leave@nginx.org" target="_blank">nginx-devel-leave@nginx.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><span style="font-family:Arial,sans-serif;font-size:13px;line-height:18px;text-align:left;background-color:rgb(255,255,255)">Best regards, Andrey</span></div>