2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 00:55:24 +00:00
Commit Graph

37272 Commits

Author SHA1 Message Date
Matthijs Mekking
089fcfbcbd Merge branch 'matthijs-fix-intermittent-inline-system-test-failure' into 'main'
Fix intermittent inline system test failure

See merge request isc-projects/bind9!6708
2022-09-07 15:10:56 +00:00
Matthijs Mekking
8b71cbd09c Update inline system test, zone 'retransfer3.'
The zone 'retransfer3.' tests whether zones that 'rndc signing
-nsec3param' requests are queued even if the zone is not loaded.

The test assumes that if 'rndc signing -list' shows that the zone is
done signing with two keys, and there are no NSEC3 chains pending, the
zone is done handling the '-nsec3param' queued requests. However, it
is possible that the 'rndc signing -list' command is received before
the corresponding privatetype records are added to the zone (the records
that are used to retrieve the signing status with 'rndc signing').

This is what happens in test failure
https://gitlab.isc.org/isc-projects/bind9/-/jobs/2722752.

The 'rndc signing -list retransfer3' is thus an unreliable check.
It is simpler to just remove the check and wait for a certain amount
of time and check whether ns3 has re-signed the zone using NSEC3.
2022-09-07 16:24:14 +02:00
Michał Kępień
77f5341730 Merge branch '3508-fix-building-without-doh-support' into 'main'
Fix building without DoH support

Closes #3508

See merge request isc-projects/bind9!6737
2022-09-07 11:21:57 +00:00
Michał Kępień
4c49068531 Fix building with --disable-doh
Commit b69e783164 inadvertently caused
builds using the --disable-doh switch to fail, by putting the
declaration of the isc__nm_async_settlsctx() function inside an #ifdef
block that is only evaluated when DNS-over-HTTPS support is enabled.
This results in the following compilation errors being triggered:

    netmgr/netmgr.c:2657:1: error: no previous prototype for 'isc__nm_async_settlsctx' [-Werror=missing-prototypes]
     2657 | isc__nm_async_settlsctx(isc__networker_t *worker, isc__netievent_t *ev0) {
          | ^~~~~~~~~~~~~~~~~~~~~~~

Fix by making the declaration of the isc__nm_async_settlsctx() function
in lib/isc/netmgr/netmgr-int.h visible regardless of whether
DNS-over-HTTPS support is enabled or not.
2022-09-07 12:50:08 +02:00
Michał Kępień
d8644930b4 Test the --disable-doh switch in GitLab CI
Use the --disable-doh switch for all Ubuntu 22.04 builds in GitLab CI to
immediately flag any code changes that would break such builds.
2022-09-07 12:50:08 +02:00
Evan Hunt
7fec4505da Merge branch 'each-interface-magic' into 'main'
when creating an interface, set magic before linking

See merge request isc-projects/bind9!6735
2022-09-07 04:47:09 +00:00
Evan Hunt
8c01662048 when creating an interface, set magic before linking
set the magic number in a newly-created interface object
before appending it to mgr->interfaces in order to prevent
a possible assertion.
2022-09-06 17:12:14 -07:00
Mark Andrews
5267a25b17 Merge branch '3364-various-coverity-issues-after-dns_message_gettemp-cleanup' into 'main'
Resolve "Various Coverity issues after dns_message_gettemp* cleanup"

Closes #3364

See merge request isc-projects/bind9!6588
2022-09-06 15:25:39 +00:00
Mark Andrews
785d021d00 Remove dead code
*** CID 352817:  Control flow issues  (DEADCODE) /lib/ns/xfrout.c: 1568 in sendstream()
    1562
    1563     	/* Advance lasttsig to be the last TSIG generated */
    1564     	CHECK(dns_message_getquerytsig(msg, xfr->mctx, &xfr->lasttsig));
    1565
    1566     failure:
    1567     	if (msgname != NULL) {
    >>>     CID 352817:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "if (msgrds != NULL) {
      if ...".
    1568     		if (msgrds != NULL) {
    1569     			if (dns_rdataset_isassociated(msgrds)) {
    1570     				dns_rdataset_disassociate(msgrds);
    1571     			}
    1572     			dns_message_puttemprdataset(msg, &msgrds);
    1573     		}
2022-09-06 12:47:08 +00:00
Mark Andrews
5805457d9d Remove dead code
*** CID 352816:  Control flow issues  (DEADCODE) /lib/ns/query.c: 8443 in query_dns64()
    8437     cleanup:
    8438     	if (buffer != NULL) {
    8439     		isc_buffer_free(&buffer);
    8440     	}
    8441
    8442     	if (dns64_rdata != NULL) {
    >>>     CID 352816:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
    8443     		dns_message_puttemprdata(client->message, &dns64_rdata);
    8444     	}
    8445
    8446     	if (dns64_rdataset != NULL) {
    8447     		dns_message_puttemprdataset(client->message, &dns64_rdataset);
    8448     	}
2022-09-06 12:47:08 +00:00
Mark Andrews
3ef734e0f5 Remove dead code
*** CID 352812:  Control flow issues  (DEADCODE) /lib/ns/query.c: 8584 in query_filter64()
    8578     cleanup:
    8579     	if (buffer != NULL) {
    8580     		isc_buffer_free(&buffer);
    8581     	}
    8582
    8583     	if (myrdata != NULL) {
    >>>     CID 352812:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
    8584     		dns_message_puttemprdata(client->message, &myrdata);
    8585     	}
    8586
    8587     	if (myrdataset != NULL) {
    8588     		dns_message_puttemprdataset(client->message, &myrdataset);
    8589     	}
2022-09-06 12:47:08 +00:00
Mark Andrews
8e5a7e8bac Silence REVERSE_INULL
Remove unnecessary != NULL checks

    *** CID 352809:  Null pointer dereferences  (REVERSE_INULL) /lib/dns/message.c: 4654 in dns_message_buildopt()
    4648     	if (rdata != NULL) {
    4649     		dns_message_puttemprdata(message, &rdata);
    4650     	}
    4651     	if (rdataset != NULL) {
    4652     		dns_message_puttemprdataset(message, &rdataset);
    4653     	}
    >>>     CID 352809:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "rdatalist" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    4654     	if (rdatalist != NULL) {
    4655     		dns_message_puttemprdatalist(message, &rdatalist);
    4656     	}
    4657     	return (result);
    4658     }
    4659
2022-09-06 12:47:08 +00:00
Mark Andrews
24710beaff Remove dead code in xfrin.c
also removed unnecessary 'msg != NULL' check

   *** CID 352815:  Control flow issues  (DEADCODE) /lib/dns/xfrin.c: 1363 in xfrin_send_request()
   1357     	isc_nmhandle_attach(send_xfr->handle, &xfr->sendhandle);
   1358     	isc_refcount_increment0(&send_xfr->sends);
   1359     	isc_nm_send(xfr->handle, &region, xfrin_send_done, send_xfr);
   1360
   1361     failure:
   1362     	if (qname != NULL) {
   >>>     CID 352815:  Control flow issues  (DEADCODE)
   >>>     Execution cannot reach this statement: "dns_message_puttempname(msg...".
   1363     		dns_message_puttempname(msg, &qname);
   1364     	}
   1365     	if (qrdataset != NULL) {
   1366     		dns_message_puttemprdataset(msg, &qrdataset);
   1367     	}
   1368     	if (msg != NULL) {

   *** CID 352819:  Control flow issues  (DEADCODE) /lib/dns/xfrin.c: 1366 in xfrin_send_request()
   1360
   1361     failure:
   1362     	if (qname != NULL) {
   1363     		dns_message_puttempname(msg, &qname);
   1364     	}
   1365     	if (qrdataset != NULL) {
   >>>     CID 352819:  Control flow issues  (DEADCODE)
   >>>     Execution cannot reach this statement: "dns_message_puttemprdataset...".
   1366     		dns_message_puttemprdataset(msg, &qrdataset);
   1367     	}
   1368     	if (msg != NULL) {
   1369     		dns_message_detach(&msg);
   1370     	}
   1371     	if (soatuple != NULL) {
2022-09-06 12:47:08 +00:00
Arаm Sаrgsyаn
4dc37589c4 Merge branch '3518-libxml2-deprecated-functions' into 'main'
Do not use libxml2 deprecated functions

Closes #3518

See merge request isc-projects/bind9!6727
2022-09-06 09:42:01 +00:00
Aram Sargsyan
87920661b1 Add CHANGES note for [GL #3518] 2022-09-06 08:55:07 +00:00
Aram Sargsyan
a5d412d924 Do not use libxml2 deprecated functions
The usage of xmlInitThreads() and xmlCleanupThreads() functions in
libxml2 is now marked as deprecated, and these functions will be made
private in the future.

Use xmlInitParser() and xmlCleanupParser() instead of them.
2022-09-06 08:55:07 +00:00
Arаm Sаrgsyаn
6c0560f014 Merge branch 'aram/isc_nm_listentlsdns-error-path-bugfix' into 'main'
Fix isc_nm_listentlsdns() error path bug

See merge request isc-projects/bind9!6728
2022-09-06 08:25:39 +00:00
Aram Sargsyan
2f11e48f0d Fix isc_nm_listentlsdns() error path bug
The isc_nm_listentlsdns() function erroneously calls
isc__nm_tcpdns_stoplistening() instead of isc__nm_tlsdns_stoplistening()
when something goes wrong, which can cause an assertion failure.
2022-09-05 14:58:52 +00:00
Ondřej Surý
7067f30510 Merge branch '3485-dig-fallback-to-idna2003' into 'main'
Allow fallback to IDNA2003 processing

Closes #3485

See merge request isc-projects/bind9!6699
2022-09-05 08:36:48 +00:00
Ondřej Surý
0fe7acb4e6 Add CHANGES and release note for [GL #3485] 2022-09-05 10:35:09 +02:00
Ondřej Surý
87de726f5c Enable the IDNA2003 domain names in the idna system test
Allow the IDNA2003 tests to succeed after the fallback to IDNA2003 was
implemented.
2022-09-05 10:34:49 +02:00
Ondřej Surý
10923f9d87 Allow fallback to IDNA2003 processing
In several cases where IDNA2008 mappings do not exist whereas IDNA2003
mappings do, dig was failing to process the suplied domain name.  Take a
backwards compatible approach, and convert the domain to IDNA2008 form,
and if that fails try the IDNA2003 conversion.
2022-09-05 10:34:49 +02:00
Arаm Sаrgsyаn
b5d5c383a7 Merge branch '3515-mctx-attach-detach-for-isc_mempool_t' into 'main'
Add mctx attach/detach when creating/destroying a memory pool

Closes #3515

See merge request isc-projects/bind9!6712
2022-09-02 09:02:38 +00:00
Aram Sargsyan
362ead8d85 Add CHANGES note for [GL #3515] 2022-09-02 08:16:44 +00:00
Aram Sargsyan
e97c3eea95 Add mctx attach/detach when creating/destroying a memory pool
This should make sure that the memory context is not destroyed
before the memory pool, which is using the context.
2022-09-02 08:16:17 +00:00
Arаm Sаrgsyаn
774a0277a0 Merge branch '3514-cid-356328-deadcode-in-server.c' into 'main'
Resolve "CID 356328: Control flow issues (DEADCODE) in bin/named/server.c"

Closes #3514

See merge request isc-projects/bind9!6713
2022-09-02 08:14:46 +00:00
Aram Sargsyan
7ce1f3d872 Use the return value of isc_portset_create()
There is an omission of assigning the return value coming from the
isc_portset_create() function to the result variable.

CID 356328:

    /bin/named/server.c: 8756 in load_configuration()
    8750     			      "creating UDP/IPv4 port set: %s",
    8751     			      isc_result_totext(result));
    8752     		goto cleanup_bindkeys_parser;
    8753     	}
    8754     	isc_portset_create(named_g_mctx, &v6portset);
    8755     	if (result != ISC_R_SUCCESS) {
    >>>     CID 356328:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "isc_log_write(named_g_lctx,...".
    8756     		isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
    8757     			      NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
    8758     			      "creating UDP/IPv6 port set: %s",
    8759     			      isc_result_totext(result));
    8760     		goto cleanup_v4portset;
    8761     	}
2022-09-02 07:40:27 +00:00
Evan Hunt
4bc0db5ed2 Merge branch '3511-quote-yaml-addresses' into 'main'
quote addresses in YAML output

Closes #3511

See merge request isc-projects/bind9!6702
2022-08-31 23:16:32 +00:00
Evan Hunt
f72bf1375a CHANGES for [GL #3511] 2022-08-31 15:32:37 -07:00
Evan Hunt
66eaf6bb73 quote addresses in YAML output
YAML strings should be quoted if they contain colon characters.
Since IPv6 addresses do, we now quote the query_address and
response_address strings in all YAML output.
2022-08-31 15:32:24 -07:00
Evan Hunt
aba940dd90 Merge branch '3501-dnstap-response' into 'main'
dnstap query_message field was erroneously set with responses

Closes #3501

See merge request isc-projects/bind9!6701
2022-08-31 22:22:44 +00:00
Evan Hunt
fea9751f13 CHANGES for [GL #3501] 2022-08-31 11:33:54 -07:00
Evan Hunt
3ccfff8ab6 dnstap query_message field was erroneously set with responses
The dnstap query_message field was in some cases being filled in
with response messages, along with the response_message field.
The query_message field should only be used when logging requests,
and the response_message field only when logging responses.
2022-08-31 11:33:25 -07:00
Arаm Sаrgsyаn
692975746f Merge branch '3410-rpz-extended-errors' into 'main'
RPZ Extended DNS Error Codes

Closes #3410

See merge request isc-projects/bind9!6700
2022-08-31 09:21:11 +00:00
Aram Sargsyan
0f9d645582 Add CHANGES note for [GL #3410] 2022-08-31 08:56:03 +00:00
Aram Sargsyan
7eda1aba76 Document RPZ Extended DNS Error (EDE) code configuration option
Add information about the 'ede' option for response policy zones.
2022-08-31 08:56:03 +00:00
Aram Sargsyan
5e4e303ffa Add system tests for RPZ EDE codes
Check the new configuration option's syntax using the 'checkconf' system
test.

Check if the new option works by parsing DiG's output in the 'rpz'
system test.
2022-08-31 08:56:03 +00:00
Aram Sargsyan
83395f4cfb Set the extended DNS error code for RPZ-modified queries
When enabled through a configuration option, set the configured EDE code
for the modified queries.
2022-08-31 08:56:03 +00:00
Aram Sargsyan
77f12ecba7 Add extended DNS error configuration option for RPZ zones
Implement the configuration option with its checking and parsing parts.

The option should be later used by BIND to set an extended error
code (EDE) for the queries modified in the result of RPZ processing.
2022-08-31 08:56:03 +00:00
Arаm Sаrgsyаn
77024e6ad6 Merge branch 'aram/rpz-doc-update' into 'main'
Update RPZ documentation in ARM

See merge request isc-projects/bind9!6705
2022-08-31 08:52:35 +00:00
Aram Sargsyan
0fbd07ac22 Update RPZ documentation
The RPZ documentation section with response policy rules and actions
is incomplete.

Add information about the 'RPZ-CLIENT-IP' rule, and 'TCP-Only' and
'DROP' actions.
2022-08-29 14:04:03 +00:00
Ondřej Surý
7bf8a7ab1b Merge branch 'ondrej-add-isc-loopmgr' into 'main'
Separate the event loop handling into a separate layer

Closes #3508

See merge request isc-projects/bind9!6040
2022-08-26 08:08:42 +00:00
Evan Hunt
92526facb1 CHANGES and release note for [GL #3508] 2022-08-26 09:09:25 +02:00
Ondřej Surý
718e92c31a Clear the callbacks when isc_nm_stoplistening() is called
When we are closing the listening sockets, there's a time window in
which the TCP connection could be accepted although the respective
stoplistening function has already returned to control to the caller.
Clear the accept callback function early, so it doesn't get called when
we are not interested in the incoming connections anymore.
2022-08-26 09:09:25 +02:00
Ondřej Surý
4d07768a09 Remove the isc_app API
The isc_app API is no longer used and has been removed.
2022-08-26 09:09:25 +02:00
Ondřej Surý
37a1be5acc Split netmgr_test into separate per-transport unit tests
The netmgr_test unit test has been subdivided into tcp_test,
tcpdns_test, tls_test, tlsdns_test, and udp_test components.
These have been updated to use the new loopmgr.
2022-08-26 09:09:25 +02:00
Ondřej Surý
b69e783164 Update netmgr, tasks, and applications to use isc_loopmgr
Previously:

* applications were using isc_app as the base unit for running the
  application and signal handling.

* networking was handled in the netmgr layer, which would start a
  number of threads, each with a uv_loop event loop.

* task/event handling was done in the isc_task unit, which used
  netmgr event loops to run the isc_event calls.

In this refactoring:

* the network manager now uses isc_loop instead of maintaining its
  own worker threads and event loops.

* the taskmgr that manages isc_task instances now also uses isc_loopmgr,
  and every isc_task runs on a specific isc_loop bound to the specific
  thread.

* applications have been updated as necessary to use the new API.

* new ISC_LOOP_TEST macros have been added to enable unit tests to
  run isc_loop event loops. unit tests have been updated to use this
  where needed.
2022-08-26 09:09:24 +02:00
Ondřej Surý
49b149f5fd Update isc_timer to use isc_loopmgr
* isc_timer was rewritten using the uv_timer, and isc_timermgr_t was
  completely removed; isc_timer objects are now directly created on the
  isc_loop event loops.

* the isc_timer API has been simplified. the "inactive" timer type has
  been removed; timers are now stopped by calling isc_timer_stop()
  instead of resetting to inactive.

* isc_manager now creates a loop manager rather than a timer manager.

* modules and applications using isc_timer have been updated to use the
  new API.
2022-08-25 17:17:07 +02:00
Ondřej Surý
84c90e223f New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.

* isc_app will be replaced with isc_loopmgr, which handles the
  starting and stopping of applications. In isc_loopmgr, the main
  thread is not blocked, but is part of the working thread set.
  The loop manager will start a number of threads, each with a
  uv_loop event loop running. Setup and teardown functions can be
  assigned which will run when the loop starts and stops, and
  jobs can be scheduled to run in the meantime. When
  isc_loopmgr_shutdown() is run from any the loops, all loops
  will shut down and the application can terminate.

* signal handling will now be handled with a separate isc_signal unit.
  isc_loopmgr only handles SIGTERM and SIGINT for application
  termination, but the application may install additional signal
  handlers, such as SIGHUP as a signal to reload configuration.

* new job running primitives, isc_job and isc_async, have been added.
  Both units schedule callbacks (specifying a callback function and
  argument) on an event loop. The difference is that isc_job unit is
  unlocked and not thread-safe, so it can be used to efficiently
  run jobs in the same thread, while isc_async is thread-safe and
  uses locking, so it can be used to pass jobs from one thread to
  another.

* isc_tid will be used to track the thread ID in isc_loop worker
  threads.

* unit tests have been added for the new APIs.
2022-08-25 12:24:29 +02:00
Ondřej Surý
a26862e653 Simplify the isc_event API
The ev_tag field was never used, and has now been removed.
2022-08-25 12:24:25 +02:00