bind9/lib/isccc/include/isccc
Mark Andrews d5103b742b
Defer control channel message invalidation
The conn_shutdown() function is called whenever a control channel
connection is supposed to be closed, e.g. after a response to the client
is sent or when named is being shut down.  That function calls
isccc_ccmsg_invalidate(), which resets the magic number in the structure
holding the messages exchanged over a given control channel connection
(isccc_ccmsg_t).  The expectation here is that all operations related to
the given control channel connection will have been completed by the
time the connection needs to be shut down.

However, if named shutdown is initiated while a control channel message
is still in flight, some netmgr callbacks might still be pending when
conn_shutdown() is called and isccc_ccmsg_t invalidated.  This causes
the REQUIRE assertion checking the magic number in ccmsg_senddone() to
fail when the latter function is eventually called, resulting in a
crash.

Fix by splitting up isccc_ccmsg_invalidate() into two separate
functions:

  - isccc_ccmsg_disconnect(), which initiates TCP connection shutdown,
  - isccc_ccmsg_invalidate(), which cleans up magic number and buffer,

and then:

  - replacing all existing uses of isccc_ccmsg_invalidate() with calls
    to isccc_ccmsg_disconnect(),

  - only calling isccc_ccmsg_invalidate() when all netmgr callbacks are
    guaranteed to have been run.

Adjust function comments accordingly.
2024-01-10 15:48:25 +01:00
..
alist.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
base64.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
cc.h Apply adjusted clang-format 2023-03-10 17:31:28 +01:00
ccmsg.h Defer control channel message invalidation 2024-01-10 15:48:25 +01:00
sexpr.h Update clang to version 14 2022-06-16 17:21:11 +02:00
symtab.h Update clang to version 14 2022-06-16 17:21:11 +02:00
symtype.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
types.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
util.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00