diff options
author | Joan Bruguera <joanbrugueram@gmail.com> | 2022-01-30 12:51:10 +0100 |
---|---|---|
committer | Joan Bruguera <joanbrugueram@gmail.com> | 2022-02-01 19:25:32 +0100 |
commit | 839a70c3534ce10ed7a66b5925f4570d88b2b64a (patch) | |
tree | 105dd504b6317311540e89b37f0086e264daff02 /src/resolve/resolved-dnstls.h | |
parent | aa892849d50e9dd5da03a628463ccf6c55ff1b44 (diff) | |
download | systemd-839a70c3534ce10ed7a66b5925f4570d88b2b64a.tar.gz |
resolved: Read as much as possible per stream EPOLLIN event
In commit 2aaf6bb6e99b0f2bd73e0c49bef9e11a2844bf1a, an issue was fixed where
systemd-resolved could get stuck for multiple seconds waiting for incoming data,
since GnuTLS/OpenSSL can buffer a TLS record, so data could be available, but
no EPOLLIN event would be generated.
To fix this, a somewhat elaborate logic consisting on asking the TLS library
whether it had buffered data, then "faking" an EPOLLIN event was implemented.
However, there is a much simpler solution: Always read as much data as available
(i.e. until we get an event like EAGAIN when trying to read) from the stream
when we get an EPOLLIN event, instead of at most a single packet per event.
This approach does not require asking the TLS library whether it has buffered
data, and the logic is exactly the same for both the TCP and TLS case.
test-resolved-stream is fixed to avoid a latent double free bug.
Diffstat (limited to 'src/resolve/resolved-dnstls.h')
-rw-r--r-- | src/resolve/resolved-dnstls.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/resolve/resolved-dnstls.h b/src/resolve/resolved-dnstls.h index 70b27d8d77..cda97e0b12 100644 --- a/src/resolve/resolved-dnstls.h +++ b/src/resolve/resolved-dnstls.h @@ -3,7 +3,6 @@ #if ENABLE_DNS_OVER_TLS -#include <stdbool.h> #include <stdint.h> #include <sys/uio.h> @@ -30,7 +29,6 @@ int dnstls_stream_on_io(DnsStream *stream, uint32_t revents); int dnstls_stream_shutdown(DnsStream *stream, int error); ssize_t dnstls_stream_writev(DnsStream *stream, const struct iovec *iov, size_t iovcnt); ssize_t dnstls_stream_read(DnsStream *stream, void *buf, size_t count); -bool dnstls_stream_has_buffered_data(DnsStream *stream); void dnstls_server_free(DnsServer *server); |