2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00
Commit Graph

41659 Commits

Author SHA1 Message Date
Ondřej Surý
679e90a57d Add isc_log_createandusechannel() function to simplify usage
The new
isc_log_createandusechannel() function combines following calls:

    isc_log_createchannel()
    isc_log_usechannel()

calls into a single call that cannot fail and therefore can be used in
places where we know this cannot fail thus simplifying the error
handling.
2024-08-20 12:50:39 +00:00
Ondřej Surý
091d738c72 Convert all categories and modules into static lists
Remove the complicated mechanism that could be (in theory) used by
external libraries to register new categories and modules with
statically defined lists in <isc/log.h>.  This is similar to what we
have done for <isc/result.h> result codes.  All the libraries are now
internal to BIND 9, so we don't need to provide a mechanism to register
extra categories and modules.
2024-08-20 12:50:39 +00:00
Ondřej Surý
8506102216 Remove logging context (isc_log_t) from the public namespace
Now that the logging uses single global context, remove the isc_log_t
from the public namespace.
2024-08-20 12:50:39 +00:00
Ondřej Surý
043f11de3f Remove isc_log_write1() and isc_log_vwrite1() functions
The isc_log_write1() and isc_log_vwrite1() functions were meant to
de-duplicate the messages sent to the isc_log subsystem.  However, they
were never used in an entire code base and the whole mechanism around it
was complicated and very inefficient.  Just remove those, there are
better ways to deduplicate syslog messages inside syslog daemons now.
2024-08-20 12:50:39 +00:00
Ondřej Surý
b2dda86254 Replace isc_log_create/destroy with isc_logconfig_get()
Add isc_logconfig_get() function to get the current logconfig and use
the getter to replace most of the little dancing around setting up
logging in the tools. Thus:

    isc_log_create(mctx, &lctx, &logconfig);
    isc_log_setcontext(lctx);
    dns_log_setcontext(lctx);
    ...
    ...use lcfg...
    ...
    isc_log_destroy();

is now only:

    logconfig = isc_logconfig_get(lctx);
    ...use lcfg...

For thread-safety, isc_logconfig_get() should be surrounded by RCU read
lock, but since we never use isc_logconfig_get() in threaded context,
the only place where it is actually used (but not really needed) is
named_log_init().
2024-08-20 12:50:39 +00:00
Ondřej Surý
a8a689531f Use single logging context for everything
Instead of juggling different logging context, use one single logging
context that gets initialized in the libisc constructor and destroyed in
the libisc destructor.

The application is still responsible for creating the logging
configuration before using the isc_log API.

This patch is first in the series in a way that it is transparent for
the users of the isc_log API as the isc_log_create() and
isc_log_destroy() are now thin shims that emulate the previous
functionality, but it isc_log_create() will always return internal
isc__lctx pointer and isc_log_destroy() will actually not destroy the
internal isc__lctx context.

Signed-off-by: Ondřej Surý <ondrej@isc.org>
2024-08-20 12:50:39 +00:00
Ondřej Surý
957af59cf8 fix: test: Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.

Closes #4849

Merge branch '4849-dispatch_test-fails-in-connected_shutdown-on-freebsd' into 'main'

Closes #4849

See merge request isc-projects/bind9!9303
2024-08-20 12:46:09 +00:00
Ondřej Surý
e53cb61cf7 Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.
2024-08-20 12:45:54 +00:00
Petr Špaček
db9d3b8207 chg: Update Internal_use_only-CVE.md checklist changing some tasks
Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF. Support will now be sending ASNs to customers, although Marketing will announce the new releases (both publicly and to support customers).

Merge branch 'vicky-main-patch-57381' into 'main'

See merge request isc-projects/bind9!9307
2024-08-20 12:36:36 +00:00
Vicky Risk
019f3ca185 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
5714164f6f Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
411e78d92d Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
0e17d40843 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
7e429463f5 Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF 2024-08-20 12:36:17 +00:00
Nicki Křížek
e4e36e6f37 chg: doc: Improve changelog & release notes workflow
Related: #4847

Merge branch '4847-changelog-sorting-and-tweaks' into 'main'

See merge request isc-projects/bind9!9300
2024-08-20 11:50:48 +00:00
Nicki Křížek
993ba7cc7f Omit MR link from release notes
When manually handling the release notes (due to rst markup, fixups
etc.), the different MR number for backports causes needless friction.
Remove the reference from release notes and keep it only in changelog
which isn't manually redacted.
2024-08-20 11:20:15 +00:00
Nicki Křížek
759948fffe Sort changelog & relnotes entries by issue number
To reduce the friction when handling the release notes, it is preferable
to have the sections sorted by issue number, rather than merge order.
Fallback to commit subject line if unavailable (e.g. for changelog
entries).
2024-08-20 11:20:15 +00:00
Ondřej Surý
5bfed08b25 fix: dev: Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.

Closes #4862

Merge branch '4862-fix-setresuid-shim' into 'main'

Closes #4862

See merge request isc-projects/bind9!9359
2024-08-20 10:22:08 +00:00
Ondřej Surý
5567407a82 Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.
2024-08-20 11:32:35 +02:00
Petr Špaček
50539ae389 chg: doc: Set up version for BIND 9.21.1
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.21.1' into 'main'

See merge request isc-projects/bind9!9355
2024-08-20 09:04:50 +00:00
Nicki Křížek
c795cfec54 Remove release note draft file
Since we've started the new changelog & release notes process, the file
for drafting release notes for the version-to-be is no longer needed.
2024-08-19 18:01:54 +02:00
Nicki Křížek
6f6b53041c Update BIND version to 9.21.1-dev 2024-08-19 17:59:00 +02:00
Nicki Křížek
2b37b2ed74 chg: ci: Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

Closes #4598

Merge branch '4598-mark-statschannel-test-flaky' into 'main'

Closes #4598

See merge request isc-projects/bind9!9293
2024-08-19 14:10:10 +00:00
Nicki Křížek
ec2fc7680a Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.
2024-08-19 16:08:48 +02:00
Arаm Sаrgsyаn
d0d6ad0c52 chg: dev: Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log canceled resolver queries (e.g. when shutting down a hung
fetch) in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

Closes #4797

Merge branch '4797-rpz_rewrite-add-ISC_R_CANCELED-processing' into 'main'

Closes #4797

See merge request isc-projects/bind9!9148
2024-08-19 11:39:29 +00:00
Aram Sargsyan
8bb9568467 Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log  canceled queries (e.g. when shutting down a hung fetch)
in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.
2024-08-19 10:15:01 +00:00
Ondřej Surý
920530b7a3 fix: test: Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.

Merge branch 'ondrej/add-missing-flose-to-rpz-testlib' into 'main'

See merge request isc-projects/bind9!9317
2024-08-19 10:04:29 +00:00
Ondřej Surý
2855ec8f5f Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.
2024-08-19 10:04:19 +00:00
Ondřej Surý
661981be7b fix: dev: Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

Closes #4853

Merge branch '4853-check-result-of-dirfd-in-isc_log' into 'main'

Closes #4853

See merge request isc-projects/bind9!9316
2024-08-19 09:57:48 +00:00
Ondřej Surý
59f4fdebc0 Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().
2024-08-19 09:57:28 +00:00
Ondřej Surý
8071384324 chg: dev: Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

Closes #4852

Merge branch '4852-handle-errors-from-rewind' into 'main'

Closes #4852

See merge request isc-projects/bind9!9315
2024-08-19 09:43:03 +00:00
Ondřej Surý
2fbf9757b8 Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.
2024-08-19 09:42:55 +00:00
Ondřej Surý
dda5ba53df Ignore errno returned from rewind() in the interface iterator
The clang-scan 19 has reported that we are ignoring errno after the call
to rewind().  As we don't really care about the result, just silence the
error, the whole code will be removed in the development version anyway
as it is not needed.
2024-08-19 09:42:55 +00:00
Ondřej Surý
2d12e1142a fix: dev: Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.

Closes #4845

Merge branch '4845-change-NS_PER_SEC-type-from-enum-to-integer' into 'main'

Closes #4845

See merge request isc-projects/bind9!9313
2024-08-19 09:09:09 +00:00
Ondřej Surý
122a142241 Use constexpr for NS_PER_SEC and friends constants
The contexpr introduced in C23 standard makes perfect sense to be used
instead of preprocessor macros - the symbols are kept, etc.  Define
ISC_CONSTEXPR to be `constexpr` for C23 and `static const` for the older
C standards.  Use the newly introduced macro for the NS_PER_SEC and
friends time constants.
2024-08-19 09:08:55 +00:00
Ondřej Surý
b03e90e0d4 Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.
2024-08-19 09:08:55 +00:00
Ondřej Surý
9c06717429 chg: test: Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.

Merge branch 'mnowak/retire-debian-11-bullseye' into 'main'

See merge request isc-projects/bind9!9330
2024-08-16 06:48:38 +00:00
Michal Nowak
930a7515c2 Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.
2024-08-16 08:32:55 +02:00
Ondřej Surý
7cb9af430e chg: test: For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

Additionally, drop Debian bullseye that's EOL now.

Merge branch 'ondrej/use-staging-tsan-images' into 'main'

See merge request isc-projects/bind9!9324
2024-08-15 21:03:26 +00:00
Ondřej Surý
d02d6af2b9 Remove Debian bullseye jobs
The Debian bullseye has reached end-of-life, remove it from the CI.
2024-08-15 22:23:56 +02:00
Ondřej Surý
2a46396f29 For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
/opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.
2024-08-15 22:23:56 +02:00
Arаm Sаrgsyаn
ebd669a830 fix: dev: Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.

Closes #4842

Merge branch '4842-shutdown-crash-in-isc_log_doit' into 'main'

Closes #4842

See merge request isc-projects/bind9!9297
2024-08-15 12:55:28 +00:00
Aram Sargsyan
656e04f48a Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.
2024-08-15 12:54:37 +00:00
Arаm Sаrgsyаn
75021765f8 fix: dev: Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.

Closes #4841

Merge branch '4841-alignment-of-_Atomic-long-long-unsigned-int' into 'main'

Closes #4841

See merge request isc-projects/bind9!9319
2024-08-15 12:51:03 +00:00
Aram Sargsyan
867066aa53 Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.
2024-08-15 12:50:41 +00:00
Aydın Mercan
936975a9ae rem: do not include config.h
The build system ensures it is always included for every source file.

Merge branch 'aydin/no-include-config-h' into 'main'

See merge request isc-projects/bind9!9320
2024-08-15 12:12:15 +00:00
Aydın Mercan
b330eb0af8 do not include config.h
The build system ensures it is always included for every source file.
2024-08-15 12:11:48 +00:00
Ondřej Surý
5275b6bc83 chg: test: Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

Closes #4851

Merge branch '4851-generate-problematic-isc_hashmap-test-data' into 'main'

Closes #4851

See merge request isc-projects/bind9!9318
2024-08-15 11:56:49 +00:00
Ondřej Surý
2310c322c0 Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.
2024-08-15 10:05:32 +02:00
Ondřej Surý
43c81e2e24 fix: Change the placement of ctor/dtor attributes in the dst_api
Change the placement of the attributes to match the existing usage in
other places (after the declaration).

Merge branch 'ondrej/ISC_CONSTRUCTOR-style' into 'main'

See merge request isc-projects/bind9!9291
2024-08-14 16:21:08 +00:00