<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nginx.git/src, branch release-1.23.1</title>
<subtitle>nginx</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/'/>
<entry>
<title>Events: fixed EPOLLRDHUP with FIONREAD (ticket #2367).</title>
<updated>2022-07-15T12:19:32+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2022-07-15T12:19:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=39b84d7a52c2d367d6baba85521c3e7cd0271961'/>
<id>39b84d7a52c2d367d6baba85521c3e7cd0271961</id>
<content type='text'>
When reading exactly rev-&gt;available bytes, rev-&gt;available might become 0
after FIONREAD usage introduction in efd71d49bde0.  On the next call of
ngx_readv_chain() on systems with EPOLLRDHUP this resulted in return without
any actions, that is, with rev-&gt;ready set, and this in turn resulted in no
timers set in event pipe, leading to socket leaks.

Fix is to reset rev-&gt;ready in ngx_readv_chain() when returning due to
rev-&gt;available being 0 with EPOLLRDHUP, much like it is already done in
ngx_unix_recv().  This ensures that if rev-&gt;available will become 0, on
systems with EPOLLRDHUP support appropriate EPOLLRDHUP-specific handling
will happen on the next ngx_readv_chain() call.

While here, also synced ngx_readv_chain() to match ngx_unix_recv() and
reset rev-&gt;ready when returning due to rev-&gt;available being 0 with kqueue.
This is mostly cosmetic change, as rev-&gt;ready is anyway reset when
rev-&gt;available is set to 0.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When reading exactly rev-&gt;available bytes, rev-&gt;available might become 0
after FIONREAD usage introduction in efd71d49bde0.  On the next call of
ngx_readv_chain() on systems with EPOLLRDHUP this resulted in return without
any actions, that is, with rev-&gt;ready set, and this in turn resulted in no
timers set in event pipe, leading to socket leaks.

Fix is to reset rev-&gt;ready in ngx_readv_chain() when returning due to
rev-&gt;available being 0 with EPOLLRDHUP, much like it is already done in
ngx_unix_recv().  This ensures that if rev-&gt;available will become 0, on
systems with EPOLLRDHUP support appropriate EPOLLRDHUP-specific handling
will happen on the next ngx_readv_chain() call.

While here, also synced ngx_readv_chain() to match ngx_unix_recv() and
reset rev-&gt;ready when returning due to rev-&gt;available being 0 with kqueue.
This is mostly cosmetic change, as rev-&gt;ready is anyway reset when
rev-&gt;available is set to 0.
</pre>
</div>
</content>
</entry>
<entry>
<title>Range filter: clearing of pre-existing Content-Range headers.</title>
<updated>2022-07-15T04:01:44+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2022-07-15T04:01:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=f35475c083d4cfe56647b66387b60c55e25c27d0'/>
<id>f35475c083d4cfe56647b66387b60c55e25c27d0</id>
<content type='text'>
Some servers might emit Content-Range header on 200 responses, and this
does not seem to contradict RFC 9110: as per RFC 9110, the Content-Range
header has no meaning for status codes other than 206 and 416.  Previously
this resulted in duplicate Content-Range headers in nginx responses handled
by the range filter.  Fix is to clear pre-existing headers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some servers might emit Content-Range header on 200 responses, and this
does not seem to contradict RFC 9110: as per RFC 9110, the Content-Range
header has no meaning for status codes other than 206 and 416.  Previously
this resulted in duplicate Content-Range headers in nginx responses handled
by the range filter.  Fix is to clear pre-existing headers.
</pre>
</div>
</content>
</entry>
<entry>
<title>Resolver: fixed memory leak for the "ipv4=off" case.</title>
<updated>2022-07-14T17:26:54+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2022-07-14T17:26:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=14341ce2377d38a268261e0fec65b6915ae6e95e'/>
<id>14341ce2377d38a268261e0fec65b6915ae6e95e</id>
<content type='text'>
This change partially reverts 2a77754cd9fe to properly free rn-&gt;query.

Found by Coverity (CID 1507244).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change partially reverts 2a77754cd9fe to properly free rn-&gt;query.

Found by Coverity (CID 1507244).
</pre>
</div>
</content>
</entry>
<entry>
<title>The "ipv4=" parameter of the "resolver" directive.</title>
<updated>2022-07-12T17:44:02+00:00</updated>
<author>
<name>Ruslan Ermilov</name>
<email>ru@nginx.com</email>
</author>
<published>2022-07-12T17:44:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=5178da4f94fbae1daec2800bc7fd74cd2923c5bd'/>
<id>5178da4f94fbae1daec2800bc7fd74cd2923c5bd</id>
<content type='text'>
When set to "off", only IPv6 addresses will be resolved, and no
A queries are ever sent (ticket #2196).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When set to "off", only IPv6 addresses will be resolved, and no
A queries are ever sent (ticket #2196).
</pre>
</div>
</content>
</entry>
<entry>
<title>SSL: logging levels of various errors added in OpenSSL 1.1.1.</title>
<updated>2022-07-12T12:55:22+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2022-07-12T12:55:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=ea46b22dfb56137afc7463bc0383e52ff27c7905'/>
<id>ea46b22dfb56137afc7463bc0383e52ff27c7905</id>
<content type='text'>
Starting with OpenSSL 1.1.1, various additional errors can be reported
by OpenSSL in case of client-related issues, most notably during TLSv1.3
handshakes.  In particular, SSL_R_BAD_KEY_SHARE ("bad key share"),
SSL_R_BAD_EXTENSION ("bad extension"), SSL_R_BAD_CIPHER ("bad cipher"),
SSL_R_BAD_ECPOINT ("bad ecpoint").  These are now logged at the "info"
level.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Starting with OpenSSL 1.1.1, various additional errors can be reported
by OpenSSL in case of client-related issues, most notably during TLSv1.3
handshakes.  In particular, SSL_R_BAD_KEY_SHARE ("bad key share"),
SSL_R_BAD_EXTENSION ("bad extension"), SSL_R_BAD_CIPHER ("bad cipher"),
SSL_R_BAD_ECPOINT ("bad ecpoint").  These are now logged at the "info"
level.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: optimized use of SSL contexts (ticket #1234).</title>
<updated>2022-06-28T23:47:45+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2022-06-28T23:47:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d791b4aab418b0cbadbaf079fbb9360269d97941'/>
<id>d791b4aab418b0cbadbaf079fbb9360269d97941</id>
<content type='text'>
To ensure optimal use of memory, SSL contexts for proxying are now
inherited from previous levels as long as relevant proxy_ssl_* directives
are not redefined.

Further, when no proxy_ssl_* directives are redefined in a server block,
we now preserve plcf-&gt;upstream.ssl in the "http" section configuration
to inherit it to all servers.

Similar changes made in uwsgi, grpc, and stream proxy.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To ensure optimal use of memory, SSL contexts for proxying are now
inherited from previous levels as long as relevant proxy_ssl_* directives
are not redefined.

Further, when no proxy_ssl_* directives are redefined in a server block,
we now preserve plcf-&gt;upstream.ssl in the "http" section configuration
to inherit it to all servers.

Similar changes made in uwsgi, grpc, and stream proxy.
</pre>
</div>
</content>
</entry>
<entry>
<title>Version bump.</title>
<updated>2022-06-28T23:47:38+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2022-06-28T23:47:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=225a2c1b4a83d5813140a474716de8c33a9bbc2d'/>
<id>225a2c1b4a83d5813140a474716de8c33a9bbc2d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Perl: removed unused variables, forgotten in ef6a3a99a81a.</title>
<updated>2022-06-14T06:39:58+00:00</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@nginx.com</email>
</author>
<published>2022-06-14T06:39:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=21506a2f851c9dbff4bee67fe5b6d199c83c799a'/>
<id>21506a2f851c9dbff4bee67fe5b6d199c83c799a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Resolver: make TCP write timer event cancelable.</title>
<updated>2022-06-02T03:17:23+00:00</updated>
<author>
<name>Aleksei Bavshin</name>
<email>a.bavshin@f5.com</email>
</author>
<published>2022-06-02T03:17:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=f2fcc03d3aa6f0e0a457a994dbc743b5b63ad035'/>
<id>f2fcc03d3aa6f0e0a457a994dbc743b5b63ad035</id>
<content type='text'>
Similar to 70e65bf8dfd7, the change is made to ensure that the ability to
cancel resolver tasks is fully controlled by the caller.  As mentioned in the
referenced commit, it is safe to make this timer cancelable because resolve
tasks can have their own timeouts that are not cancelable.

The scenario where this may become a problem is a periodic background resolve
task (not tied to a specific request or a client connection), which receives a
response with short TTL, large enough to warrant fallback to a TCP query.
With each event loop wakeup, we either have a previously set write timer
instance or schedule a new one.  The non-cancelable write timer can delay or
block graceful shutdown of a worker even if the ngx_resolver_ctx_t-&gt;cancelable
flag is set by the API user, and there are no other tasks or connections.

We use the resolver API in this way to maintain the list of upstream server
addresses specified with the 'resolve' parameter, and there could be third-party
modules implementing similar logic.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Similar to 70e65bf8dfd7, the change is made to ensure that the ability to
cancel resolver tasks is fully controlled by the caller.  As mentioned in the
referenced commit, it is safe to make this timer cancelable because resolve
tasks can have their own timeouts that are not cancelable.

The scenario where this may become a problem is a periodic background resolve
task (not tied to a specific request or a client connection), which receives a
response with short TTL, large enough to warrant fallback to a TCP query.
With each event loop wakeup, we either have a previously set write timer
instance or schedule a new one.  The non-cancelable write timer can delay or
block graceful shutdown of a worker even if the ngx_resolver_ctx_t-&gt;cancelable
flag is set by the API user, and there are no other tasks or connections.

We use the resolver API in this way to maintain the list of upstream server
addresses specified with the 'resolve' parameter, and there could be third-party
modules implementing similar logic.
</pre>
</div>
</content>
</entry>
<entry>
<title>Stream: don't flush empty buffers created for read errors.</title>
<updated>2022-05-23T18:29:44+00:00</updated>
<author>
<name>Aleksei Bavshin</name>
<email>a.bavshin@f5.com</email>
</author>
<published>2022-05-23T18:29:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d7994be44592f0ce9c240406b13020cdc377a9f0'/>
<id>d7994be44592f0ce9c240406b13020cdc377a9f0</id>
<content type='text'>
When we generate the last_buf buffer for an UDP upstream recv error, it does
not contain any data from the wire. ngx_stream_write_filter attempts to forward
it anyways, which is incorrect (e.g., UDP upstream ECONNREFUSED will be
translated to an empty packet).

This happens because we mark the buffer as both 'flush' and 'last_buf', and
ngx_stream_write_filter has special handling for flush with certain types of
connections (see d127837c714f, 32b0ba4855a6).  The flags are meant to be
mutually exclusive, so the fix is to ensure that flush and last_buf are not set
at the same time.

Reproduction:

stream {
    upstream unreachable {
        server     127.0.0.1:8880;
    }
    server {
        listen     127.0.0.1:8998 udp;
        proxy_pass unreachable;
    }
}

1 0.000000000    127.0.0.1 → 127.0.0.1    UDP 47 45588 → 8998 Len=5
2 0.000166300    127.0.0.1 → 127.0.0.1    UDP 47 51149 → 8880 Len=5
3 0.000172600    127.0.0.1 → 127.0.0.1    ICMP 75 Destination unreachable (Port
unreachable)
4 0.000202400    127.0.0.1 → 127.0.0.1    UDP 42 8998 → 45588 Len=0

Fixes d127837c714f.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we generate the last_buf buffer for an UDP upstream recv error, it does
not contain any data from the wire. ngx_stream_write_filter attempts to forward
it anyways, which is incorrect (e.g., UDP upstream ECONNREFUSED will be
translated to an empty packet).

This happens because we mark the buffer as both 'flush' and 'last_buf', and
ngx_stream_write_filter has special handling for flush with certain types of
connections (see d127837c714f, 32b0ba4855a6).  The flags are meant to be
mutually exclusive, so the fix is to ensure that flush and last_buf are not set
at the same time.

Reproduction:

stream {
    upstream unreachable {
        server     127.0.0.1:8880;
    }
    server {
        listen     127.0.0.1:8998 udp;
        proxy_pass unreachable;
    }
}

1 0.000000000    127.0.0.1 → 127.0.0.1    UDP 47 45588 → 8998 Len=5
2 0.000166300    127.0.0.1 → 127.0.0.1    UDP 47 51149 → 8880 Len=5
3 0.000172600    127.0.0.1 → 127.0.0.1    ICMP 75 Destination unreachable (Port
unreachable)
4 0.000202400    127.0.0.1 → 127.0.0.1    UDP 42 8998 → 45588 Len=0

Fixes d127837c714f.
</pre>
</div>
</content>
</entry>
</feed>
