2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

42510 Commits

Author SHA1 Message Date
Nicki Křížek
1cc628362b [9.20] new: ci: Allow pushing branches and tags to customer git repos
For pipelines in the private repository, add an optional manual job,
which allows the current branch to be pushed into the specified
customer's git repository. This can be useful to provide patch previews
for early testing.

For tags created in a private repository, add a manual job which pushes
the created tag to all entitled customers.

Backport of MR !10323

Merge branch 'backport-nicki/ci-customer-git-automation-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10356
2025-04-02 11:12:56 +00:00
Nicki Křížek
5bbc38aa30 Allow pushing branches and tags to customer git repos
For pipelines in the private repository, add an optional manual job,
which allows the current branch to be pushed into the specified
customer's git repository. This can be useful to provide patch previews
for early testing.

For tags created in a private repository, add a manual job which pushes
the created tag to all entitled customers.

(cherry picked from commit 378b412e94)
2025-04-02 11:04:16 +00:00
Arаm Sаrgsyаn
f6ed3b1ce4 [9.20] chg: nil: Suppress FreeBSD-specific TSAN false-positive data race
TSAN reports a data race in FreeBSD's memset(), called by its
__crt_calloc() memory allocation function. There is a very similar
bug report [1] in FreeBSD bug tracker, and an existing code-review [2]
that tries to address an issue, the description of which is very
similar to what we are seeing.

Suppress this report by adding its signature to '.tsan-suppress'.

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282794

[2] https://reviews.freebsd.org/D28536?id=86694

Closes #5267

Backport of MR !10353

Merge branch 'backport-5267-freebsd-suppress-tsan-data-race-false-positive-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10354
2025-04-02 09:47:49 +00:00
Aram Sargsyan
47fdbf15f3 Suppress FreeBSD-specific TSAN false-positive data race
TSAN reports a data race in FreeBSD's memset(), called by its
__crt_calloc() memory allocation function. There is a very similar
bug report [1] in FreeBSD bug tracker, and an existing code-review [2]
that tries to address an issue, the description of which is very
similar to what we are seeing.

Suppress this report by adding its signature to '.tsan-suppress'.

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282794
[2] https://reviews.freebsd.org/D28536?id=86694

(cherry picked from commit 40a91f51d7)
2025-04-02 08:38:02 +00:00
Artem Boldariev
92eb6416e5 [9.20] chg: dev: Carefully check if the server name used for SNI is a hostname
Previously the code would not check if the string intended to be used
for SNI is a hostname.

See also: !9923

Closes #5225

Backport of MR !10254

Merge branch 'backport-5225-dig-sni-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10347
2025-03-31 12:42:51 +00:00
Artem Boldariev
8459d99ec2 Dispatch: carefully check if the server name for SNI is a hostname
Previously the code would not check if the string intended to be used
for SNI is a hostname.

(cherry picked from commit 2592e309c7)
2025-03-31 15:07:55 +03:00
Artem Boldariev
d6c92d3f07 Dig: carefully check if the server name for SNI is a hostname
Previously the code would not check if the string intended to be used
for SNI is a hostname.

(cherry picked from commit 16a306687a)
2025-03-31 15:07:33 +03:00
Artem Boldariev
634625be07 Add isc_tls_valid_sni_hostname()
Add a function that checks if a 'hostname' is not a valid IPv4 or IPv6
address. Returns 'true' if the hostname is likely a domain name, and
'false' if it represents an IP address.

(cherry picked from commit 1f199ee606)
2025-03-31 15:06:59 +03:00
Colin Vidal
d05f4b4b9b [9.20] fix: test: fix out-of-tree mem_test
Previously changed mem_test (!10320) introduces a test which checks for
the value of `__FILE__`, which is different if the build is done
out-of-tree or not, even though this is not relevant for the test (only
the base filename is). This result in a broken test for out-of-tree
builds. Fix this by changing the way the "grep" is done in the test,
ignoring the optional path prefix in the filename.

Backport of MR !10343

Merge branch 'backport-colin-fix-outoftree-memtest-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10344
2025-03-28 15:30:06 +00:00
Colin Vidal
30a5031c8c fix out-of-tree mem_test
Previously changed mem_test (!10320) introduces a test which checks for
the value of `__FILE__`, which is different if the build is done
out-of-tree or not, even though this is not relevant for the test (only
the base filename is). This result in a broken test for out-of-tree
builds. Fix this by changing the way the "grep" is done in the test,
ignoring the optional path prefix in the filename.

(cherry picked from commit b7ae514b3b)
2025-03-28 14:55:15 +00:00
Colin Vidal
59635e33d0 [9.20] fix: dev: copy __FILE__ when allocating memory
When allocating memory under -m trace|record, the __FILE__ pointer is
stored, so it can be printed out later in order to figure out in which
file an allocation leaked. (among others, like the line number).

However named crashes when called with -m record and using a plugin
leaking memory. The reason is that plugins are unloaded earlier than
when the leaked allocations are dumped (obviously, as it's done as late
as possible). In such circumstances, `__FILE__` is dangling because the
dynamically loaded library (the plugin) is not in memory anymore.

Fix the crash by systematically copying the `__FILE__` string
instead of copying the pointer. Of course, this make each allocation to
consume a bit more memory (and longer, as it needs to calculate the
length of `__FILE__`) but this occurs only under -m trace|record debugging
flags.

Backport of MR !10320

Merge branch 'backport-colin-memdump-plugins-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10336
2025-03-27 15:49:17 +00:00
Colin Vidal
c1352b79ca copy __FILE__ when allocating memory
When allocating memory under -m trace|record, the __FILE__ pointer is
stored, so it can be printed out later in order to figure out in which
file an allocation leaked. (among others, like the line number).

However named crashes when called with -m record and using a plugin
leaking memory. The reason is that plugins are unloaded earlier than
when the leaked allocations are dumped (obviously, as it's done as late
as possible). In such circumstances, __FILE__ is dangling because the
dynamically loaded library (the plugin) is not in memory anymore.

Fix the crash by systematically copying the __FILE__ string
instead of copying the pointer. Of course, this make each allocation to
consume a bit more memory (and longer, as it needs to calculate the
length of __FILE__) but this occurs only under -m trace|record debugging
flags.

In term of unit test, because grepping in C is not fun, and because the
whole "syntax" of the dump output is tested in other tests, this simply
search for a substring in the whole buffer to make sure the expected
allocations are found.

(cherry picked from commit 4eb2cd364a)
2025-03-27 14:21:00 +01:00
Arаm Sаrgsyаn
7c4603fc4a [9.20] new: usr: Add an rndc command to reset some statistics counters
The new ``reset-stats`` command for ``rndc`` allows some statistics
counters to be reset during runtime. At the moment only two "high-water"
counters are supported, so the ability to reset them after the
initial peaks during the server's "warm-up" phase may be useful for
some operators.

Closes #5251

Backport of MR !10318

Merge branch 'backport-5251-feature-rndc-reset-high-water-statistics-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10335
2025-03-27 10:18:37 +00:00
Aram Sargsyan
06b86773f4 Document rndc reset-stats
Add documentation for 'rndc reset-stats'.

(cherry picked from commit be8f4f68cb)
2025-03-27 09:36:44 +00:00
Aram Sargsyan
56c9bda62c Test rndc reset-stats counter-name
A a check to test if 'rndc reset-stats' works as expected.

(cherry picked from commit c917b9af38)
2025-03-27 09:36:44 +00:00
Aram Sargsyan
110823b149 Implement rndc reset-stats counter-name
This new rndc option allows to reset some statistics counters during
runtime. At this moment only the high-water type counters are supported
as such an ability to reset them after the initial peaks during the
server's "warm-up" phase can be useful for some operators.

(cherry picked from commit bab20802b3)
2025-03-27 09:36:43 +00:00
Colin Vidal
7fd60a5f5d [9.20] new: test: IPv6 case to isc_netaddr_masktoprefixlen tests
Unit test for isc_netaddr_masktoprefixlen were missing IPv6 mask cases.
Add those and few other IPv4 cases. Also, the test is refactored in
order to make it easy to add new cases.

Backport of MR !10328

Merge branch 'backport-colin-netaddrmasktest-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10332
2025-03-26 16:43:23 +00:00
Colin Vidal
ad3e09a6af IPv6 case to isc_netaddr_masktoprefixlen tests
Unit test for isc_netaddr_masktoprefixlen were missing IPv6 mask cases.
Add those and few other IPv4 cases. Also, the test is refactored in
order to make it easy to add new cases.

(cherry picked from commit ad2c3fa4f7)
2025-03-26 13:30:46 +00:00
Michal Nowak
f1c091b445 [9.20] fix: test: Silence warning initialising compressed
The string literal initialalising compressed was too big for the 
array as it has an unwanted NUL terminator.  This is allowed for 
in C for historical reasons but produces a warning with some
compilers.  Adjust the declaration to include the NUL and adjust
the users to pass in an adjusted size which excludes the NUL rather
than sizeof(compressed).

Closes #5258

Backport of MR !10326

Merge branch 'backport-5258-avoid-warning-initialising-compresss-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10331
2025-03-26 13:18:42 +00:00
Mark Andrews
6d2bd55794 Silence warning when initialising compress
The string literal initialalising compressed was too big for the
array as it has an unwanted NUL terminator.  This is allowed for
in C for historical reasons but produces a warning with some
compilers.  Adjust the declaration to include the NUL and adjust
the users to pass in an adjusted size which excludes the NUL rather
than sizeof(compressed).

(cherry picked from commit 6a6b6be824)
2025-03-26 12:43:55 +00:00
Ondřej Surý
b0c6af6ad7 [9.20] fix: dev: Validating ADB fetches could cause a crash in import_rdataset()
Previously, in some cases, the resolver could return rdatasets of type CNAME or DNAME without the result code being set to `DNS_R_CNAME` or `DNS_R_DNAME`. This could trigger an assertion failure in the ADB. The resolver error has been fixed.

Closes #5201

Backport of MR !10172

Backport of MR !10178

Merge branch 'backport-5201-adb-cname-error-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10329
2025-03-26 12:09:11 +00:00
Evan Hunt
3dd7691650 fix the fetchresponse result for CNAME/DNAME
the fix in commit 1edbbc32b4 was incomplete; the wrong
event result could also be set in cache_name() and validated().

(cherry picked from commit 9ebeb60174)
2025-03-26 11:59:48 +01:00
Evan Hunt
8f84f8293a set eresult based on the type in ncache_adderesult()
when the caching of a negative record failed because of the
presence of a positive one, ncache_adderesult() could override
this to ISC_R_SUCCESS. this could cause CNAME and DNAME responses
to be handled incorrectly.  ncache_adderesult() now sets the result
code correctly in such cases.

(cherry picked from commit 1edbbc32b4)
2025-03-26 11:59:37 +01:00
Michal Nowak
466186b8ab [9.20] fix: test: Limit X-Bloat header size to 100KB
Otherwise curl 8.13 rejects the line with:

    I:Check HTTP/1.1 keep-alive with truncated stream (21)
    curl: option --header: error encountered when reading a file
    curl: try 'curl --help' or 'curl --manual' for more information

Also, see https://github.com/curl/curl/pull/16572.

Closes #5249

Backport of MR !10319

Merge branch 'backport-5249-statschannel-limit-http-header-size-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10321
2025-03-25 16:39:29 +00:00
Michal Nowak
a8a59d5c63 Limit X-Bloat header size to 100KB
Otherwise curl 8.13 rejects the line with:

    I:Check HTTP/1.1 keep-alive with truncated stream (21)
    curl: option --header: error encountered when reading a file
    curl: try 'curl --help' or 'curl --manual' for more information

Also, see https://github.com/curl/curl/pull/16572.

(cherry picked from commit bcb931f4a8)
2025-03-25 15:53:24 +00:00
Ondřej Surý
9986dad2dc fix: usr: [9.20] Wait for memory reclamation to finish in named-checkconf
Previously, when named-checkzone loaded the zone to the QP database, the delayed
memory reclamation could cause an assertion check on exit. This has
been fixed.

Closes #5220

Merge branch '5220-add-rcu-barrier-to-named-checkconf-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10307
2025-03-25 10:00:46 +00:00
Ondřej Surý
4b4eb29452 Wait for memory reclamation to finish in named-checkconf
When named-checkzone loads the zone to the QP database, the delayed
memory reclamation could cause an assertion check on exit.  Add RCU
barrier to wait for the memory reclamation to complete.
2025-03-25 11:00:00 +01:00
Ondřej Surý
4297ae4795 [9.20] fix: dev: Fix invalid cache-line padding for qpcache buckets
The isc_queue_t was missing in the calculation of the required
padding size inside the qpcache bucket structure.

Backport of MR !10306

Merge branch 'backport-ondrej/qpcache-fix-invalid-padding-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10317
2025-03-25 09:59:33 +00:00
Ondřej Surý
817a0a8e8e Fix invalid cache-line padding for qpcache buckets
The isc_queue_t was missing in the calculation of the required
padding size inside the qpcache bucket structure.

(cherry picked from commit 3ef9b09620)
2025-03-25 09:59:02 +00:00
Evan Hunt
5d126d8081 [9.20] fix: usr: Don't enforce NOAUTH/NOCONF flags in DNSKEYs
All DNSKEY keys are able to authenticate. The `DNS_KEYTYPE_NOAUTH` (and `DNS_KEYTYPE_NOCONF`) flags were defined for the KEY rdata type, and are not applicable to DNSKEY. Previously, however, because the DNSKEY implementation was built on top of KEY, the `_NOAUTH` flag prevented authentication in DNSKEYs as well. This has been corrected.

Closes #5240

Backport of MR !10261

Merge branch 'backport-5240-ignore-noauth-flag-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10315
2025-03-25 07:23:26 +00:00
Mark Andrews
4a1ebbedad DNS_KEYTYPE_NOKEY is only applicable to KEY
(cherry picked from commit 53c6721abc)
2025-03-24 23:52:02 -07:00
Evan Hunt
080299bf49 Don't check DNS_KEYFLAG_NOAUTH
All DNSKEY keys are able to authenticate. The DNS_KEYTYPE_NOAUTH
(and DNS_KEYTYPE_NOCONF) flags were defined for the KEY rdata type,
and are not applicable to DNSKEY.

Previously, because the DNSKEY implementation was built on top of
KEY, the NOAUTH flag prevented authentication in DNSKEYs as well.
This has been corrected.

(cherry picked from commit 5c21576f82)
2025-03-24 23:52:02 -07:00
Evan Hunt
dc1ddd3e8a Tidy up keyvalue.h definitions
Use enums for DNS_KEYFLAG_, DNS_KEYTYPE_, DNS_KEYOWNER_, DNS_KEYALG_,
and DNS_KEYPROTO_ values.

Remove values that are never used.

Eliminate the obsolete DNS_KEYFLAG_SIGNATORYMASK. Instead, add three
more RESERVED bits for the key flag values that it covered but which
were never used.

(cherry picked from commit fee1ba40df)
2025-03-25 06:40:49 +00:00
Evan Hunt
42ab4fce4a [9.20] rem: dev: Remove dns_qpmulti_lockedread declaration
This function was removed in 6217e434b5 but not from the header file.

Backport of MR !10308

Merge branch 'backport-matthijs-remove-unused-qpmulti-lockedread-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10314
2025-03-25 06:37:14 +00:00
Matthijs Mekking
c0e92c6df9 Remove dns_qpmulti_lockedread declaration
This function was removed in 6217e434b5
but not from the header file.

(cherry picked from commit 2c52aea3dc)
2025-03-25 06:02:17 +00:00
Michał Kępień
de2f0de267 [9.20] chg: test: Use isctest.asyncserver in the "upforwd" test
Replace the custom DNS server used in the "upforwd" system test with new
code based on the isctest.asyncserver module.  The ans4 server currently
used in that test is a copy of bin/tests/system/ans.pl modified to
receive queries over UDP and TCP without ever responding to any of them.

Closes #5012

Backport of MR !10283

Merge branch 'backport-5012-upforwd-asyncserver-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10312
2025-03-25 04:46:58 +00:00
Michał Kępień
785e6bc9d9 Use isctest.asyncserver in the "upforwd" test
Replace the custom DNS server used in the "upforwd" system test with new
code based on the isctest.asyncserver module.  The ans4 server currently
used in that test is a copy of bin/tests/system/ans.pl modified to
receive queries over UDP and TCP without ever responding to any of them.

(cherry picked from commit a8878cf35d)
2025-03-25 04:08:28 +00:00
Michał Kępień
d4a59f9cd3 Add a response handler for ignoring all queries
Dropping all incoming queries is a typical use case for a custom server
used in BIND 9 system tests.  Add a response handler implementing that
behavior so that it can be reused.

(cherry picked from commit f24a534ff1)
2025-03-25 04:08:28 +00:00
Michał Kępień
03756c8e05 Make response handlers global by default
Instead of requiring each class inheriting from ResponseHandler to
define its match() method, make the latter non-abstract and default to
returning True for all queries.  This will reduce the amount of
boilerplate code in custom servers.

(cherry picked from commit 75567f86ca)
2025-03-25 04:08:28 +00:00
Mark Andrews
7ebcc54d3b [9.20] fix: dev: Fix adbname reference
Call `dns_adbname_ref` before calling `dns_resolver_createfetch` to
ensure `adbname->name` remains stable for the life of the fetch.

Closes #5239

Backport of MR !10290

Merge branch 'backport-5239-fix-adb-reference-counting-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10303
2025-03-21 01:19:41 +00:00
Mark Andrews
db113bc5ad Fix gaining adbname reference
Call dns_adbname_ref before calling dns_resolver_createfetch to
ensure adbname->name remains stable for the life of the fetch.

(cherry picked from commit 8e7229f641)
2025-03-21 00:29:45 +00:00
Matthijs Mekking
3a78a4c288 [9.20] fix: usr: Fix several small DNSSEC timing issues
The following small issues related to `dnssec-policy` have been fixed:
- In some cases the key manager inside BIND 9 could run every hour, while it could have run less often.
- While `CDS` and `CDNSKEY` records will be removed correctly from the zone when the corresponding `DS` record needs to be updated, the expected timing metadata when this will happen was never set.
- There were a couple of cases where the safety intervals are added inappropriately, delaying key rollovers longer than necessary.
- If you have identical `keys` in your `dnssec-policy`, they may be retired inappropriately. Note that having keys with identical properties is discouraged in all cases.

Closes #5242

Backport of MR !10251

Merge branch 'backport-5242-several-keymgr-issues-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10301
2025-03-20 13:57:51 +00:00
Matthijs Mekking
5cb7c19c23 Update Retired and Removed if we update lifetime
If we are updating the lifetime, and it was not set before, also
set/update the Retired and Removed timing metadata.

(cherry picked from commit 3e836a87e6)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
4be38b606a Fix a key generation issue in the tests
The dnssec-keygen command for the ZSK generation for the zone
multisigner-model2.kasp was wrong (no ZSK was generated in the setup
script, but when 'named' is started, the missing ZSK was created
anyway by 'dnssec-policy'.

(cherry picked from commit b93cb2e80e)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
3de8fa8709 Fix keymgr bug wrt setting the next time
Only set the next time the keymgr should run if the value is non zero.
Otherwise we default back to one hour. This may happen if there is one
or more key with an unlimited lifetime.

(cherry picked from commit 6c6b8796d3)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
ac8efcbf14 keymgr: also set DeleteCDS when setting PublishCDS
The keymgr never set the expected timing metadata when CDS/CDNSKEY
records for the corresponding key will be removed from the zone. This
is not troublesome, as key states dictate when this happens, but with
the new pytest we use the timing metadata to determine if the CDS and/or
CDNSKEY for the given key needs to be published.

(cherry picked from commit 8c9d2eb2bf)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
04054bcb9a Fix wrong usage of safety intervals in keymgr
There are a couple of cases where the safety intervals are added
inappropriately:

1. When setting the PublishCDS/SyncPublish timing metadata, we don't
   need to add the publish-safety value if we are calculating the time
   when the zone is completely signed for the first time. This value
   is for when the DNSKEY has been published and we add a safety
   interval before considering the DNSKEY omnipresent.

2. The retire-safety value should only be added to ZSK rollovers if
   there is an actual rollover happening, similar to adding the sign
   delay.

3. The retire-safety value should only be added to KSK rollovers if
   there is an actual rollover happening. We consider the new DS
   omnipresent a bit later, so that we are forced to keep the old DS
   a bit longer.

(cherry picked from commit 63edc4435f)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
147ab68dc1 Fix a small keymgr bug
While converting the kasp system test to pytest, I encountered a small
bug in the keymgr code. We retire keys when there is more than one
key matching a 'keys' line from the dnssec-policy. But if there are
multiple identical 'keys' lines, as is the case for the test zone
'checkds-doubleksk.kasp', we retire one of the two keys that have the
same properties.

Fix this by checking if there are double matches. This is not fool proof
because there may be many keys for a few identical 'keys' lines, but it
is good enough for now. In practice it makes no sense to have a policy
that dictates multiple keys with identical properties.

(cherry picked from commit ef671919d5)
2025-03-20 13:57:45 +00:00
Matthijs Mekking
8f78219cc1 [9.20] fix: usr: Ensure max-clients-per-query is at least clients-per-query
If the `max-clients-per-query` option is set to a lower value than `clients-per-query`, the value is adjusted to match `clients-per-query`.

Closes #5224

Backport of MR !10241

Merge branch 'backport-5224-raise-max-clients-per-query-to-be-at-least-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10244
2025-03-20 13:57:03 +00:00
Matthijs Mekking
c5b8e1f5a1 Raise max-clients-per-query to be at least
In the case where 'clients-per-query' is larger than
'max-clients-per-query', raise 'max-clients-per-query' so that
'clients-per-query' equals 'max-clients-per-query' and log a warning
that this is what happened.

(cherry picked from commit f6f9645ed1)
2025-03-20 09:08:25 +00:00