]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix reading extra messages in TLS DNS in client mode
authorArtem Boldariev <artem@boldariev.com>
Wed, 17 Jan 2024 13:40:56 +0000 (15:40 +0200)
committerArtem Boldariev <artem@boldariev.com>
Wed, 17 Jan 2024 20:35:25 +0000 (22:35 +0200)
commit7b390a7fb6ca10b60147b72acec0e951da251a7d
treeda6a3a727ab2e48ef82cfa21c770d60bc46c29bf
parent0a6472be2910a9a0ea4800f2fd0687e30d41eacf
Fix reading extra messages in TLS DNS in client mode

When connecting to a remote party the TLS DNS code could process more
than one message at a time despite the fact that it is expected that
we should stop after every DNS message.

Every DNS message is handled and consumed from the input buffer by
isc__nm_process_sock_buffer(). However, as opposed to TCP DNS code, it
can be called more than once when processing incoming data from a
server (see tls_cycle_input()). That, in turn means that we can
process more than one message at a time. Some higher level code might
not expect that, as it breaks the contract.

In particular, in the original report that happened during
isc__nm_async_tlsdnsshutdown() call: when shutting down multiple calls
to tls_cycle() are possible (each possibly leading to a
isc__nm_process_sock_buffer()). If there are any non processed
messages left, for any of the messages left the read callback will be
called even when it is not expected as there were no preceding
isc_nm_read().

To keep TCP DNS and TLS DNS code in sync, we make a similar change to
it as well, although it should not matter.
lib/isc/netmgr/tcpdns.c
lib/isc/netmgr/tlsdns.c