Compare commits

...
392 Commits
Author SHA1 Message Date
Evan Hunt a768277b24 fixup! checkpoint: convert dig/host/nslookup to use the netmgr 2020-09-06 21:01:05 -07:00
Evan Hunt 4bd14084ea fixup! add netmgr functions to support outgoing DNS queries 2020-09-06 18:34:42 -07:00
Evan Hunt 23106798be fixup! checkpoint: convert dig/host/nslookup to use the netmgr 2020-09-06 18:34:25 -07:00
Evan Hunt ad902a0f09 fixup! checkpoint: convert dig/host/nslookup to use the netmgr 2020-09-06 17:29:21 -07:00
Evan Hunt ef33c28c0a fixup! checkpoint: convert dig/host/nslookup to use the netmgr 2020-09-06 17:14:43 -07:00
Evan Hunt 87ba699f4f fixup! checkpoint: convert dig/host/nslookup to use the netmgr 2020-09-06 14:39:11 -07:00
Evan Hunt 9c7683872b fixup! add netmgr functions to support outgoing DNS queries 2020-09-06 14:39:00 -07:00
Evan Hunt 3c12b263e3 checkpoint: convert dig/host/nslookup to use the netmgr
(only partially working at this point; basic queries over UDP
and TCP do work now but edge and error cases may fail.)
2020-09-06 00:45:05 -07:00
Evan Hunt 31192119d7 shim code for UDP connect in older libuv versions
uv_udp_connect() was added in libuv 1.27; we need a method of
connecting UDP sockets for older versions.
2020-09-06 00:45:05 -07:00
Evan Hunt a832204ec9 add netmgr functions to support outgoing DNS queries
- isc_nm_tcpdnsconnect() sets up up an outgoing TCP DNS connection
- isc_nm_udpconnect() sets up a connected UDP socket
- isc_nm_read() now supports UDP; it reads a single datagram and then
  stops until the next time it's called.

these functions will later be used to support outgoing queries in dig,
dispatch, etc.
2020-09-06 00:45:05 -07:00
Evan Hunt 343c10f964 fix LD_WRAP tests
I noticed that query_test and notify_test still had references to
isc_nmhandle_unref(), which hadn't been causing problems because they
weren't being run. this appears to be due to a logic reversal in
configure; the test program returns 0 if -Wl,--wrap is not supported.
after fixing this the unit tests needed to be cleaned up in order to
pass.
2020-09-05 12:24:42 -07:00
Evan Hunt 04ef1f730e work around perl error
some versions of perl failed to run packet.pl because the 'last'
keyword can't be used outside of a loop block. this commit changes
the packet dumping code to a function so we can use 'return' instead.
2020-09-05 00:24:10 -07:00
Evan Hunt 5866c4a3be fixup! change from isc_nmhandle_ref/unref to isc_nmhandle attach/detach 2020-09-04 23:43:38 -07:00
Evan Hunt feddbcce10 fixup! assorted small netmgr-related changes 2020-09-04 23:27:51 -07:00
Evan Hunt d427a20056 fixup! change from isc_nmhandle_ref/unref to isc_nmhandle attach/detach 2020-09-04 22:55:30 -07:00
Evan Hunt 6a6dd6ff0a fixup! change from isc_nmhandle_ref/unref to isc_nmhandle attach/detach 2020-09-04 14:53:20 -07:00
Evan Hunt f7f068dc64 CHANGES 2020-09-04 14:25:15 -07:00
Witold KręcickiandEvan Hunt 26c28bd7b5 tracing of active sockets and handles
If NETMGR_TRACE is defined, we now maintain a list of active
sockets in the netmgr object and a list of active handles in
each socket object; by walking the list and printing `backtrace`
in a debugger we can see where they were created. This will assist
in debugging reference counting errors.
2020-09-04 14:25:15 -07:00
Evan Hunt fb852e1d31 limit the time we wait for netmgr to be destroyed
if more than 10 seconds pass while we wait for netmgr
events to finish running on shutdown, something is almost
certainly wrong and we should assert and crash.
2020-09-04 14:25:14 -07:00
Evan Hunt b3bc26af7d add more logging to the shutdown system test 2020-09-04 14:25:14 -07:00
Evan Hunt 32a453674a change from isc_nmhandle_ref/unref to isc_nmhandle attach/detach
Attaching and detaching handle pointers will make it easier to
determine where and why reference counting errors have occurred.

A handle needs to be referenced more than once when multiple
asynchronous operations are in flight, so callers must now maintain
multiple handle pointers for each pending operation. For example,
ns_client objects now contain:

        - reqhandle:    held while waiting for a request callback (query,
                        notify, update)
        - sendhandle:   held while waiting for a send callback
        - fetchhandle:  held while waiting for a recursive fetch to
                        complete
        - updatehandle: held while waiting for an update-forwarding
                        task to complete

control channel connection objects now contain:

        - readhandle: held while waiting for a read callback
        - sendhandle: held while waiting for a send callback
        - cmdhandle:  held while an rndc command is running

httpd connections contain:

        - readhandle: held while waiting for a read callback
        - sendhandle: held while waiting for a send callback
2020-09-04 14:25:06 -07:00
Witold KręcickiandEvan Hunt c07df818c5 assorted small netmgr-related changes
- cancelread functions now take handles instead of sockets
- add a 'client' flag in socket objects, currently unused, to
  indicate whether it is to used as a client or server socket.
2020-09-04 14:25:06 -07:00
Witold KręcickiandEvan Hunt 96e119cd19 rename isc_nmsocket_t->tcphandle to statichandle 2020-09-04 14:25:06 -07:00
Evan Hunt 4ed3238eac Merge branch 'each-faster-tcp-test' into 'main'
shorten the tcp system test

See merge request isc-projects/bind9!4091
2020-09-04 21:22:20 +00:00
Evan Hunt 1ceea908b6 shorten the tcp system test
the tcp system test uses the 'packet.pl' test tool to send a packet
thousands of times. this took a long time because the tool was waiting
for replies and parsing them; however, for that particular test the
replies aren't relevant.

this commit uses non-blocking sockets and moves the reply parsing
outside the send loop, which speeds the system test up substantially.
2020-09-04 13:55:01 -07:00
Michał Kępień e5f31ce242 Merge branch '1919-include-bind-documentation-in-windows-zips' into 'main'
Include BIND documentation in Windows zips

Closes #1919

See merge request isc-projects/bind9!4085
2020-09-03 10:01:55 +00:00
Michał Kępień 549ddca256 Include BIND documentation in Windows zips
As generated documentation files are no longer stored in the BIND Git
repository, put a copy of the PDF version of the BIND ARM generated by
the "docs" GitLab CI job into the Windows zips to make it easily
available to the end users on that platform.

Make sure Windows zips also contain certain documentation files included
in source tarballs to make the contents of each release more consistent
across different platforms.
2020-09-03 10:35:37 +02:00
Mark Andrews 1d21552ed7 Merge branch 'marka-check-deny-name-with-grant-subdomain' into 'main'
Check 'deny name' + 'grant subdomain' for the same name

See merge request isc-projects/bind9!4079
2020-09-03 06:16:01 +00:00
Mark Andrews a402ffbced Check 'deny name' + 'grant subdomain' for the same name 2020-09-03 08:16:00 +10:00
Mark Andrews 6c578e75d6 Merge branch '2115-the-load-of-huge-zone-can-take-over-100-secs-when-running-under-a-sanitiser' into 'main'
Resolve "The load of huge.zone can take over 100 secs when running under a sanitiser."

Closes #2115

See merge request isc-projects/bind9!4068
2020-09-02 21:12:02 +00:00
Mark AndrewsandMichał Kępień fd08918df5 Increase zone load timeout in the "rndc" test
The "huge.zone" zone can take longer than 100 seconds to load when
running under a sanitizer.  Increase the relevant zone load timeout to
prevent intermittent failures of the "rndc" system test.
2020-09-02 22:38:11 +02:00
Ondřej Surý aa42c8676f Merge branch '2091-print-out-more-diagnostics-on-dns_name_issubdomain' into 'main'
Print diagnostics on dns_name_issubdomain() failure in fctx_create()

Closes #2091

See merge request isc-projects/bind9!4071
2020-09-02 16:33:19 +00:00
Ondřej SurýandOndřej Surý 0a22024c27 Print diagnostics on dns_name_issubdomain() failure in fctx_create()
Log diagnostic message when dns_name_issubdomain() in the fctx_create()
when the resolver is qname minimizing and forwarding at the same time.
2020-09-02 18:08:15 +02:00
Ondřej Surý 323be476b8 Merge branch '2054-dig-bufsize-0-sets-bufsize-to-4096-2' into 'main'
Resolve "dig +bufsize=0 sets bufsize to 4096"

Closes #2054

See merge request isc-projects/bind9!4055
2020-09-02 15:01:00 +00:00
Mark AndrewsandOndřej Surý 1134f077fd Add CHANGES and release note for GL #2054 2020-09-02 16:59:10 +02:00
Mark AndrewsandOndřej Surý 1d55bd943b 'dig +bufsize=0' no longer disables EDNS as a side effect.
Additionally 'dig +bufsize' restores the default EDNS buffer size.
2020-09-02 16:58:43 +02:00
Mark Andrews fa9ba8c5f8 Merge branch '2084-9-11-data-race-in-dispatch_test-2' into 'main'
watch_fd also requires lockfd to be held. (9.16/9.17)

See merge request isc-projects/bind9!4058
2020-09-02 13:57:59 +00:00
Mark Andrews 22f499cdc4 watch_fd also requires thread->fdlock[lockid] to be held 2020-09-02 12:17:48 +00:00
Mark Andrews e923e62f6c remove dead code 2020-09-02 12:17:48 +00:00
Ondřej Surý c9a9bc5437 Merge branch '2037-deferred-system-test-tcp-buffers-filling-fix' into 'main'
Reorder the response reading in packet.pl to not fill TCP buffers

Closes #2037

See merge request isc-projects/bind9!4065
2020-09-02 12:16:05 +00:00
Ondřej Surý 91322d72c2 Skip the large TCP assertion failure test in the CI environment 2020-09-02 13:10:17 +02:00
Ondřej Surý ff133ebabd Reorder the response reading in packet.pl to not fill TCP buffers 2020-09-02 12:45:56 +02:00
Matthijs Mekking 27f0d104d3 Merge branch '1748-log-cds-cdnskey-publication' into 'main'
Resolve "Logging of CDS/CDNSKEY generation for workflow"

Closes #2103 and #1748

See merge request isc-projects/bind9!4028
2020-09-02 10:03:15 +00:00
Matthijs Mekking ff006a1730 Add change entry and release note for #1748 2020-09-02 12:01:22 +02:00
Matthijs Mekking f9ef5120c1 Log when CDS/CDNSKEY is published in zone.
Log when named decides to add a CDS/CDNSKEY record to the zone. Now
you understand how the bug was found that was fixed in the previous
commits.
2020-09-02 12:00:16 +02:00
Matthijs Mekking c8205bfa0e Fix CDS (non-)publication
The CDS/CDNSKEY record will be published when the DS is in the
rumoured state. However, with the introduction of the rndc '-checkds'
command, the logic in the keymgr was changed to prevent the DS
state to go in RUMOURED unless the specific command was given. Hence,
the CDS was never published before it was seen in the parent.

Initially I thought this was a policy approval rule, however it is
actually a DNSSEC timing rule. Remove the restriction from
'keymgr_policy_approval' and update the 'keymgr_transition_time'
function. When looking to move the DS state to OMNIPRESENT it will
no longer calculate the state from its last change, but from when
the DS was seen in the parent, "DS Publish". If the time was not set,
default to next key event of an hour.

Similarly for moving the DS state to HIDDEN, the time to wait will
be derived from the "DS Delete" time, not from when the DS state
last changed.
2020-09-02 12:00:14 +02:00
Matthijs Mekking 2d2b8e7c02 Silence two grep calls 2020-09-02 11:59:49 +02:00
Matthijs Mekking dd754a974c Update rndc_checkds test util
The 'rndc_checkds' utility now allows "now" as the time when the DS
has been seen in/seen removed from the parent.

Also it uses "KEYX" as the key argument, rather than key id.
The 'rndc_checkds' will retrieve the key from the "KEYX" string. This
makes the call a bit more readable.
2020-09-02 11:59:49 +02:00
Matthijs Mekking 8cb394e047 Improve kasp test readability
This commit has a lot of updates on comments, mainly to make the
system test more readable.

Also remove some redundant signing policy checks (check_keys,
check_dnssecstatus, check_keytimes).

Finally, move key time checks and expected key time settings above
'rndc_checkds' calls (with the new way of testing next key event
times there is no need to do them after 'rndc_checkds', and moving
them above 'rndc_checkds' makes the flow of testing easier to follow.
2020-09-02 11:59:49 +02:00
Matthijs Mekking 4a67cdabfe Add dnssec-settime [-P ds|-D ds] to kasp test
Add the new '-P ds' and '-D ds' calls to the kasp test setup so that
next key event times can reliably be tested.
2020-09-02 11:59:49 +02:00
Matthijs Mekking d4c4f6a669 Add '-P ds' and '-D ds' to dnssec-settime
Add two more arguments to the dnssec-settime tool. '-P ds' sets the
time that the DS was published in the parent, '-D ds' sets the time
that the DS was removed from the parent (these times are not accurate,
but rely on the user to use them appropriately, and as long as the
time is not before actual publication/withdrawal, it is fine).

These new arguments are needed for the kasp system test. We want to
test when the next key event is once a DS is published, and now
that 'parent-registration-delay' is obsoleted, we need a different
approach to reliable test the timings.
2020-09-02 11:59:47 +02:00
Michal Nowak 1f5c47e4e6 Merge branch 'mnowak/drop-gperftools-profiler-configure-switch' into 'main'
Drop gperftools-profiler configure switch

See merge request isc-projects/bind9!4045
2020-09-02 09:34:29 +00:00
Michal Nowak 10dd78126a Add CHANGES and release note for GL !4045 2020-09-02 11:08:40 +02:00
Michal Nowak de49699b66 Drop gperftools-profiler configure switch
This switch is believed to be unnecessary. The possibility to use
gperftools CPU profiler was kept, one needs to set 'CFLAGS' and
'LDFLAGS' accordingly.
2020-09-02 11:07:46 +02:00
Mark Andrews 57673de99e Merge branch 'marka-placeholder' into 'main'
placeholder

See merge request isc-projects/bind9!4061
2020-09-02 09:05:12 +00:00
Mark Andrews 10b2620ec5 placeholder 2020-09-02 18:46:56 +10:00
Mark Andrews c4b8b831c0 Merge branch '2081-data-race-in-zonemgr_test' into 'main'
Resolve "data race in zonemgr_test"

Closes #2081

See merge request isc-projects/bind9!3989
2020-09-02 01:36:51 +00:00
Mark Andrews ca1b0f1539 Add CHANGES note 2020-09-02 10:33:12 +10:00
Mark Andrews b8e4b6d303 isc_ratelimiter needs to hold a reference to its task
to prevent the task subsystem shutting down before the
ratelimiter is freed.
2020-09-02 10:32:33 +10:00
Mark Andrews d1d58a2e78 Merge branch '2111-restore-d-option-to-packet-pl' into 'main'
Resolve "Restore '-d' option to packet.pl"

Closes #2111

See merge request isc-projects/bind9!4054
2020-09-02 00:24:03 +00:00
Mark Andrews c070bab169 Dump the returned packet 2020-09-02 09:40:45 +10:00
Mark Andrews 6da018dcce Merge branch '2049-cleanup-sock' into 'main'
Resolve "Compiler warnings identified by Intel C++ Compiler"

See merge request isc-projects/bind9!3924
2020-09-01 22:38:43 +00:00
Mark Andrews b1c424ddf3 remove unused variable sock 2020-09-01 22:24:32 +00:00
Diego dos Santos Fronza 61e8e13c91 Merge branch '1847-recursor-has-issues-recursing-ip6-arpa' into 'main'
Resolve "9.16.* recursor has issues recursing"

Closes #1847

See merge request isc-projects/bind9!4027
2020-09-01 18:49:23 +00:00
Diego Fronza 044a72cca9 Add CHANGES and release note for GL #1847 2020-09-01 15:47:00 -03:00
Diego Fronza 11add69198 Added test for the proposed fix
The test works as follows:

1. Client wants to resolve unusual ip6.arpa. name:

   test1.test2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. IN TXT

2. Query is sent to ns7, a qmin enabled resolver.

3. ns7 do the first stage in query minimization for the name and send a new
   query to root (ns1):

  _.1.0.0.2.ip6.arpa.        IN  A

4. ns1 delegates ip6.arpa. to ns2.good.:

    ;; AUTHORITY SECTION:
    ;ip6.arpa.      20  IN  NS  ns2.good.

    ;; ADDITIONAL SECTION:
    ;ns2.good.      20  IN  A   10.53.0.2

5. ns7 do a second round in minimizing the name and send a new query
   to ns2.good. (10.53.0.2):

   _.8.2.6.0.1.0.0.2.ip6.arpa.    IN  A

6. ans2 delegates 8.2.6.0.1.0.0.2.ip6.arpa. to ns3.good.:

    ;; AUTHORITY SECTION:
    ;8.2.6.0.1.0.0.2.ip6.arpa. 60   IN  NS  ns3.good.

    ;; ADDITIONAL SECTION:
    ;ns3.good.      60  IN  A   10.53.0.3

7. ns7 do a third round in minimizing the name and send a new query to
   ns3.good.:

    _.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. IN A

8. ans3 delegates 1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. to ns4.good.:

    ;; AUTHORITY SECTION:
    ;1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. 60 IN    NS  ns4.good.

    ;; ADDITIONAL SECTION:
    ;ns4.good.      60  IN  A   10.53.0.4

9. ns7 do fourth round in minimizing the name and send a new query to
   ns4.good.:

	_.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa.    IN A

10. ns4.good. doesn't know such name, but answers stating it is authoritative for
    the domai:

	;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id:  53815
	...
	;; AUTHORITY SECTION:
	1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. 60 IN    SOA ns4.good.  ...

11. ns7 do another minimization on name:
   _.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa
   sends to ns4.good. and gets the same SOA response stated in item #10

12. ns7 do another minimization on name:
	_.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa
	sends to ns4.good. and gets the same SOA response stated in item #10.

13. ns7 do the last query minimization name for the ip6.arpa. QNAME.
	After all IPv6 labels are exausted the algorithm falls back to the
	original QNAME:
	test1.test2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa

    ns7 sends a new query with the original QNAME to ans4.

14. Finally ans4 answers with the expected response:
	;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:  40969
	;; flags: qr aa; QUESTION: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
	;; OPT PSEUDOSECTION:
	; EDNS: version: 0, flags:; udp: 8192
	;; QUESTION SECTION:
	;test1.test2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. IN TXT

	;; ANSWER SECTION:
	;test1.test2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.9.4.1.1.1.1.8.2.6.0.1.0.0.2.ip6.arpa. 1    IN TXT "long_ip6_name"
2020-09-01 15:47:00 -03:00
Diego Fronza 230d79c191 Fix resolution of unusual ip6.arpa names
Before this commit, BIND was unable to resolve ip6.arpa names like
the one reported in issue #1847 when using query minimization.

As reported in the issue, an attempt to resolve a name like
'rec-test-dom-158937817846788.test123.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.3.4.3.5.4.0.8.2.6.0.1.0.0.2.ip6.arpa'
using default settings would fail.

The reason was that query minimization algorithm in 'fctx_minimize_qname'
would divide any ip6.arpa names in increasing number of labels,
7,11, ... up to 35, thus limiting the destination name (minimized) to a number
of 35 labels.

In case the last query minimization attempt (with 35 labels) would fail with
NXDOMAIN, BIND would attempt the query mininimization again with the exact
same QNAME, limited on the 35 labels, and that in turn would fail again.

This fix avoids this fail loop by considering the extra labels that may appear
in the leftmost part of an ip6.arpa name, those after the IPv6 part.
2020-09-01 15:47:00 -03:00
Ondřej Surý 045478ad6a Merge branch '2037-deferred-system-test-fix' into 'main'
Unhexlify 2037-pk11_numbits-crash-test.pkt file

Closes #2037

See merge request isc-projects/bind9!4047
2020-09-01 14:17:21 +00:00
Ondřej Surý 5f6eb014aa Multiply 1996-alloc_dnsbuf-crash-test.pkt by 300000 via TCP
The test for assertion failure via large TCP packet needs to be repeated
multiple times (we use 300000).  This commit fixes the input file to be
properly hexlified and uses the new packet.pl -r feature to send it
300000 times via TCP.
2020-09-01 16:16:02 +02:00
Ondřej Surý dd46559a19 Add -r <repeats> option to packet.pl
For some tests, we need to send big data streams (for TCP) or repeated
packets (for UDP), this commits adds `-r` option to packet.pl that sends
the same input <repeats> times using the specified protocol.
2020-09-01 16:16:02 +02:00
Ondřej Surý 22e0272063 Properly format 2037-pk11_numbits-crash-test.pkt file 2020-09-01 16:16:02 +02:00
Mark Andrews 84aa74a111 Merge branch '2096-isc_refcount_decrement-needs-acquire-release-memory-ordering' into 'main'
Resolve "isc_refcount_decrement  needs acquire release memory ordering."

Closes #2096

See merge request isc-projects/bind9!4010
2020-09-01 12:21:25 +00:00
Mark Andrews 6278899a38 Use memory_order_acq_rel in isc_refcount_decrement.
While

if (isc_refcount_decrement() == 1) {	// memory_order_release
	isc_refcount_destroy();		// memory_order_acquire
	...
}

is theoretically the most efficent in practice, using
memory_order_acq_rel produces the same code on x86_64 and doesn't
trigger tsan data races (which use a idealistic model) if
isc_refcount_destroy() is not called immediately.  In fact
isc_refcount_destroy() could be removed if we didn't want
to check for the count being 0 when isc_refcount_destroy() is
called.

https://stackoverflow.com/questions/49112732/memory-order-in-shared-pointer-destructor
2020-09-01 12:05:18 +00:00
Michał Kępień fcd6962e8b Merge branch '2075-add-T-maxcachesize-command-line-option' into 'main'
Add "-T maxcachesize=..." command line option

Closes #2075

See merge request isc-projects/bind9!4043
2020-08-31 21:40:28 +00:00
Michał Kępień dad6572093 Use "-T maxcachesize=2097152" in all system tests
In order to lower the amount of memory allocated at startup by named
instances used in the BIND system test suite, set the default value of
"max-cache-size" for these to 2 megabytes.  The purpose of this change
is to prevent named instances (or even entire virtual machines) from
getting killed by the operating system on the test host due to excessive
memory use.

Remove all "max-cache-size" statements from named configuration files
used in system tests ("checkconf" notwithstanding) to prevent confusion
as the "-T maxcachesize=..." command line option takes precedence over
configuration files.
2020-08-31 13:15:33 +02:00
Michał Kępień 9ac1f6a9bc Add "-T maxcachesize=..." command line option
An implicit default of "max-cache-size 90%;" may cause memory use issues
on hosts which run numerous named instances in parallel (e.g. GitLab CI
runners) due to the cache RBT hash table now being pre-allocated [1] at
startup.  Add a new command line option, "-T maxcachesize=...", to allow
the default value of "max-cache-size" to be overridden at runtime.  When
this new option is in effect, it overrides any other "max-cache-size"
setting in the configuration, either implicit or explicit.  This
approach was chosen because it is arguably the simplest one to
implement.

The following alternative approaches to solving this problem were
considered and ultimately rejected (after it was decided they were not
worth the extra code complexity):

  - adding the same command line option, but making explicit
    configuration statements have priority over it,

  - adding a build-time option that allows the implicit default of
    "max-cache-size 90%;" to be overridden.

[1] see commit e24bc324b4
2020-08-31 13:15:33 +02:00
Ondřej Surý 96c4010fe5 Merge branch '1996-deferred-system-test' into 'main'
[CVE-2020-8620] Fix TCP DNS buffer sizes [TEST]

See merge request isc-projects/bind9!4038
2020-08-31 10:04:42 +00:00
Ondřej Surý 2c796bb9c8 Add PoC for assertion failure on large TCP DNS messages 2020-08-31 12:04:01 +02:00
Ondřej Surý bd3d9f33dc Merge branch '1997-deferred-system-test' into 'main'
[CVE-2020-8621] Ensure QNAME minimization is permanently disabled when forwarding [TEST]

See merge request isc-projects/bind9!4039
2020-08-31 09:59:01 +00:00
Evan HuntandOndřej Surý dd8db89525 test whether DS chasing works correctly when forwarding 2020-08-31 11:21:22 +02:00
Ondřej Surý ed98f65479 Merge branch '2037-deferred-system-test' into 'main'
Resolve "[CVE-2020-8623] A flaw in native PKCS#11 code can lead to a remotely triggerable assertion failure in pk11.c"

See merge request isc-projects/bind9!4037
2020-08-31 08:58:03 +00:00
Ondřej SurýandOndřej Surý a69433ba40 Add PoC system test for pk11_numbits() assertion 2020-08-31 09:18:13 +02:00
Michał KępieńandOndřej Surý a7b78f3a40 Fix relative path to conf.sh in cleanpkcs11.sh 2020-08-31 09:18:13 +02:00
Ondřej Surý c3a351275b Merge branch '2028-deferred-system-test' into 'main'
[CVE-2020-8622] Properly handle malformed truncated responses to TSIG queries [TEST]

See merge request isc-projects/bind9!4034
2020-08-31 06:24:41 +00:00
Mark AndrewsandOndřej Surý 8bbf3eb5f3 check that a malformed truncated response to a TSIG query is handled 2020-08-31 08:19:13 +02:00
Ondřej Surý 9af47af0f7 Merge branch '1928-handle-EPROTO' into 'main'
Resolve "error: socket.c:1540: unexpected error:"

Closes #1928

See merge request isc-projects/bind9!4023
2020-08-28 18:47:43 +00:00
Ondřej Surý 4722196b13 Add CHANGES and release note for GL #1928 2020-08-28 20:46:34 +02:00
Ondřej Surý e0380d437d Handle EPROTO errno from recvmsg
It was discovered, that some systems might set EPROTO instead of EACCESS
on recvmsg() call causing spurious syslog messages from the socket
code.  This commit returns soft handling of EPROTO errno code to the
socket code. [GL #1928]
2020-08-28 20:45:52 +02:00
Ondřej Surý f59067807e Merge branch '2104-fix-off-by-one-error-in-rehash_bits' into 'main'
Resolve "Bind 9.16.6 due to assertion failure"

Closes #2104

See merge request isc-projects/bind9!4030
2020-08-28 15:42:13 +00:00
Ondřej Surý d47d2b3fe0 Add CHANGES and release notes for GL #2104 2020-08-28 16:21:56 +02:00
Ondřej Surý 78543ad5a7 Fix off-by-one error when calculating new hashtable size
When calculating the new hashtable bitsize, there was an off-by-one
error that would allow the new bitsize to be larger than maximum allowed
causing assertion failure in the rehash() function.
2020-08-28 16:21:21 +02:00
Michal Nowak 25d35029eb Merge branch 'mnowak/fix-tarball-test-suite.log-print' into 'main'
Print test-suite.log correctly in tarball system test job

See merge request isc-projects/bind9!3990
2020-08-28 12:38:32 +00:00
Michal Nowak 0c9c755952 Print test-suite.log correctly in tarball system test job
Printing test-suite.log on system test failure does not work for system
test run from tarball because the "after_script" step does not honour
directory change from the "before_script" step and fails with:

    Running after script...
    $ cat bin/tests/system/test-suite.log
    cat: bin/tests/system/test-suite.log: No such file or directory
2020-08-28 14:00:10 +02:00
Ondřej Surý 56ee60e130 Merge branch '2074-bind-allows-an-empty-cm-value-for-optional-loc-rdata-fields' into 'main'
Resolve "BIND allows an empty 'cm' value for optional LOC RDATA fields"

Closes #2074

See merge request isc-projects/bind9!3988
2020-08-26 14:28:17 +00:00
Mark AndrewsandOndřej Surý d9594cffab Add CHANGES note 2020-08-26 15:31:51 +02:00
Mark AndrewsandOndřej Surý 2ca4d35037 Refactor totext_loc 2020-08-26 15:31:31 +02:00
Mark AndrewsandOndřej Surý 337cc878fa Correctly encode LOC records with non integer negative altitudes. 2020-08-26 15:31:31 +02:00
Mark AndrewsandOndřej Surý 888dfd78c7 Check LOC's altitude field is properly parsed and encoded. 2020-08-26 15:31:31 +02:00
Mark AndrewsandOndřej Surý 9225c67835 Tighten LOC parsing to reject period and/or m as a value. 2020-08-26 15:31:31 +02:00
Mark Andrews daca5e8912 Merge branch '2080-data-race-in-rdataset_addglue' into 'main'
Resolve "data race in rdataset_addglue"

Closes #2080

See merge request isc-projects/bind9!3987
2020-08-26 11:32:57 +00:00
Mark Andrews 48973c3ec6 Add CHANGES note 2020-08-26 21:16:04 +10:00
Ondřej SurýandMark Andrews 01684cc219 Use the Fibonacci Hashing for the RBTDB glue table
The rbtdb version glue_table has been refactored similarly to rbt.c hash
table, so it does use 32-bit hash function return values and apply
Fibonacci Hashing to lookup the index to the hash table instead of
modulo.  For more details, see the lib/dns/rbt.c commit log.
2020-08-26 21:16:04 +10:00
Mark Andrews 33d0e8d168 rbtversion->glue_table_size must be read when holding a lock 2020-08-26 21:16:04 +10:00
Michal Nowak 0ede73b9f1 Merge branch 'mnowak/tumbleweed-fix-krb5-config-location' into 'main'
Tumbleweed changed location of krb5-config

See merge request isc-projects/bind9!4016
2020-08-26 08:57:20 +00:00
Michal Nowak 6095811461 Tumbleweed changed location of krb5-config
krb5-config is now in /usr/bin/ and we should detect it automatically.
2020-08-26 10:56:01 +02:00
Ondřej Surý 045173f8a7 Merge branch '2097-manual-page-tools-need-updating' into 'main'
Fix generated documentation

Closes #2097

See merge request isc-projects/bind9!4017
2020-08-26 08:51:49 +00:00
Michal Nowak 56abe27b9e Fix generated documentation
With Sphinx 3.2.1 line-leading period should be escaped.
2020-08-26 10:34:01 +02:00
Ondřej Surý f3270a6d88 Merge branch 'ondrej/copy-wire-test-to-fuzz' into 'main'
Add dns_message_parse() fuzzer

See merge request isc-projects/bind9!4009
2020-08-25 18:19:02 +00:00
Ondřej Surý 9d14522469 Add minimized (cmin-tmin-cmin) corpus for dns_message_parse fuzzer
The non-minimized corpus from https://github.com/CZ-NIC/dns-fuzzing was
used as input to afl-cmin, then every case were processed by afl-tmin
and then afl-cmin was used to further minimize the corpus again.
2020-08-25 16:40:24 +02:00
Ondřej SurýandOndřej Surý 01cc80376e Add dns_message_parse() fuzzer
Previously, the bin/system/wire_test.c was optionally used as a fuzzer,
this commit extracts the parts relevant to the fuzzing into a
specialized fuzzer that can be used in oss-fuzz project.

The fuzzer parses the input as UDP DNS message, then prints parsed DNS
message, then renders the DNS message and then prints the rendered DNS
message.  No part of the code should cause a assertion failure.
2020-08-25 16:40:24 +02:00
Ondřej Surý 2164b6926f Merge branch '2095-shifting-large-rcode-in-dns-message-c-results-in-undefined-behaviour' into 'main'
Resolve "Shifting large rcode in dns/message.c results in undefined behaviour"

Closes #2095

See merge request isc-projects/bind9!4011
2020-08-25 14:11:04 +00:00
Mark AndrewsandOndřej Surý a347641782 Cast the original rcode to (dns_ttl_t) when setting extended rcode
Shifting (signed) integer left could trigger undefined behaviour when
the shifted value would overflow into the sign bit (e.g. 2048).

The issue was found when using AFL++ and UBSAN:

    message.c:2274:33: runtime error: left shift of 2048 by 20 places cannot be represented in type 'int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior message.c:2274:33 in
2020-08-25 14:10:05 +00:00
Michal Nowak 3f85b0fe3b Merge branch '2053-test-disable-buffer-useinline-in-gitlab-ci' into 'main'
Resolve "Test --disable-buffer-useinline in GitLab CI"

Closes #2053

See merge request isc-projects/bind9!3983
2020-08-25 14:04:47 +00:00
Michal Nowak f34df4ef90 Build CentOS 8 with --enable-buffer-useinline 2020-08-25 16:02:55 +02:00
Michal Nowak dd425254a7 Fix warnings in when build with --enable-buffer-useinline
sockaddr.c:147:49: error: pointer targets in passing argument 2 of ‘isc__buffer_putmem’ differ in signedness
    rdata.c:1780:30: error: pointer targets in passing argument 2 of ‘isc__buffer_putmem’ differ in signedness
2020-08-25 16:02:55 +02:00
Mark Andrews f036e0bc7f Merge branch 'marka-add-missing-isc_mutex_init' into 'main'
Add missing isc_mutex_init to manytasks subtest.

See merge request isc-projects/bind9!3996
2020-08-24 23:54:46 +00:00
Mark Andrews 2eb5c29c83 Add missing isc_mutex_init to manytasks subtest. 2020-08-24 22:38:08 +00:00
Ondřej Surý 273d21fc93 Merge branch 'ondrej/update-pregenerated-files' into 'main'
Update pregenerated documentation files

See merge request isc-projects/bind9!4005
2020-08-24 17:48:14 +00:00
Ondřej SurýandOndřej Surý ca487a5db0 Sync the pregenerated files with their source counterparts 2020-08-24 14:44:05 +02:00
Ondřej Surý 586415fea2 Make sure the maintainer files are clean after rebuild
When updating source files, we might forget to update pre-generated
files (generated by sphinx-build and cfg_gen) and then the extra changes
would get included in the random merge request.

This commit updates the tarball-create job to enable the maintainer
mode, then clean all maintainer files (`make maintainer-clean`) rebuild
all the file from scratch and compare the result which must be a clean
git directory.
2020-08-24 14:40:39 +02:00
Ondřej Surý 62971d4a3c Merge branch 'ondrej/update-readline-support-fix' into 'main'
Add missing support for --with-readline=yes

See merge request isc-projects/bind9!3984
2020-08-24 11:39:18 +00:00
Michal NowakandOndřej Surý 727272934e editline's pkg-config name is libeditline 2020-08-24 09:11:47 +02:00
Michal NowakandOndřej Surý bc1c0d2ef4 Make sure readline configuration works 2020-08-24 09:11:47 +02:00
Ondřej Surý 713b77c70e Add missing support for --with-readline=yes
By error, ./configure --with-readline would fail, because 'yes' wasn't
handled properly in the top level case.
2020-08-24 09:11:47 +02:00
Ondřej Surý 41c9a5e428 Merge branch 'ondrej/add-notes-current.rst-to-util-copyright' into 'main'
Update util/copyright to include doc/notes/notes-current.rst

See merge request isc-projects/bind9!4002
2020-08-24 07:10:22 +00:00
Ondřej Surý 334350a75a Update util/copyright to include doc/notes/notes-current.rst 2020-08-24 09:06:13 +02:00
Michal Nowak 3df3dadaf2 Merge branch 'mnowak/update_BIND_BASELINE_VERSION_to_v9_17_4' into 'main'
Update BIND_BASELINE_VERSION to v9_17_4

See merge request isc-projects/bind9!3999
2020-08-21 09:22:09 +00:00
Michal Nowak 1b1b11a3fe Update BIND_BASELINE_VERSION to v9_17_4 2020-08-21 11:10:36 +02:00
Evan Hunt d7362ff16d Merge tag 'v9_17_4' into main
BIND 9.17.4
2020-08-20 12:05:01 -07:00
Mark Andrews ac67436758 Merge branch '2077-negative-hook-point-value-in-filter-aaaa-c' into 'main'
Resolve "negative hook point value in filter-aaaa.c"

Closes #2077

See merge request isc-projects/bind9!3985
2020-08-19 00:17:05 +00:00
Mark Andrews 2fd5ba6507 Remove stray '-' from filter-aaaa initialisation 2020-08-19 09:21:59 +10:00
Ondřej Surý e51c8613e4 Merge branch 'ondrej/dns_rdata_fromwire_text-corpus-update' into 'main'
Expand, but minimize (tmin, cmin) dns_rdata_fromwire_text corpus

See merge request isc-projects/bind9!3981
2020-08-18 15:44:11 +00:00
Ondřej Surý df26656e4b Expand, but minimize (tmin, cmin) dns_rdata_fromwire_text corpus 2020-08-18 16:39:23 +02:00
Ondřej Surý 2a8c0282da Merge branch 'marka-fuzz-consolidated' into 'main'
Consolidated fuzz fixes

See merge request isc-projects/bind9!3975
2020-08-18 09:07:47 +00:00
Ondřej Surý 62c448beaf Merge branch 'ondrej/update-readline-support' into 'main'
Update and cleanup the readline library support

See merge request isc-projects/bind9!3942
2020-08-18 09:05:51 +00:00
Mark AndrewsandOndřej Surý 8452404bd7 A6: return FORMERR in fromwire if bits are non zero.
oss_fuzz: Issue 24864: bind9:dns_rdata_fromwire_text_fuzzer: Overwrites-const-input in dns_rdata_fromwire_text_fuzzer
2020-08-18 11:04:05 +02:00
Mark AndrewsandOndřej Surý f6d7b8c20d RRSIG: reject records with empty SIG section 2020-08-18 11:04:05 +02:00
Mark AndrewsandOndřej Surý 3e743da1bd Disable compression in dns_rdata_fromwire_text() 2020-08-18 11:04:05 +02:00
Mark AndrewsandOndřej Surý aa811801cb dns_rdata_fromwire() only accepts input up to 2^16-1 octets. 2020-08-18 11:04:05 +02:00
Mark AndrewsandOndřej Surý e4d30cb007 Print out input if dns_rdata_fromtext() fails in debug mode. 2020-08-18 11:04:05 +02:00
Mark AndrewsandOndřej Surý 2e748ba397 Add the ability to specify an input file 2020-08-18 11:04:05 +02:00
Ondřej Surý be8c589f28 Add CHANGES note for GL !3942 2020-08-18 10:27:37 +02:00
Ondřej Surý ba2376b9e0 Update and cleanup the readline library support
This commit updates and simplifies the checks for the readline support
in nslookup and nsupdate:

  * Change the autoconf checks to pkg-config only, all supported
    libraries have accompanying .pc files now.
  * Add editline support in addition to libedit and GNU readline
  * Add isc/readline.h shim header that defines dummy readline()
    function when no readline library is available
2020-08-18 10:27:14 +02:00
Michal Nowak 99ca842e0a Merge branch 'mnowak/gcovr' into 'main'
Report coverage with gcovr

Closes isc-private/bind-qa#23

See merge request isc-projects/bind9!3606
2020-08-17 15:21:41 +00:00
Michal Nowak 8d15bef0dd Report coverage with gcovr 2020-08-17 17:19:32 +02:00
Michal Nowak d5350db5bc Merge branch 'mnowak/broaden-abi-check-scope' into 'main'
Broaden scope of abi-check

See merge request isc-projects/bind9!3927
2020-08-17 13:07:15 +00:00
Michal Nowak 8e43f5e860 Broaden scope of abi-check
For abi-check we should use as broad 'configure' options as possible.
2020-08-17 14:58:32 +02:00
Mark Andrews f85bb0691c Merge branch 'patch-3' into 'main'
Option -s is not supported in tsig-keygen

See merge request isc-projects/bind9!3966
2020-08-17 02:35:33 +00:00
JP Mens b01d26c608 Option -s is not supported in tsig-keygen 2020-08-16 16:23:48 +00:00
Mark Andrews 4005cc3864 Merge branch 'marka-bad-bool-value' into 'main'
Ensure that a bool is stored in 'eol'

See merge request isc-projects/bind9!3960
2020-08-14 04:42:23 +00:00
Mark Andrews 8b75833aaa Ensure that a bool is stored in 'eol'
oss-fuzz: Issue 24875: bind9:isc_lex_getmastertoken_fuzzer: Invalid-bool-value in isc_lex_getmastertoken.c
2020-08-14 08:35:17 +10:00
Ondřej Surý 53f229f499 Merge branch 'ondrej/fix-oss-fuzz-debug' into 'main'
Move the debug variable from main.c to individual fuzzer

See merge request isc-projects/bind9!3959
2020-08-13 16:00:08 +00:00
Ondřej Surý 915616a34e Move the debug variable from main.c to individual fuzzer
The fuzzers needs to be completely independent of the main.c for
OSS-Fuzz to work.
2020-08-13 17:55:38 +02:00
Mark Andrews dd29e2550c Merge branch 'marka-fuzz-fixes' into 'main'
Add issues found by dns_rdata_fromwiretext fuzzer.

See merge request isc-projects/bind9!3953
2020-08-13 14:08:50 +00:00
Mark Andrews 80d69ba04c Add CHANGES note 2020-08-13 23:16:18 +10:00
Mark Andrews 7ae055cef1 Add previously detected dns_rdata_fromwire_text failures 2020-08-13 23:16:18 +10:00
Mark Andrews 7e49689746 X25: Check that record is all ASCII digits 2020-08-13 23:06:55 +10:00
Mark Andrews 9d446142d8 WKS: reject records with zero octets at the end of the bitmap 2020-08-13 23:06:55 +10:00
Mark Andrews 3429c35f52 TLSA: fix fromwire length checks 2020-08-13 23:06:55 +10:00
Mark Andrews 9b93e5d684 SIG: reject records with a zero length signature 2020-08-13 23:06:55 +10:00
Mark Andrews 73dd849655 NXT: fix fromwire bitmap checks 2020-08-13 23:06:55 +10:00
Mark Andrews 7dc8e720ff NSEC3PARAM: check that saltlen is consistent with the rdata length 2020-08-13 23:06:55 +10:00
Mark Andrews 031ee9e279 NSEC3: reject records with a zero length hash field 2020-08-13 23:06:55 +10:00
Mark Andrews d7f7014803 IPSECKEY: require non-zero length public keys 2020-08-13 23:06:55 +10:00
Mark Andrews a238f37239 CERT: reject records with a empty certificate field 2020-08-13 23:06:55 +10:00
Mark Andrews 3c492b3ef1 Get rid of type 'RESERVED0'. 2020-08-13 23:06:55 +10:00
Mark Andrews a92d973430 dns_rdata_fromwire_text fixes:
* Disallow compression pointers in names as we are not
  reading from a packet and as a result length checks fail.
* Increase totext buffer size as fuzzer ran out of space on
  big bitmaps.
* NUL terminate totext to make fault diagnosis easier.
* Add debugging messages to make fault diagnosie easier.
2020-08-13 23:06:55 +10:00
Mark Andrews 6c7e50c267 base32_decode*() could incorrectly decode a input.
base32_decode_char() added a extra zero octet to the output
if the fifth character was a pad character.  The length
of octets to copy to the output was set to 3 instead of 2.
2020-08-13 23:06:55 +10:00
Matthijs Mekking 9bb966d579 Merge branch 'matthijs-fix-kasp-test-next-key-event' into 'main'
Update check next key events after rndc checkds

See merge request isc-projects/bind9!3937
2020-08-13 10:04:10 +00:00
Matthijs Mekking 262b52a154 Fix check next key event check in kasp test
Prevent intermittent false positives on slow platforms by subtracting
the number of seconds which passed between key creation and invoking
'rndc dnssec -checkds'.

This particularly fails for the step3.csk-roll2.autosign zone because
the closest next key event is when the zone signatures become
omnipresent. Running 'rndc dnssec -checkds' some time later means
that the next key event is in fact closer than the calculated time
and thus we need to adjust the expected time by the time already
passed.
2020-08-13 10:30:31 +02:00
Ondřej Surý eeb8b80547 Merge branch 'marka-handle-eof' into 'main'
Address infinite loop on EOF.

See merge request isc-projects/bind9!3954
2020-08-13 07:21:19 +00:00
Mark Andrews c59ab04f6f Address infinite loop on EOF. 2020-08-13 16:42:40 +10:00
Ondřej Surý 191887ef2b Merge branch 'ondrej/oss-fuzz' into 'main'
Couple of minor changes to the autoconf for the OSS-Fuzz project

See merge request isc-projects/bind9!3951
2020-08-12 20:56:50 +00:00
Ondřej Surý f9aba90342 Add explicit support of OSS-Fuzz
The --enable-fuzzing option now allows third choice "ossfuzz" that just
adds $LIB_FUZZING_ENGINE to FUZZ_LDFLAGS to make the fuzzer builds
compatible with OSS-Fuzz project that has some special quirks (the
main() routine is provided in the static library the project provides).
2020-08-12 21:58:45 +02:00
Ondřej Surý eb0d5a9526 Allow static linking in the developer mode
Previously, we have disallowed static linking (for good reasons).
However, there are legitimate reasons where static linking might be
useful, and one of the reasons is the OSS-Fuzz project that doesn't have
the libraries used for build, so static linking is the sane option here.

The static linking is still disallowed in the "production" builds, but
it's not possible to disable shared and enable static libraries when
used together with --enable-developer.
2020-08-12 21:56:37 +02:00
Ondřej Surý c8538c50b4 Merge branch '2064-fix-isc_lex_getmastertoken-fuzzing' into 'main'
Really fuzz isc_lex_getmastertoken() in the test

Closes #2064

See merge request isc-projects/bind9!3949
2020-08-12 19:53:49 +00:00
Ondřej SurýandOndřej Surý 790476332e Really fuzz isc_lex_getmastertoken() in the test
There was a copy&paste error in fuzz/isc_lex_getmastertoken.c where we
didn't really test the function we wanted to test.  Update the test to
have the input data to always include expected 'tokentype' in the first
byte, `eol` argument in the second byte and the rest of the input is the
data to parse.
2020-08-12 21:49:31 +02:00
Michal Nowak 88ad7b85e6 Merge branch 'mnowak/fix-core-dumps-were-found-line' into 'main'
Make sure .txt files are not identified as crashed test

See merge request isc-projects/bind9!3909
2020-08-12 07:48:05 +00:00
Michal Nowak c2dcd95966 Make sure .txt files are not identified as crashed test
Previously .txt files with full backtrace may be identified as a
crashed test:

    I:Core dumps were found for the following system tests:
    I:	 core.19948-backtrace.txt
    I:   shutdown

Now .txt files are removed from the list.

Change 'run.sh.in' to match the core matching pattern in
'testsummary.sh'.
2020-08-12 09:45:56 +02:00
Mark Andrews 852a2d834f Merge branch '2045-readline-rltypedefs-h-35-22-error-this-function-declaration-is-not-a-prototype-on-netbsd-9' into 'main'
Resolve "readline/rltypedefs.h:35:22: error: this function declaration is not a prototype on NetBSD 9"

Closes #2045

See merge request isc-projects/bind9!3926
2020-08-11 23:34:55 +00:00
Mark Andrews fd126553d4 Ensure rl_message() gets prototype. 2020-08-11 23:21:17 +00:00
Mark Andrews 1532a34658 Stop deprecated functions being defined 2020-08-11 23:21:17 +00:00
Michal Nowak a53a0a8df1 Merge branch 'mnowak/run-tarball-tests-in-schedule' into 'main'
Run unit and system tarball tests on schedules

See merge request isc-projects/bind9!3928
2020-08-11 14:59:35 +00:00
Michal Nowak 439fe9bc3c Run unit and system tarball tests on schedules
To prevent problems with unit and system tarball tests being revealed
during release process, run these tests on schedules.
2020-08-11 16:58:28 +02:00
Mark Andrews ba6af6d507 Merge branch '2067-nta-related-crash-in-checkbogus-after-an-rndc-reload' into 'main'
Resolve "NTA-related crash in checkbogus() after an "rndc reload""

Closes #2067

See merge request isc-projects/bind9!3930
2020-08-11 01:45:43 +00:00
Mark Andrews 0b2555e8cf Address use after free between view, resolver and nta.
Hold a weak reference to the view so that it can't go away while
nta is performing its lookups.  Cancel nta timers once all external
references to the view have gone to prevent them triggering new work.
2020-08-11 11:00:49 +10:00
Mark Andrews f9537a6f2a Merge branch '2027-update-managed-keys-log-messages' into 'main'
Resolve "Slightly misleading diagnostic when revoked key is removed from managed-keys zone"

Closes #2027

See merge request isc-projects/bind9!3934
2020-08-11 00:54:39 +00:00
Mark Andrews c9f019c931 Update managed keys log messages to be less confusing. 2020-08-11 00:10:10 +00:00
Evan Hunt fec73c7e79 Merge branch 'each-fix-typo' into 'main'
fix ARM typo

See merge request isc-projects/bind9!3938
2020-08-10 19:38:49 +00:00
Evan Hunt a69afb37e0 fix ARM typo 2020-08-10 12:36:29 -07:00
Ondřej SurýandMichał Kępień 9a2a819817 Reduce the default RBT hash table size to 16 entries (4 bits)
The hash table rework MRs (!3865, !3871) increased the default RBT hash
table size from 64 to 65,536 entries (for 64-bit architectures, that is
512 bytes before vs. 524,288 bytes after).  This works fine for RBTs
used for cache databases, but since three separate RBT databases are
created for every zone loaded (RRs, NSEC, NSEC3), memory usage would
skyrocket when BIND 9 is used as an authoritative DNS server with many
zones.

The default RBT hash table size before the rework was 64 entries, this
commit reduces it to 16 entries because our educated guess is that most
zones are just couple of entries (SOA, NS, A, AAAA, MX) and rehashing
small hash tables is actually cheap.  The rework we did in the previous
MRs tries to avoid growing the hash tables for big-to-huge caches where
growing the hash table comes at a price because the whole cache needs to
be locked.

(cherry picked from commit 1e043a011b)
2020-08-10 12:08:09 +02:00
Michał Kępień e151eb3aa3 Merge branch '1775-pick-smaller-default-rbt-hash-table-size' into 'main'
Reduce the default rbt hashtable size to 16 entries (4 bits)

Closes #1775

See merge request isc-projects/bind9!3935
2020-08-10 09:29:16 +00:00
Ondřej Surý 1e043a011b Reduce the default RBT hash table size to 16 entries (4 bits)
The hash table rework MRs (!3865, !3871) increased the default RBT hash
table size from 64 to 65,536 entries (for 64-bit architectures, that is
512 bytes before vs. 524,288 bytes after).  This works fine for RBTs
used for cache databases, but since three separate RBT databases are
created for every zone loaded (RRs, NSEC, NSEC3), memory usage would
skyrocket when BIND 9 is used as an authoritative DNS server with many
zones.

The default RBT hash table size before the rework was 64 entries, this
commit reduces it to 16 entries because our educated guess is that most
zones are just couple of entries (SOA, NS, A, AAAA, MX) and rehashing
small hash tables is actually cheap.  The rework we did in the previous
MRs tries to avoid growing the hash tables for big-to-huge caches where
growing the hash table comes at a price because the whole cache needs to
be locked.
2020-08-10 10:31:19 +02:00
Michal Nowak cde7f982eb Merge branch 'michal/do-not-run-make-recheck-if-the-test-suite-fails' into 'main'
Do not run "make recheck" if the test suite fails

See merge request isc-projects/bind9!3932
2020-08-07 14:38:38 +00:00
Michał Kępień 5a4076fc40 Do not run "make recheck" if the test suite fails
Running "make recheck" after the test suite fails hides intermittent
system test failures in GitLab CI.  This makes it hard to identify which
branches are affected by a particular test failure mode and causes CI
results to be overly optimistic.  Prevent "make recheck" from being run
when "make check" fails to ensure GitLab CI results properly reflect the
stability of the "main" branch.
2020-08-07 14:35:05 +02:00
Matthijs Mekking 82e9287459 Merge branch '1613-rndc-dnssec-checkds' into 'main'
Resolve "Signal DS submitting via rndc"

Closes #1613

See merge request isc-projects/bind9!3906
2020-08-07 11:19:09 +00:00
Matthijs Mekking 46fcd927e7 rndc dnssec -checkds set algorithm
In the rare case that you have multiple keys acting as KSK and that
have the same keytag, you can now set the algorithm when calling
'-checkds'.
2020-08-07 11:26:09 +02:00
Matthijs Mekking e4c82fc7ae Add notes for #1613 (rndc dnssec -checkds)
This is a new feature that should be mentioned in the notes.
2020-08-07 11:26:09 +02:00
Matthijs Mekking a43bb41909 Test 'rndc dnssec -checkds' on multiple zones
Make sure the 'checkds' command correctly sets the right key timing
metadata and also make sure that it rejects setting the key timing
metadata if there are multiple keys with the KSK role and no key
identifier is provided.
2020-08-07 11:26:09 +02:00
Matthijs Mekking a25f49f153 Make 'parent-registration-delay' obsolete
With the introduction of 'checkds', the 'parent-registration-delay'
option becomes obsolete.
2020-08-07 11:26:09 +02:00
Matthijs Mekking 38cb43bc86 Adjust kasp tests to use 'checkds'
With 'checkds' replacing 'parent-registration-delay', the kasp
test needs the expected times to be adjusted. Also the system test
needs to call 'rndc dnssec -checkds' to progress the rollovers.

Since we pretend that the KSK is active as soon as the DS is
submitted (and parent registration delay is no longer applicable)
we can simplify the 'csk_rollover_predecessor_keytimes' function
to take only one "addtime" parameter.

This commit also slightly changes the 'check_dnssecstatus' function,
passing the zone as a parameter.
2020-08-07 11:26:09 +02:00
Matthijs Mekking e3eb55fd1c Fix time printing in key files
Don't strip off the final character when printing times in key files.

With the introduction of 'rndc dnssec -status' we introduced
'isc_stdtime_tostring()'. This changed in behavior such that it was no
longer needed to strip of the final '\n' of the string format
datetime. However, in 'printtime()' it still stripped the final
character.
2020-08-07 11:26:09 +02:00
Matthijs Mekking 04d8fc0143 Implement 'rndc dnssec -checkds'
Add a new 'rndc' command 'dnssec -checkds' that allows the user to
signal named that a new DS record has been seen published in the
parent, or that an existing DS record has been withdrawn from the
parent.

Upon the 'checkds' request, 'named' will write out the new state for
the key, updating the 'DSPublish' or 'DSRemoved' timing metadata.

This replaces the "parent-registration-delay" configuration option,
this was unreliable because it was purely time based (if the user
did not actually submit the new DS to the parent for example, this
could result in an invalid DNSSEC state).

Because we cannot rely on the parent registration delay for state
transition, we need to replace it with a different guard. Instead,
if a key wants its DS state to be moved to RUMOURED, the "DSPublish"
time must be set and must not be in the future. If a key wants its
DS state to be moved to UNRETENTIVE, the "DSRemoved" time must be set
and must not be in the future.

By default, with '-checkds' you set the time that the DS has been
published or withdrawn to now, but you can set a different time with
'-when'. If there is only one KSK for the zone, that key has its
DS state moved to RUMOURED. If there are multiple keys for the zone,
specify the right key with '-key'.
2020-08-07 11:26:09 +02:00
Michał Kępień 94d9ffd4a2 Include fuzz/fuzz.h in source tarballs 2020-08-06 09:10:06 +02:00
Michał Kępień 6707a8558b Update BIND version to 9.17.4 2020-08-06 09:10:06 +02:00
Michał Kępień 8e212e96af Add a CHANGES marker 2020-08-06 09:10:06 +02:00
Michał Kępień b096a038e3 Update library API versions 2020-08-06 09:10:06 +02:00
Michał Kępień 5ef9233326 Merge branch 'michal/prepare-release-notes-for-bind-9.17.4' into 'security-main'
Prepare release notes for BIND 9.17.4

See merge request isc-private/bind9!186
2020-08-06 06:14:38 +00:00
Michał Kępień 8980d219c7 Reorder release notes 2020-08-05 16:02:38 +02:00
Michał Kępień e0f394bbc4 Prepare release notes for BIND 9.17.4 2020-08-05 16:02:38 +02:00
Michał Kępień 9d932c6ddc Add release note for #1976 2020-08-05 16:02:38 +02:00
Michał Kępień 23a60ecd15 Add release note for #1619 2020-08-05 16:02:38 +02:00
Michał Kępień bc212cf163 Tweak and reword release notes 2020-08-05 16:02:38 +02:00
Michał Kępień 76421c885e Tweak and reword recent CHANGES entries 2020-08-05 16:02:38 +02:00
Michał Kępień 18b71e9c25 Merge branch '2055-grant-subdomain-fix' into 'security-main'
[CVE-2020-8624] Fix processing of "update-policy" rules of type "subdomain"

See merge request isc-private/bind9!189
2020-08-05 13:57:57 +00:00
Mark AndrewsandMichał Kępień 4fb94906fa Add CHANGES and release note for GL #2055 2020-08-05 15:54:50 +02:00
Mark AndrewsandMichał Kępień 94bc07cf05 Add a test for update-policy 'zonesub'
The new test checks that 'update-policy zonesub' is properly enforced.
2020-08-05 15:54:50 +02:00
Mark AndrewsandMichał Kępień 9b242cc707 Add a test for update-policy 'subdomain'
The new test checks that 'update-policy subdomain' is properly enforced.
2020-08-05 15:54:50 +02:00
Mark AndrewsandMichał Kępień 952955aa4c Update-policy 'subdomain' was incorrectly treated as 'zonesub'
resulting in names outside the specified subdomain having the wrong
restrictions for the given key.
2020-08-05 15:54:50 +02:00
Michał Kępień 10954a11de Merge branch '2037-confidential-issue' into 'security-main'
[CVE-2020-8623]: Fix crash in pk11_numbits() with crafted packet when native-pkcs11 is used

See merge request isc-private/bind9!187
2020-08-05 13:54:14 +00:00
Ondřej SurýandMichał Kępień aaeea046ed Add CHANGES and release note for GL #2037 2020-08-05 15:51:29 +02:00
Ondřej SurýandMichał Kępień 52733368fd Don't strip the SOFTHSM2_CONF and SLOT environment variables when using ./run.sh 2020-08-05 15:51:29 +02:00
Ondřej SurýandMichał Kępień 6b7629f323 Fix crash in pk11_numbits() when native-pkcs11 is used
When pk11_numbits() is passed a user provided input that contains all
zeroes (via crafted DNS message), it would crash with assertion
failure.  Fix that by properly handling such input.
2020-08-05 15:51:29 +02:00
Michał Kępień aa863855f5 Merge branch '2028-unexpectedend-and-tsig' into 'security-main'
[CVE-2020-8622] Properly handle malformed truncated responses to TSIG queries

See merge request isc-private/bind9!185
2020-08-05 13:50:27 +00:00
Mark AndrewsandMichał Kępień e576baad9d Add CHANGES and release notes for GL #2028 2020-08-05 15:47:14 +02:00
Mark AndrewsandMichał Kępień 70a71de9c9 Always keep a copy of the message
this allows it to be available even when dns_message_parse()
returns a error.
2020-08-05 15:47:14 +02:00
Michał Kępień 57fbc57b2e Merge branch '1997-confidential-issue' into 'security-main'
[CVE-2020-8621] Ensure QNAME minimization is permanently disabled when forwarding

See merge request isc-private/bind9!184
2020-08-05 13:46:23 +00:00
Evan HuntandMichał Kępień a3e42f8599 Add CHANGES and release note for GL #1997 2020-08-05 15:43:52 +02:00
Evan HuntandMichał Kępień 51c9ea98a3 permanently disable QNAME minimization in a fetch when forwarding
QNAME minimization is normally disabled when forwarding. if, in the
course of processing a fetch, we switch back to normal recursion at
some point, we can't safely start minimizing because we may have
been left in an inconsistent state.
2020-08-05 15:43:52 +02:00
Michał Kępień c6a08a727d Merge branch '1996-confidential-issue' into 'security-main'
[CVE-2020-8620] Fix TCP DNS buffer sizes

See merge request isc-private/bind9!181
2020-08-05 13:31:59 +00:00
Ondřej SurýandMichał Kępień f2b41e11b4 Add CHANGES and release note for GL #1996 2020-08-05 12:57:23 +02:00
Evan HuntandMichał Kępień 38264b6a4d Use different allocators for UDP and TCP
Each worker has a receive buffer with space for 20 DNS messages of up
to 2^16 bytes each, and the allocator function passed to uv_read_start()
or uv_udp_recv_start() will reserve a portion of it for use by sockets.
UDP can use recvmmsg() and so it needs that entire space, but TCP reads
one message at a time.

This commit introduces separate allocator functions for TCP and UDP
setting different buffer size limits, so that libuv will provide the
correct buffer sizes to each of them.
2020-08-05 12:57:23 +02:00
Michał Kępień f0fa6f0245 Merge branch 'michal/remove-arm64-jobs-from-gitlab-ci' into 'main'
Remove arm64 jobs from GitLab CI

See merge request isc-projects/bind9!3920
2020-08-05 10:07:20 +00:00
Michał Kępień 49f245f7c0 Remove arm64 jobs from GitLab CI
The only arm64 runner we have at our disposal is suffering from
intermittent connectivity issues which make it unusable for extended
periods of time.  Remove arm64 jobs from GitLab CI until we manage to
set up an arm64 runner with more reliable connectivity.
2020-08-05 12:04:59 +02:00
Michał Kępień 72786a27c7 Merge branch '2065-set-max-cache-size-in-the-geoip2-system-test' into 'main'
Set "max-cache-size" in the "geoip2" system test

Closes #2065

See merge request isc-projects/bind9!3919
2020-08-05 09:07:52 +00:00
Michał Kępień 4292d5bdfe Set "max-cache-size" in the "geoip2" system test
The named configuration files used in the "geoip2" system test cause a
rather large number of views (6-8) to be set up in each tested named
instance.  Each view has its own cache.

Commit e24bc324b4 caused the RBT hash
table to be pre-allocated to a size derived from "max-cache-size", so
that it never needs to be rehashed.  The size of that hash table is not
expected to be significant enough to cause memory use issues in typical
conditions even for large "max-cache-size" settings.

However, these two factors combined can cause memory exhaustion issues
in GitLab CI, where we run multiple "instances" of the test suite in
parallel on the same runner, each test suite executes multiple system
tests concurrently, and each system test may potentially start multiple
named instances at the same time.  In practice, this problem currently
only seems to be affecting the "geoip2" system test, which is failing
intermittently due to named instances used by that test getting killed
by oom-killer.

Prevent the "geoip2" system test from failing intermittently by setting
"max-cache-size" in named configuration files used in that test to a low
value in order to keep memory usage at bay even with a large number of
views configured.
2020-08-05 10:38:06 +02:00
Michał Kępień 550b82e27b Merge branch '2030-bind-arm-incorrectly-documents-the-processing-of-forwarders-still-has-the-pre-9-3-0-explanation' into 'main'
Resolve "BIND ARM incorrectly documents the processing of forwarders (still has the pre 9.3.0 explanation)"

Closes #2030

See merge request isc-projects/bind9!3881
2020-08-04 19:44:27 +00:00
Suzanne GoldlustandMichał Kępień 30e126ad02 Update description of forwarding behavior in ARM 2020-08-04 21:39:31 +02:00
Michał Kępień 500527b4da Merge branch 'michal/add-placeholder-for-1475' into 'main'
Add placeholder for #1475

See merge request isc-projects/bind9!3916
2020-08-04 13:49:37 +00:00
Michał Kępień 232297142d Add placeholder for #1475 2020-08-04 15:46:34 +02:00
Mark Andrews dc8fe44224 Merge branch 'marka-DNS_R_BADTSIG-map-to-FORMERR' into 'main'
Map DNS_R_BADTSIG to FORMERR

See merge request isc-projects/bind9!3877
2020-08-04 13:02:24 +00:00
Mark Andrews 88ff6b846c Check rcode is FORMERR 2020-08-04 12:20:37 +00:00
Mark Andrews 20488d6ad3 Map DNS_R_BADTSIG to FORMERR
Now that the log message has been printed set the result code to
DNS_R_FORMERR.  We don't do this via dns_result_torcode() as we
don't want upstream errors to produce FORMERR if that processing
end with DNS_R_BADTSIG.
2020-08-04 12:20:37 +00:00
Matthijs Mekking bf760383e8 Merge branch 'ondrej/serve-stale-improvements' into 'main'
Serve-stale improvements

Closes #1712 and #1829

See merge request isc-projects/bind9!3872
2020-08-04 12:17:57 +00:00
Ondřej SurýandMatthijs Mekking dd62275152 Add CHANGES and release notes for GL #1712 and GL #1829 2020-08-04 10:51:09 +02:00
Ondřej SurýandMatthijs Mekking abc2ab9223 Add tests with stale-cache-disabled into serve-stale system test
Add a fifth named (ns5) that runs with `stale-cache-enable no;` and
check that there are no stale records in the cache.
2020-08-04 10:50:31 +02:00
Ondřej SurýandMatthijs Mekking 6ffa2ddae0 Expire the 0 TTL RRSet quickly rather using them for serve-stale
When a received RRSet has TTL 0, they would be preserved for
serve-stale (default `max-stale-cache` is 12 hours) rather than expiring
them quickly from the cache database.

This commit makes sure the RRSet didn't have TTL 0 before marking the
entry in the database as "stale".
2020-08-04 10:50:31 +02:00
Ondřej SurýandMatthijs Mekking ce53db34d6 Add stale-cache-enable option and disable serve-stable by default
The current serve-stale implementation in BIND 9 stores all received
records in the cache for a max-stale-ttl interval (default 12 hours).

This allows DNS operators to turn the serve-stale answers in an event of
large authoritative DNS outage.  The caching of the stale answers needs
to be enabled before the outage happens or the feature would be
otherwise useless.

The negative consequence of the default setting is the inevitable
cache-bloat that happens for every and each DNS operator running named.

In this MR, a new configuration option `stale-cache-enable` is
introduced that allows the operators to selectively enable or disable
the serve-stale feature of BIND 9 based on their decision.

The newly introduced option has been disabled by default,
e.g. serve-stale is disabled in the default configuration and has to be
enabled if required.
2020-08-04 10:50:31 +02:00
Mark Andrews f2040a0039 Merge branch '2026-readme-md-typo' into 'main'
Resolve "README.md -- typo"

Closes #2026

See merge request isc-projects/bind9!3912
2020-08-04 02:23:54 +00:00
Mark Andrews 532bf267af Fixup typo in 'xcode-select --install' 2020-08-04 12:19:15 +10:00
Michał Kępień 4b6113379a Merge branch 'michal/restore-placeholder-entry-at-sequence-number-5481' into 'main'
Restore placeholder entry at sequence number 5481

See merge request isc-projects/bind9!3910
2020-08-03 20:13:12 +00:00
Michał Kępień 029e32c01a Restore placeholder entry at sequence number 5481 2020-08-03 22:09:47 +02:00
Ondřej Surý 0c85c4c424 Merge branch 'ondrej/add-isc_lex-fuzzing-test' into 'main'
Re-enable tests in fuzz directory and add isc_lex_gettoken() and isc_lex_getmastertoken() tests

See merge request isc-projects/bind9!3908
2020-07-31 15:55:58 +00:00
Ondřej SurýandOndřej Surý ba99bdbf6f Add fuzzing for the isc_lex (isc_lex_gettoken,isc_lex_getmastertoken) API
In this commit, the simple fuzzing tests for the isc_lex_gettoken() and
isc_lex_getmastertoken() functions have been added.

As part of this commit, the initialization has been moved from fuzz.h
constructor/destructor to LLVMFuzzerInitialize() in each fuzz test.  The
main.c of no-fuzzing and AFL modes have been modified to run the
LLVMFuzzerInitialize() at the start of the main() function mimicking
the libfuzzer mode of operation.
2020-07-31 17:28:35 +02:00
Ondřej Surý 23b1caabae Re-enable the fuzzing tests
The fuzzing tests were temporarily disabled when the build system has been
converted to automake.  This commit restores the functionality to run the
fuzzing tests as part of the `make check`.  When the afl or libfuzzer
is enabled via ./configure, it uses a custom LOG_DRIVER (fuzz/<fuzzer.sh>).

Currently only libfuzzer.sh has been implemented that runs each fuzz
test for 5 seconds each.
2020-07-31 17:28:35 +02:00
Ondřej Surý 8acdccc955 Merge branch '2038-use-freebind-when-bind-fails' into 'main'
Resolve "Bind not handling interfaces changes correctly when listen-on-v6  any  specified"

Closes #2038

See merge request isc-projects/bind9!3873
2020-07-31 11:32:40 +00:00
Witold KręcickiandOndřej Surý 94eda43ab2 Add CHANGES and release note for GL #2038 2020-07-31 12:44:22 +02:00
Witold KręcickiandOndřej Surý a0f7d28967 netmgr: retry binding with IP_FREEBIND when EADDRNOTAVAIL is returned.
When a new IPv6 interface/address appears it's first in a tentative
state - in which we cannot bind to it, yet it's already being reported
by the route socket. Because of that BIND9 is unable to listen on any
newly detected IPv6 addresses. Fix it by setting IP_FREEBIND option (or
equivalent option on other OSes) and then retrying bind() call.
2020-07-31 12:44:22 +02:00
Ondřej Surý 2ac7748d2b Merge branch 'ondrej/remove-distros-near-eol' into 'main'
Remove CentOS 6 from GitLab CI, it will EOL before BIND 9.18 is released

See merge request isc-projects/bind9!3799
2020-07-31 10:27:03 +00:00
Ondřej Surý db1b344020 Remove CentOS 6 from GitLab CI
CentOS 6 will reach EoL on November 30th, 2020, i.e. before BIND 9.18
will be released.  Remove it from GitLab CI.
2020-07-31 12:09:17 +02:00
Ondřej Surý fcdf0d3bc3 Merge branch 'ondrej/documentation-rebuild' into 'main'
Rebuild the documentation

See merge request isc-projects/bind9!3905
2020-07-31 08:52:28 +00:00
Ondřej Surý 4a8670ddaf Rebuild the documentation 2020-07-31 10:02:23 +02:00
Ondřej Surý 12c9a767eb Merge branch 'ondrej/august-release-placeholders-1' into 'main'
Add placeholders for August release

See merge request isc-projects/bind9!3903
2020-07-31 07:28:38 +00:00
Ondřej Surý 852c5cde5a Add CHANGES placeholder for [GL #2055] 2020-07-31 09:27:00 +02:00
Ondřej Surý c50fb6f30d Add CHANGES placeholder for [GL #1997] 2020-07-31 09:24:56 +02:00
Ondřej Surý 107e6997fb Add CHANGES placeholder for [GL #1996] 2020-07-31 09:23:52 +02:00
Ondřej Surý ec4883ff52 Add CHANGES placeholder for [GL #2037] 2020-07-31 09:21:32 +02:00
Mark Andrews 649cb54400 Merge branch '2020-configure-call-needs-to-be-cleaned-up-main-gcc-centos6-amd64' into 'main'
Resolve "configure call needs to be cleaned up main: gcc:centos6:amd64"

Closes #2020

See merge request isc-projects/bind9!3853
2020-07-31 06:26:11 +00:00
Mark Andrews 305ca032a0 remove --with-python from summary 2020-07-31 05:21:40 +00:00
Mark Andrews 355b7899ee remove references to --with-libtool 2020-07-31 05:21:40 +00:00
Mark Andrews 11207eacd5 Remove --with-libtool comment from README 2020-07-31 05:21:40 +00:00
Mark Andrews 2cd8fc02b0 Remove no longer valid configure flags from configure calls:
--with-libtool, --without-make-clean, --with-python
2020-07-31 05:21:40 +00:00
Mark Andrews 9b0b045554 Merge branch '1456-always-check-return-from-isc_refcount_decrement' into 'main'
Resolve "always check return from isc_refcount_decrement"

Closes #1456

See merge request isc-projects/bind9!2707
2020-07-31 00:56:45 +00:00
Mark Andrews bde5c7632a Always check the return from isc_refcount_decrement.
Created isc_refcount_decrement_expect macro to test conditionally
the return value to ensure it is in expected range.  Converted
unchecked isc_refcount_decrement to use isc_refcount_decrement_expect.
Converted INSIST(isc_refcount_decrement()...) to isc_refcount_decrement_expect.
2020-07-31 10:15:44 +10:00
Mark Andrews 92059fc7db Merge branch '2033-rndc-dnstap-roll-fix-was-incomplete' into 'main'
Resolve "'rndc dnstap --roll' fix was incomplete"

Closes #2033

See merge request isc-projects/bind9!3868
2020-07-30 23:59:42 +00:00
Mark Andrews aca18b8b5b Refactor the code that counts the last log version to keep
When silencing the Coverity warning in remove_old_tsversions(), the code
was refactored to reduce the indentation levels and break down the long
code into individual functions.  This improve fix for [GL #1989].
2020-07-31 09:30:12 +10:00
Michal Nowak d9f862337a Merge branch '48-drop-systemtesttop-from-bin-tests-system' into 'main'
Drop $SYSTEMTESTTOP from bin/tests/system/

Closes #48

See merge request isc-projects/bind9!3623
2020-07-30 14:14:39 +00:00
Michal Nowak 954731cfa3 Make sure we don't introduce SYSTEMTESTTOP anymore
':!.gitlab-ci.yml' is a pathspec pattern used to limit paths in the "git
grep" command to all but the .gitlab-ci.yml file which includes the
checked word itself. This requires Git 2.13.
2020-07-30 15:58:54 +02:00
Michal Nowak a3b02d627f Remove cross-test dependency on ckdnsrps.sh 2020-07-30 15:58:54 +02:00
Michal Nowak 68488dd98c Fix name of the test directory of stop.pl in masterformat test 2020-07-30 15:58:54 +02:00
Michal Nowak 32ee08e21a Ensure test fails if packet.pl does not work as expected 2020-07-30 15:58:54 +02:00
Michal Nowak 14bc22d7a4 Source config.guess from source root
It seems that config.guess gets always created in source root, so for
that sake of out-of-tree system test, we should expect the file there
instead of where configure was run.
2020-07-30 15:58:53 +02:00
Michal Nowak 093af1c00a Drop $SYSTEMTESTTOP from bin/tests/system/
The $SYSTEMTESTTOP shell variable if often set to .. in various shell
scripts inside bin/tests/system/, but most of the time it is only
used one line later, while sourcing conf.sh. This hardly improves
code readability.

$SYSTEMTESTTOP is also used for the purpose of referencing
scripts/files living in bin/tests/system/, but given that the
variable is always set to a short, relative path, we can drop it and
replace all of its occurrences with the relative path without adversely
affecting code readability.
2020-07-30 15:58:50 +02:00
Michał Kępień 6237be992f Merge branch 'michal/only-run-system-tests-as-root-in-developer-mode' into 'main'
Only run system tests as root in developer mode

See merge request isc-projects/bind9!3894
2020-07-30 13:45:00 +00:00
Michał Kępień 3ef106f69d Only run system tests as root in developer mode
Running system tests with root privileges is potentially dangerous.
Only allow it when explicitly requested (by building with
--enable-developer).
2020-07-30 14:07:49 +02:00
Michał Kępień 1ce582ca47 Merge branch '2024-fix-idle-timeout-for-connected-tcp-sockets' into 'main'
Fix idle timeout for connected TCP sockets

Closes #2024

See merge request isc-projects/bind9!3854
2020-07-30 09:32:07 +00:00
Michał Kępień 18efb2456f Add CHANGES for GL #2024 2020-07-30 10:58:39 +02:00
Michał Kępień 953d704bd2 Fix idle timeout for connected TCP sockets
When named acting as a resolver connects to an authoritative server over
TCP, it sets the idle timeout for that connection to 20 seconds.  This
fixed timeout was picked back when the default processing timeout for
each client query was hardcoded to 30 seconds.  Commit
000a8970f8 made this processing timeout
configurable through "resolver-query-timeout" and decreased its default
value to 10 seconds, but the idle TCP timeout was not adjusted to
reflect that change.  As a result, with the current defaults in effect,
a single hung TCP connection will consistently cause the resolution
process for a given query to time out.

Set the idle timeout for connected TCP sockets to half of the client
query processing timeout configured for a resolver.  This allows named
to handle hung TCP connections more robustly and prevents the timeout
mismatch issue from resurfacing in the future if the default is ever
changed again.
2020-07-30 10:58:39 +02:00
Mark Andrews e7771dc902 Merge branch 'marka-placeholder' into 'main'
placeholder for [GL #2028]

See merge request isc-projects/bind9!3893
2020-07-29 23:39:16 +00:00
Mark Andrews 8e142e6e80 placeholder for [GL #2028] 2020-07-30 09:34:58 +10:00
Evan Hunt c99381ce20 Merge branch '2050-libuv-version' into 'main'
report libuv version string in `named -V`

Closes #2050

See merge request isc-projects/bind9!3887
2020-07-28 02:49:19 +00:00
Evan Hunt 1036338a10 report libuv version string in named -V 2020-07-28 02:41:39 +00:00
Evan Hunt 730226b674 Merge branch '2031-win32-fix' into 'main'
Resolve "Windows crashes with netmgr-based statschannel"

Closes #2031

See merge request isc-projects/bind9!3888
2020-07-27 21:33:07 +00:00
Evan Hunt 881b635141 initialize, rather than invalidating, new http buffers
when building without ISC_BUFFER_USEINLINE (which is the default on
Windows) an assertion failure could occur when setting up a new
isc_httpd_t object for the statistics channel.
2020-07-27 14:29:37 -07:00
Diego dos Santos Fronza 83b50bb901 Merge branch '1619-rpz-wildcard-passthru-ignored' into 'main'
Resolve "RPZ wildcard passthru ignored"

Closes #1619

See merge request isc-projects/bind9!3682
2020-07-27 14:34:08 +00:00
Diego FronzaandEvan Hunt ad6f65649a Add CHANGES entry 2020-07-24 11:48:14 -07:00
Diego FronzaandEvan Hunt c5a4bc8bcc Add test for RPZ wildcard passthru ignored fix 2020-07-24 11:48:14 -07:00
Diego FronzaandEvan Hunt c2928c2ed4 Fix rpz wildcard name matching
Whenever an exact match is found by dns_rbt_findnode(),
the highest level node in the chain will not be put into
chain->levels[] array, but instead the chain->end
pointer will be adjusted to point to that node.

Suppose we have the following entries in a rpz zone:
example.com     CNAME rpz-passthru.
*.example.com   CNAME rpz-passthru.

A query for www.example.com would result in the
following chain object returned by dns_rbt_findnode():

chain->level_count = 2
chain->level_matches = 2
chain->levels[0] = .
chain->levels[1] = example.com
chain->levels[2] = NULL
chain->end = www

Since exact matches only care for testing rpz set bits,
we need to test for rpz wild bits through iterating the nodechain, and
that includes testing the rpz wild bits in the highest level node found.

In the case of an exact match, chain->levels[chain->level_matches]
will be NULL, to address that we must use chain->end as the start point,
then iterate over the remaining levels in the chain.
2020-07-24 11:34:40 -07:00
Michal Nowak 5ab7d1c920 Merge branch '1999-add-a-regular-make-dist-job-to-ci' into 'main'
Add a regular "make dist" job to CI

Closes #1999

See merge request isc-projects/bind9!3803
2020-07-24 13:53:54 +00:00
Michal Nowak 654c64c60b Add a regular "make dist" job to CI
It's easy to break "make dist" by adding and moving files around.
We should test this scenario regularly, to prevent release-time
surprises.
2020-07-24 15:27:25 +02:00
Mark Andrews a14445d472 Merge branch '2043-dns_rdata_hip_next-fails-to-return-isc_r_nomore-at-the-right-time' into 'main'
Resolve "dns_rdata_hip_next() fails to return ISC_R_NOMORE at the right time."

Closes #2043

See merge request isc-projects/bind9!3880
2020-07-24 05:19:45 +00:00
Mark Andrews bcd049f116 Add CHANGES note 2020-07-24 04:15:56 +00:00
Mark Andrews 78db46d746 Check walking the hip rendezvous servers.
Also fixes extraneous white space at end of record when
there are no rendezvous servers.
2020-07-24 04:15:56 +00:00
Mark Andrews e31bcac441 Merge branch 'marka-add-fallthrough' into 'main'
Add fallthrough and braces

See merge request isc-projects/bind9!3884
2020-07-24 04:15:03 +00:00
Mark Andrews 70c060120f Add fallthrough and braces 2020-07-24 13:49:56 +10:00
Mark Andrews 1ba814a28c Merge branch 'feature/master/unix-cleanup' into 'main'
Remove few lines in unix socket handling

See merge request isc-projects/bind9!2687
2020-07-24 03:02:07 +00:00
Petr MenšíkandMark Andrews 72d81c4768 Remove few lines in unix socket handling
Reuse the same checks two times, make difference minimal.
2020-07-24 12:59:38 +10:00
Mark Andrews cc1b77a0c7 Merge branch 'dstlib-failure-abort' into 'main'
Prevent crash on dst initialization failure

See merge request isc-projects/bind9!3876
2020-07-23 00:46:12 +00:00
Petr MenšíkandMark Andrews c5e7152cf0 Prevent crash on dst initialization failure
server might be created, but not yet fully initialized, when fatal
function is called. Check both server and task before attaching
exclusive task.
2020-07-23 00:31:52 +00:00
Michal Nowak 064e314df7 Merge branch '1727-drop-use-of-featuretest-have-dlopen' into 'main'
Drop feature test for dlopen()

Closes #1727

See merge request isc-projects/bind9!3625
2020-07-21 09:24:38 +00:00
Michal Nowak 2064e01cd0 Drop feature test for dlopen()
With libtool being mandatory from 9.17 on, so is dlopen() (via libltdl).
2020-07-21 11:22:13 +02:00
Ondřej Surý 451ed397f0 Merge branch '1775-resizing-growing-of-cache-hash-tables-causes-delays-in-processing-of-client-queries' into 'main'
Fix the rbt hashtable and grow it when setting max-cache-size

Closes #1775

See merge request isc-projects/bind9!3865
2020-07-21 08:38:26 +00:00
Ondřej Surý 2b4f0f03f5 Add CHANGES and release note for #1775 2020-07-21 08:44:26 +02:00
Ondřej Surý a9182c89a6 Change the dns_name hashing to use 32-bit values
Change the dns_hash_name() and dns_hash_fullname() functions to use
isc_hash32() as the maximum hashtable size in rbt is 0..UINT32_MAX
large.
2020-07-21 08:44:26 +02:00
Ondřej Surý f59fd49fd8 Add isc_hash32() and rename isc_hash_function() to isc_hash64()
As the names suggest the original isc_hash64 function returns 64-bit
long hash values and the isc_hash32() returns 32-bit values.
2020-07-21 08:44:26 +02:00
Ondřej Surý 344d66aaff Add HalfSipHash 2-4 reference implementation
The HalfSipHash implementation has 32-bit keys and returns 32-bit
value.
2020-07-21 08:44:26 +02:00
Ondřej Surý 21d751dfc7 Remove OpenSSL based SipHash 2-4 implementation
Creation of EVP_MD_CTX and EVP_PKEY is quite expensive, so until we fix the code
to reuse the OpenSSL contexts and keys we'll use our own implementation of
siphash instead of trying to integrate with OpenSSL.
2020-07-21 08:44:26 +02:00
Ondřej Surý e24bc324b4 Fix the rbt hashtable and grow it when setting max-cache-size
There were several problems with rbt hashtable implementation:

1. Our internal hashing function returns uint64_t value, but it was
   silently truncated to unsigned int in dns_name_hash() and
   dns_name_fullhash() functions.  As the SipHash 2-4 higher bits are
   more random, we need to use the upper half of the return value.

2. The hashtable implementation in rbt.c was using modulo to pick the
   slot number for the hash table.  This has several problems because
   modulo is: a) slow, b) oblivious to patterns in the input data.  This
   could lead to very uneven distribution of the hashed data in the
   hashtable.  Combined with the single-linked lists we use, it could
   really hog-down the lookup and removal of the nodes from the rbt
   tree[a].  The Fibonacci Hashing is much better fit for the hashtable
   function here.  For longer description, read "Fibonacci Hashing: The
   Optimization that the World Forgot"[b] or just look at the Linux
   kernel.  Also this will make Diego very happy :).

3. The hashtable would rehash every time the number of nodes in the rbt
   tree would exceed 3 * (hashtable size).  The overcommit will make the
   uneven distribution in the hashtable even worse, but the main problem
   lies in the rehashing - every time the database grows beyond the
   limit, each subsequent rehashing will be much slower.  The mitigation
   here is letting the rbt know how big the cache can grown and
   pre-allocate the hashtable to be big enough to actually never need to
   rehash.  This will consume more memory at the start, but since the
   size of the hashtable is capped to `1 << 32` (e.g. 4 mio entries), it
   will only consume maximum of 32GB of memory for hashtable in the
   worst case (and max-cache-size would need to be set to more than
   4TB).  Calling the dns_db_adjusthashsize() will also cap the maximum
   size of the hashtable to the pre-computed number of bits, so it won't
   try to consume more gigabytes of memory than available for the
   database.

   FIXME: What is the average size of the rbt node that gets hashed?  I
   chose the pagesize (4k) as initial value to precompute the size of
   the hashtable, but the value is based on feeling and not any real
   data.

For future work, there are more places where we use result of the hash
value modulo some small number and that would benefit from Fibonacci
Hashing to get better distribution.

Notes:
a. A doubly linked list should be used here to speedup the removal of
   the entries from the hashtable.
b. https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/
2020-07-21 08:44:26 +02:00
Michal Nowak 9dcf229634 Merge branch 'mnowak/try-harder-to-analyze-cores' into 'main'
Rationalize backtrace logging, fail on core file presence

See merge request isc-projects/bind9!3867
2020-07-20 08:13:37 +00:00
Michal NowakandMichał Kępień 1b13123c45 Check tests for core files regardless of test status
Failed test should be checked for core files et al. and have
backtrace generated.
2020-07-17 10:04:59 +02:00
Michal NowakandMichał Kępień 05c13e50d3 Rationalize backtrace logging
GDB backtrace generated via "thread apply all bt full" is too long for
standard output, lets save them to .txt file among other log files.
2020-07-17 10:04:04 +02:00
Michal NowakandMichał Kępień b232e8585a Ensure various test issues are treated as failures
Make sure bin/tests/system/run.sh returns a non-zero exit code if any of
the following happens:

  - the test being run produces a core dump,
  - assertion failures are found in the test's logs,
  - ThreadSanitizer reports are found after the test completes,
  - the servers started by the test fail to shut down cleanly.

This change is necessary to always fail a test in such cases (before the
migration to Automake, test failures were determined based on the
presence of "R:<test-name>:FAIL" lines in the test suite output and thus
it was not necessary for bin/tests/system/run.sh to return a non-zero
exit code).
2020-07-17 10:00:21 +02:00
Michał Kępień f27c0c3257 Merge branch 'michal/update-release-checklist' into 'main'
Update release checklist

See merge request isc-projects/bind9!3864
2020-07-16 09:31:09 +00:00
Michał Kępień 4fa2dfe72e Update release checklist
Add an item to the release checklist to make sure confidential issues
assigned to the relevant milestone are made public after the BIND
versions addressing them are released.
2020-07-16 11:28:09 +02:00
Evan Hunt b4cdd00fa3 Merge branch '2022-stats-netmgr' into 'main'
Resolve "use netmgr for statschannel"

Closes #2022

See merge request isc-projects/bind9!3847
2020-07-16 06:04:21 +00:00
Evan Hunt efa5639934 CHANGES, release note 2020-07-15 22:35:07 -07:00
Evan Hunt 69c1ee1ce9 rewrite statschannel to use netmgr
modify isc_httpd to use the network manager instead of the
isc_socket API.

also cleaned up bin/named/statschannel.c to use CHECK.
2020-07-15 22:35:07 -07:00
Michał Kępień d8e6b32a18 Merge branch 'v9_17_3-release' into 'main'
Merge 9.17.3 release branch

See merge request isc-projects/bind9!3860
2020-07-15 21:09:46 +00:00
Michał Kępień 2b2e97a815 Set up release notes for BIND 9.17.4 2020-07-15 23:06:25 +02:00
Michał Kępień 02de51d957 Bump BIND_BASELINE_VERSION for ABI checks 2020-07-15 23:06:25 +02:00
Michał Kępień 49c62f3e8e Fix "make dist" 2020-07-15 22:54:13 +02:00
Michał Kępień fc6d0a932b Update BIND version to 9.17.3 2020-07-15 22:54:13 +02:00
Michał Kępień 28d32ca7da Add a CHANGES marker 2020-07-15 22:54:13 +02:00
Michał Kępień 97a2733ef9 Update library API versions 2020-07-15 22:54:13 +02:00
Michał Kępień 3e74f894d4 Merge branch 'michal/prepare-release-notes-for-bind-9.17.3' into v9_17_3-release 2020-07-15 22:51:33 +02:00
Michał Kępień fba5ce8a75 Reorder release notes 2020-07-15 22:51:33 +02:00
Michał Kępień af35a186d0 Add release note for #1958 2020-07-15 22:51:33 +02:00
Michał Kępień eedbd6ecf5 Add release note for #1938 2020-07-15 22:51:33 +02:00
Michał Kępień 41a79d068c Add release note for #1937 2020-07-15 22:51:33 +02:00
Michał Kępień e9a869f51e Tweak and reword release notes 2020-07-15 22:51:33 +02:00
Michał Kępień aa1d6a46ab Prepare release notes for BIND 9.17.3 2020-07-15 22:51:32 +02:00
Michał Kępień 267794244f Tweak and reword recent CHANGES entries 2020-07-15 22:50:16 +02:00
Matthijs Mekking f8ef2c0439 Merge branch '2006-coverity-checked-return-keymgr' into 'main'
Fix Coverity keymgr reports

Closes #2006

See merge request isc-projects/bind9!3808
2020-07-14 15:46:56 +00:00
Matthijs Mekking e645d2ef1e Check return value of dst_key_getbool()
Fix Coverity CHECKED_RETURN reports for dst_key_getbool().  In most
cases we do not really care about its return value, but it is prudent
to check it.

In one case, where a dst_key_getbool() error should be treated
identically as success, cast the return value to void and add a relevant
comment.
2020-07-14 12:53:54 +00:00
Michał Kępień df72c52239 Merge branch 'michal/use-image-key-in-qemu-based-ci-job-templates' into 'main'
Use "image" key in QEMU-based CI job templates

See merge request isc-projects/bind9!3855
2020-07-14 08:24:42 +00:00
Michał Kępień 72201badf0 Use "image" key in QEMU-based CI job templates
Our GitLab Runner Custom executor scripts now use the "image" key
instead of the job name for determining the QCOW2 image to use for a
given CI job.  Update .gitlab-ci.yml to reflect that change.
2020-07-14 09:58:04 +02:00
Mark Andrews c53bfb30e8 Merge branch 'u/fanf2/fix-signing' into 'main'
Fix re-signing when `sig-validity-interval` has two arguments

See merge request isc-projects/bind9!3735
2020-07-14 02:07:28 +00:00
Mark Andrews 3ff60b881f Add release note for [GL !3735] 2020-07-14 10:59:59 +10:00
Mark Andrews f4fbca6e16 Add CHANGES note for [GL !3735] 2020-07-14 10:59:59 +10:00
Mark Andrews 11ecf7901b Add regression test for [GL !3735]
Check that resign interval is actually in days rather than hours
by checking that RRSIGs are all within the allowed day range.
2020-07-14 10:59:59 +10:00
Tony FinchandMark Andrews 030674b2a3 Fix re-signing when sig-validity-interval has two arguments
Since October 2019 I have had complaints from `dnssec-cds` reporting
that the signatures on some of my test zones had expired. These were
zones signed by BIND 9.15 or 9.17, with a DNSKEY TTL of 24h and
`sig-validity-interval 10 8`.

This is the same setup we have used for our production zones since
2015, which is intended to re-sign the zones every 2 days, keeping
at least 8 days signature validity. The SOA expire interval is 7
days, so even in the presence of zone transfer problems, no-one
should ever see expired signatures. (These timers are a bit too
tight to be completely correct, because I should have increased
the expiry timers when I increased the DNSKEY TTLs from 1h to 24h.
But that should only matter when zone transfers are broken, which
was not the case for the error reports that led to this patch.)

For example, this morning my test zone contained:

        dev.dns.cam.ac.uk. 86400 IN RRSIG DNSKEY 13 5 86400 (
                                20200701221418 20200621213022 ...)

But one of my resolvers had cached:

        dev.dns.cam.ac.uk. 21424 IN RRSIG DNSKEY 13 5 86400 (
                                20200622063022 20200612061136 ...)

This TTL was captured at 20200622105807 so the resolver cached the
RRset 64976 seconds previously (18h02m56s), at 20200621165511
only about 12h before expiry.

The other symptom of this error was incorrect `resign` times in
the output from `rndc zonestatus`.

For example, I have configured a test zone

        zone fast.dotat.at {
                file "../u/z/fast.dotat.at";
                type primary;
                auto-dnssec maintain;
                sig-validity-interval 500 499;
        };

The zone is reset to a minimal zone containing only SOA and NS
records, and when `named` starts it loads and signs the zone. After
that, `rndc zonestatus` reports:

        next resign node: fast.dotat.at/NS
        next resign time: Fri, 28 May 2021 12:48:47 GMT

The resign time should be within the next 24h, but instead it is
near the signature expiry time, which the RRSIG(NS) says is
20210618074847. (Note 499 hours is a bit more than 20 days.)
May/June 2021 is less than 500 days from now because expiry time
jitter is applied to the NS records.

Using this test I bisected this bug to 09990672d which contained a
mistake leading to the resigning interval always being calculated in
hours, when days are expected.

This bug only occurs for configurations that use the two-argument form
of `sig-validity-interval`.
2020-07-14 10:57:43 +10:00
Mark Andrews 2ac2d83265 Merge branch '1994-netscope-c-23-50-error-unused-parameter-addr-when-have_if_nametoindex-undefined-on-illumos' into 'main'
Resolve "netscope.c:23:50: error: unused parameter 'addr' when HAVE_IF_NAMETOINDEX undefined on illumos"

Closes #1994

See merge request isc-projects/bind9!3829
2020-07-14 00:51:22 +00:00
Mark Andrews e7662c4c63 Mark 'addr' as unused if HAVE_IF_NAMETOINDEX is not defined
Also 'zone' should be initialised to zero.
2020-07-14 00:13:40 +00:00
Mark Andrews 1a1e52b7fe Merge branch '1995-gssapictx-c-681-10-error-implicit-declaration-of-function-gsskrb5_register_acceptor_identity' into 'main'
Resolve "gssapictx.c:681:10: error: implicit declaration of function 'gsskrb5_register_acceptor_identity' on illumos"

Closes #1995

See merge request isc-projects/bind9!3830
2020-07-14 00:05:39 +00:00
Mark Andrews 488eef63ca Only call gsskrb5_register_acceptor_identity if we have gssapi_krb5.h. 2020-07-14 08:55:13 +10:00
Mark Andrews 35ea733e2c Merge branch '1993-check-c-1576-37-error-expected-identifier-before-numeric-constant-on-illumos' into 'main'
Resolve "check.c:1576:37: error: expected identifier before numeric constant on illumos"

Closes #1993

See merge request isc-projects/bind9!3828
2020-07-13 22:06:48 +00:00
Mark Andrews 18eef20241 Handle namespace clash over 'SEC' on illumos. 2020-07-14 07:46:10 +10:00
Mark Andrews bc5bd577d7 Merge branch '2005-coverity-is-reporting-double-unlock' into 'main'
Resolve "Coverity is reporting double unlock."

Closes #2005

See merge request isc-projects/bind9!3807
2020-07-13 21:28:10 +00:00
Mark Andrews 4e03bfac86 Add CHANGES for [GL #2005] 2020-07-14 07:07:58 +10:00
Mark Andrews cc0089c66b Address potential double unlock in process_fd 2020-07-14 07:07:14 +10:00
Evan Hunt d97710acdc Merge branch 'each-rndc-netmgr-pt2' into 'main'
RNDC using netmgr

See merge request isc-projects/bind9!3724
2020-07-13 20:39:49 +00:00
Evan Hunt 7c703c851f CHANGES, release note 2020-07-13 13:17:08 -07:00
Witold KręcickiandEvan Hunt ae5d316f64 isccc: merge recv_message and recv_nonce into one function
- make isccc message receiving code clearer by merging recv_nonce and
  recv_message into a single recv_data function and adding a boolean
  state field.
2020-07-13 13:17:08 -07:00
Evan Hunt 55896df79d use handles for isc_nm_pauseread() and isc_nm_resumeread()
by having these functions act on netmgr handles instead of socket
objects, they can be used in callback functions outside the netgmr.
2020-07-13 13:17:08 -07:00
Evan Hunt 29dcdeba1b purge pending command events when shutting down
When we're shutting the system down via "rndc stop" or "rndc halt",
or reconfiguring the control channel, there are potential shutdown
races between the server task and network manager.  These are adressed by:

- purging any pending command tasks when shutting down the control channel
- adding an extra handle reference before the command handler to
  ensure the handle can't be deleted out from under us before calling
  command_respond()
2020-07-13 13:17:08 -07:00
Evan Hunt 45ab0603eb use an isc_task to execute rndc commands
- using an isc_task to execute all rndc functions makes it relatively
  simple for them to acquire task exclusive mode when needed
- control_recvmessage() has been separated into two functions,
  control_recvmessage() and control_respond(). the respond function
  can be called immediately from control_recvmessage() when processing
  a nonce, or it can be called after returning from the task event
  that ran the rndc command function.
2020-07-13 13:16:53 -07:00
Evan Hunt 3551d3ffd2 convert rndc and control channel to use netmgr
- updated libisccc to use netmgr events
- updated rndc to use isc_nm_tcpconnect() to establish connections
- updated control channel to use isc_nm_listentcp()

open issues:

- the control channel timeout was previously 60 seconds, but it is now
  overridden by the TCP idle timeout setting, which defaults to 30
  seconds. we should add a function that sets the timeout value for
  a specific listener socket, instead of always using the global value
  set in the netmgr. (for the moment, since 30 seconds is a reasonable
  timeout for the control channel, I'm not prioritizing this.)
- the netmgr currently has no support for UNIX-domain sockets; until
  this is addressed, it will not be possible to configure rndc to use
  them. we will need to either fix this or document the change in
  behavior.
2020-07-13 13:16:53 -07:00
Evan Hunt 002c328437 don't use exclusive mode for rndc commands that don't need it
"showzone" and "tsig-list" both used exclusive mode unnecessarily;
changing this will simplify future refactoring a bit.
2020-07-13 13:12:33 -07:00
Evan Hunt 0580d9cd8c style cleanup
clean up style in rndc and the control channel in preparation for
changing them to use the new network manager.
2020-07-13 12:41:04 -07:00
Evan Hunt e7602e2d51 Merge branch 'each-lmdb-lock-fix' into 'main'
ensure new_zone_lock is released after count_newzones()

See merge request isc-projects/bind9!3833
2020-07-13 19:26:46 +00:00
Evan Hunt ed37c63e2b make sure new_zone_lock is locked before unlocking it
it was possible for the count_newzones() function to try to
unlock view->new_zone_lock on return before locking it, which
caused a crash on shutdown.
2020-07-13 12:06:26 -07:00
Diego dos Santos Fronza 4aaef76c58 Merge branch '1719-observed-stats-underflow-in-multiple-stats' into 'main'
Resolve "Observed stats underflow in multiple stats"

Closes #1719

See merge request isc-projects/bind9!3818
2020-07-13 18:28:58 +00:00
Diego Fronza a22e61d554 Add CHANGES and release note for #1719 2020-07-13 11:48:55 -03:00
Diego Fronza aab691d512 Fix ns_statscounter_recursclients underflow
The basic scenario for the problem was that in the process of
resolving a query, if any rrset was eligible for prefetching, then it
would trigger a call to query_prefetch(), this call would run in
parallel to the normal query processing.

The problem arises due to the fact that both query_prefetch(), and,
in the original thread, a call to ns_query_recurse(), try to attach
to the recursionquota, but recursing client stats counter is only
incremented if ns_query_recurse() attachs to it first.

Conversely, if fetch_callback() is called before prefetch_done(),
it would not only detach from recursionquota, but also decrement
the stats counter, if query_prefetch() attached to te quota first
that would result in a decrement not matched by an increment, as
expected.

To solve this issue an atomic bool was added, it is set once in
ns_query_recurse(), allowing fetch_callback() to check for it
and decrement stats accordingly.

For a more compreensive explanation check the thread comment below:
https://gitlab.isc.org/isc-projects/bind9/-/issues/1719#note_145857
2020-07-13 11:46:18 -03:00
Mark Andrews 600128ac27 Merge branch '1235-system-tests-fail-with-new-etc-bind-keys-installed' into 'main'
Fallback to built in trust-anchors, managed-keys, or trusted-keys

Closes #1235

See merge request isc-projects/bind9!3827
2020-07-13 05:09:10 +00:00
Mark Andrews d02a14c795 Fallback to built in trust-anchors, managed-keys, or trusted-keys
if the bind.keys file cannot be parsed.
2020-07-13 14:12:14 +10:00
Mark Andrews 1d739a95dd Merge branch '1989-rndc-dnstap-roll-with-too-big-a-argument-128-can-cause-a-buffer-overflow' into 'main'
Resolve "'rndc dnstap --roll' with too big a argument (>128) can cause a buffer overflow."

Closes #1989

See merge request isc-projects/bind9!3788
2020-07-13 03:52:02 +00:00
Mark Andrews 42b2290c3a Add changes for [GL #1989] 2020-07-13 13:10:45 +10:00
Mark Andrews 6ca78bc57d Address overrun in remove_old_tsversions
If too many versions of log / dnstap files to be saved where requests
the memory after to_keep could be overwritten.  Force the number of
versions to be saved to a save level.  Additionally the memmove length
was incorrect.
2020-07-13 13:10:45 +10:00
Mark Andrews 98de853740 Merge branch '2012-add-assertion-check-to-silence-dereference-before-null-check-in-tsig_test-c-v9_11' into 'main'
Resolve "Add assertion check to silence dereference before NULL check in tsig_test.c"

Closes #2012

See merge request isc-projects/bind9!3814
2020-07-13 03:06:25 +00:00
Mark Andrews 827746e89b Assert tsigout is non-NULL 2020-07-13 02:26:06 +00:00
Mark Andrews 1c73ea491b Merge branch '2014-statschannel-system-test-failed-at-setup-stage' into 'main'
Resolve "Statschannel system test failed at setup stage."

Closes #2014

See merge request isc-projects/bind9!3823
2020-07-13 02:22:09 +00:00
Mark Andrews a0e8a11cc6 Don't verify the zone when setting expire to "now+1s" as it can fail
as too much wall clock time may have elapsed.

Also capture signzone output for forensic analysis
2020-07-13 01:39:13 +00:00
Mark Andrews ef55dbf4fc Merge branch '2013-unchecked-returns-of-inet_pton-in-geoip_test-c' into 'main'
Resolve "Unchecked returns of inet_pton in geoip_test.c"

Closes #2013

See merge request isc-projects/bind9!3815
2020-07-13 01:21:52 +00:00
Mark Andrews 9499adeb5e check returns from inet_pton() 2020-07-13 00:31:29 +00:00
Mark Andrews 2e89dd7cb8 Merge branch 'marka-placeholder' into 'main'
placeholder for [GL #2010]

See merge request isc-projects/bind9!3834
2020-07-13 00:23:01 +00:00
Mark Andrews 93a336e248 placeholder for [GL #2010] 2020-07-13 00:21:22 +00:00
Mark Andrews b02c3e4f8e Merge branch '2003-remove-redundant-listener-null-check' into 'main'
Resolve "Remove redundant listener != NULL check"

Closes #2003

See merge request isc-projects/bind9!3806
2020-07-13 00:13:52 +00:00
Mark Andrews c91dc92410 Remove redundant check for listener being non-NULL 2020-07-12 23:46:35 +00:00
Michał Kępień a87ac96b56 Merge branch '1976-fix-locking-for-lmdb-0.9.26' into 'main'
Fix locking for LMDB 0.9.26

Closes #1976

See merge request isc-projects/bind9!3758
2020-07-10 09:50:47 +00:00
Michał Kępień 7fffa5abba Add CHANGES for GL #1976 2020-07-10 11:29:18 +02:00
Michał Kępień 53120279b5 Fix locking for LMDB 0.9.26
When "rndc reconfig" is run, named first configures a fresh set of views
and then tears down the old views.  Consider what happens for a single
view with LMDB enabled; "envA" is the pointer to the LMDB environment
used by the original/old version of the view, "envB" is the pointer to
the same LMDB environment used by the new version of that view:

 1. mdb_env_open(envA) is called when the view is first created.
 2. "rndc reconfig" is called.
 3. mdb_env_open(envB) is called for the new instance of the view.
 4. mdb_env_close(envA) is called for the old instance of the view.

This seems to have worked so far.  However, an upstream change [1] in
LMDB which will be part of its 0.9.26 release prevents the above
sequence of calls from working as intended because the locktable mutexes
will now get destroyed by the mdb_env_close() call in step 4 above,
causing any subsequent mdb_txn_begin() calls to fail (because all of the
above steps are happening within a single named process).

Preventing the above scenario from happening would require either
redesigning the way we use LMDB in BIND, which is not something we can
easily backport, or redesigning the way BIND carries out its
reconfiguration process, which would be an even more severe change.

To work around the problem, set MDB_NOLOCK when calling mdb_env_open()
to stop LMDB from controlling concurrent access to the database and do
the necessary locking in named instead.  Reuse the view->new_zone_lock
mutex for this purpose to prevent the need for modifying struct dns_view
(which would necessitate library API version bumps).  Drop use of
MDB_NOTLS as it is made redundant by MDB_NOLOCK: MDB_NOTLS only affects
where LMDB reader locktable slots are stored while MDB_NOLOCK prevents
the reader locktable from being used altogether.

[1] https://git.openldap.org/openldap/openldap/-/commit/2fd44e325195ae81664eb5dc36e7d265927c5ebc
2020-07-10 11:29:18 +02:00
876 changed files with 10070 additions and 5908 deletions
+2
View File
@@ -1,6 +1,8 @@
*.sln.in eol=crlf
*.vcxproj.* eol=crlf
/fuzz/dns_rdata_fromwire_text.in/input-* -text
.gitignore export-ignore
/conftools export-ignore
/doc/design export-ignore
+120 -112
View File
@@ -31,6 +31,12 @@ variables:
AM_COLOR_TESTS: always
WITHOUT_READLINE: "--without-readline"
WITH_READLINE: "--with-readline"
WITH_READLINE_EDITLINE: "--with-readline=editline"
WITH_READLINE_LIBEDIT: "--with-readline=libedit"
WITH_READLINE_READLINE: "--with-readline=readline"
stages:
- autoconf
- precheck
@@ -44,9 +50,7 @@ stages:
### Runner Tag Templates
# Note: BSD runners extract the operating system version to use from job name
.freebsd-amd64: &freebsd_amd64
.libvirt-amd64: &libvirt_amd64
tags:
- libvirt
- amd64
@@ -56,21 +60,11 @@ stages:
- linux
- amd64
.linux-arm64: &linux_arm64
tags:
- linux
- arm64
.linux-i386: &linux_i386
tags:
- linux
- i386
.openbsd-amd64: &openbsd_amd64
tags:
- libvirt
- amd64
### Docker Image Templates
# Alpine Linux
@@ -81,10 +75,6 @@ stages:
# CentOS
.centos-centos6-amd64: &centos_centos6_amd64_image
image: "$CI_REGISTRY_IMAGE:centos-centos6-amd64"
<<: *linux_amd64
.centos-centos7-amd64: &centos_centos7_amd64_image
image: "$CI_REGISTRY_IMAGE:centos-centos7-amd64"
<<: *linux_amd64
@@ -107,10 +97,6 @@ stages:
image: "$CI_REGISTRY_IMAGE:debian-sid-amd64"
<<: *linux_amd64
.debian-sid-arm64: &debian_sid_arm64_image
image: "$CI_REGISTRY_IMAGE:debian-sid-arm64"
<<: *linux_arm64
.debian-sid-i386: &debian_sid_i386_image
image: "$CI_REGISTRY_IMAGE:debian-sid-i386"
<<: *linux_i386
@@ -143,6 +129,20 @@ stages:
.base: &base_image
<<: *debian_buster_amd64_image
### QCOW2 Image Templates
.freebsd-11-amd64: &freebsd_11_amd64_image
image: "freebsd-11.4-x86_64"
<<: *libvirt_amd64
.freebsd-12-amd64: &freebsd_12_amd64_image
image: "freebsd-12.1-x86_64"
<<: *libvirt_amd64
.openbsd-amd64: &openbsd_amd64_image
image: "openbsd-6.7-x86_64"
<<: *libvirt_amd64
### Job Templates
.default-triggering-rules: &default_triggering_rules
@@ -180,16 +180,28 @@ stages:
${CONFIGURE} \
--disable-maintainer-mode \
--enable-developer \
--with-libtool \
--with-cmocka \
--with-libxml2 \
--with-json-c \
--prefix=$HOME/.local \
--without-make-clean \
--with-python=python3 \
$EXTRA_CONFIGURE \
|| cat config.log
.check_readline_setup: &check_readline_setup |
if [[ -n "${WITHOUT_READLINE}" ]]; then \
! grep "^#define HAVE_READLINE" config.h; \
elif [[ -n "${WITH_READLINE}" ]]; then \
grep -e "^#define HAVE_READLINE_READLINE" \
-e "^#define HAVE_READLINE_LIBEDIT" \
-e "^#define HAVE_READLINE_EDITLINE" config.h; \
elif [[ -n "${WITH_READLINE_EDITLINE}" ]]; then \
grep "^#define HAVE_READLINE_EDITLINE" config.h; \
elif [[ -n "${WITH_READLINE_LIBEDIT}" ]]; then \
grep "^#define HAVE_READLINE_LIBEDIT" config.h; \
elif [[ -n "${WITH_READLINE_READLINE}" ]]; then \
grep "^#define HAVE_READLINE_READLINE" config.h; \
fi
.build: &build_job
<<: *default_triggering_rules
stage: build
@@ -198,6 +210,7 @@ stages:
- test -n "${OOT_BUILD_WORKSPACE}" && mkdir "${OOT_BUILD_WORKSPACE}" && cd "${OOT_BUILD_WORKSPACE}"
script:
- *configure
- *check_readline_setup
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- test -z "${RUN_MAKE_INSTALL}" || make install
- test -z "${RUN_MAKE_INSTALL}" || sh util/check-make-install
@@ -257,8 +270,9 @@ stages:
- *setup_softhsm
script:
- cd bin/tests/system
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 || make -j${TEST_PARALLEL_JOBS:-1} -k recheck V=1
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
after_script:
- test -d bind-* && cd bind-*
- cat bin/tests/system/test-suite.log
.system_test: &system_test_job
@@ -397,6 +411,7 @@ misc:
- xmllint --noout --nonet `git ls-files '*.xml' '*.docbook'`
- sh util/check-win32util-configure
- sh util/check-categories.sh
- if git grep SYSTEMTESTTOP -- ':!.gitlab-ci.yml'; then echo 'Please use relative paths instead of $SYSTEMTESTTOP.'; exit 1; fi
needs: []
artifacts:
paths:
@@ -460,9 +475,14 @@ pylint:
tarball-create:
stage: precheck
<<: *base_image
<<: *default_triggering_rules
script:
- *configure
- ./configure --enable-maintainer-mode
- make maintainer-clean
- autoreconf -fi
- ./configure --enable-maintainer-mode
- make -j${BUILD_PARALLEL_JOBS:-1} all V=1
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
- make -j${BUILD_PARALLEL_JOBS:-1} dist V=1
artifacts:
paths:
@@ -470,8 +490,6 @@ tarball-create:
needs:
- job: autoreconf
artifacts: true
only:
- tags
# Jobs for doc builds on Debian 10 "buster" (amd64)
@@ -514,7 +532,7 @@ gcc:alpine3.12:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--enable-dnstap"
EXTRA_CONFIGURE: "--enable-dnstap ${WITHOUT_READLINE}"
<<: *alpine_3_12_amd64_image
<<: *build_job
@@ -532,30 +550,6 @@ unit:gcc:alpine3.12:amd64:
- job: gcc:alpine3.12:amd64
artifacts: true
# Jobs for regular GCC builds on CentOS 6 (amd64)
gcc:centos6:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --disable-warn-error --without-python"
<<: *centos_centos6_amd64_image
<<: *build_job
system:gcc:centos6:amd64:
<<: *centos_centos6_amd64_image
<<: *system_test_job
needs:
- job: gcc:centos6:amd64
artifacts: true
unit:gcc:centos6:amd64:
<<: *centos_centos6_amd64_image
<<: *unit_test_job
needs:
- job: gcc:centos6:amd64
artifacts: true
# Jobs for regular GCC builds on CentOS 7 (amd64)
gcc:centos7:amd64:
@@ -586,7 +580,7 @@ gcc:centos8:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
EXTRA_CONFIGURE: "--enable-buffer-useinline --with-libidn2"
<<: *centos_centos8_amd64_image
<<: *build_job
@@ -633,6 +627,7 @@ gcc:buster:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITH_READLINE_LIBEDIT}"
<<: *debian_buster_amd64_image
<<: *build_job
@@ -742,6 +737,7 @@ gcc:tarball:
- job: tarball-create
artifacts: true
only:
- schedules
- tags
system:gcc:tarball:
@@ -754,6 +750,7 @@ system:gcc:tarball:
- job: gcc:tarball
artifacts: true
only:
- schedules
- tags
unit:gcc:tarball:
@@ -765,39 +762,16 @@ unit:gcc:tarball:
- job: gcc:tarball
artifacts: true
only:
- schedules
- tags
# Jobs for regular GCC builds on Debian "sid" (arm64)
gcc:sid:arm64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_sid_arm64_image
<<: *build_job
system:gcc:sid:arm64:
<<: *debian_sid_arm64_image
<<: *system_test_job
needs:
- job: gcc:sid:arm64
artifacts: true
unit:gcc:sid:arm64:
<<: *debian_sid_arm64_image
<<: *unit_test_job
needs:
- job: gcc:sid:arm64
artifacts: true
# Jobs for regular GCC builds on Debian "sid" (i386)
gcc:sid:i386:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --without-python"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_sid_i386_image
<<: *build_job
@@ -821,7 +795,7 @@ gcc:tumbleweed:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --with-python --with-gssapi=/usr/lib/mit/bin/krb5-config"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_READLINE}"
<<: *tumbleweed_latest_amd64_image
<<: *build_job
@@ -1029,7 +1003,6 @@ clang:buster:amd64:
variables:
CC: ${CLANG}
CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion"
EXTRA_CONFIGURE: "--with-python=python3"
<<: *debian_buster_amd64_image
<<: *build_job
@@ -1095,78 +1068,76 @@ unit:gcc:softhsm2.6:
- job: gcc:softhsm2.6
artifacts: true
# Jobs for Clang builds on FreeBSD 11.4 (amd64)
# Jobs for Clang builds on FreeBSD 11 (amd64)
clang:freebsd11.4:amd64:
clang:freebsd11:amd64:
variables:
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITH_READLINE}"
USER: gitlab-runner
# Temporarily disable LMDB support [GL #1976]
EXTRA_CONFIGURE: "--without-lmdb"
<<: *freebsd_amd64
<<: *freebsd_11_amd64_image
<<: *build_job
system:clang:freebsd11.4:amd64:
<<: *freebsd_amd64
system:clang:freebsd11:amd64:
<<: *freebsd_11_amd64_image
<<: *system_test_job
variables:
USER: gitlab-runner
TEST_PARALLEL_JOBS: 4
needs:
- job: clang:freebsd11.4:amd64
- job: clang:freebsd11:amd64
artifacts: true
unit:clang:freebsd11.4:amd64:
<<: *freebsd_amd64
unit:clang:freebsd11:amd64:
<<: *freebsd_11_amd64_image
<<: *unit_test_job
needs:
- job: clang:freebsd11.4:amd64
- job: clang:freebsd11:amd64
artifacts: true
# Jobs for Clang builds on FreeBSD 12.1 (amd64)
# Jobs for Clang builds on FreeBSD 12 (amd64)
clang:freebsd12.1:amd64:
clang:freebsd12:amd64:
variables:
CFLAGS: "${CFLAGS_COMMON}"
# Temporarily disable LMDB support [GL #1976]
EXTRA_CONFIGURE: "--enable-dnstap --without-lmdb"
EXTRA_CONFIGURE: "--enable-dnstap ${WITH_READLINE_EDITLINE}"
USER: gitlab-runner
<<: *freebsd_amd64
<<: *freebsd_12_amd64_image
<<: *build_job
system:clang:freebsd12.1:amd64:
<<: *freebsd_amd64
system:clang:freebsd12:amd64:
<<: *freebsd_12_amd64_image
<<: *system_test_job
variables:
USER: gitlab-runner
TEST_PARALLEL_JOBS: 4
needs:
- job: clang:freebsd12.1:amd64
- job: clang:freebsd12:amd64
artifacts: true
unit:clang:freebsd12.1:amd64:
<<: *freebsd_amd64
unit:clang:freebsd12:amd64:
<<: *freebsd_12_amd64_image
<<: *unit_test_job
needs:
- job: clang:freebsd12.1:amd64
- job: clang:freebsd12:amd64
artifacts: true
# Jobs for Clang builds on OpenBSD 6.7 (amd64)
# Jobs for Clang builds on OpenBSD (amd64)
clang:openbsd6.7:amd64:
clang:openbsd:amd64:
variables:
CC: clang
USER: gitlab-runner
<<: *openbsd_amd64
<<: *openbsd_amd64_image
<<: *build_job
system:clang:openbsd6.7:amd64:
<<: *openbsd_amd64
system:clang:openbsd:amd64:
<<: *openbsd_amd64_image
<<: *system_test_job
variables:
USER: gitlab-runner
needs:
- job: clang:openbsd6.7:amd64
- job: clang:openbsd:amd64
artifacts: true
only:
- schedules
@@ -1218,6 +1189,8 @@ release:
- find Build/ -regextype posix-extended -regex "Build/.*/($(find bin/tests/ -type f | sed -nE "s|^bin/tests(/system)?/win32/(.*)\.vcxproj$|\2|p" | paste -d"|" -s))\..*" -print -delete
# Create Windows zips
- openssl dgst -sha256 "${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" | tee Build/Release/SHA256 Build/Debug/SHA256
- cp "doc/arm/_build/latex/Bv9ARM.pdf" Build/Release/
- cp "doc/arm/_build/latex/Bv9ARM.pdf" Build/Debug/
- ( cd Build/Release; zip "../../BIND${BIND_DIRECTORY#bind-}.x64.zip" * )
- ( cd Build/Debug; zip "../../BIND${BIND_DIRECTORY#bind-}.debug.x64.zip" * )
# Prepare release tarball contents (tarballs + zips + documentation)
@@ -1319,13 +1292,13 @@ respdiff:
BIND_BASELINE_VERSION: v9_11_3
script:
- autoreconf -fi
- ./configure --without-make-clean
- ./configure
- make -j${BUILD_PARALLEL_JOBS:-1} V=1
- *setup_interfaces
- git clone --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.isc.org/isc-private/bind-qa.git
- git clone --branch "${BIND_BASELINE_VERSION}" --depth 1 https://gitlab.isc.org/isc-projects/bind9.git refbind
- cd refbind/
- ./configure --without-make-clean
- ./configure
- make -j${BUILD_PARALLEL_JOBS:-1} V=1
- cd ../bind-qa/bind9/respdiff
- bash respdiff.sh -q "${PWD}/100k_mixed.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}/refbind" "${CI_PROJECT_DIR}"
@@ -1352,7 +1325,8 @@ abi-check:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
BIND_BASELINE_VERSION: v9_17_2
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
BIND_BASELINE_VERSION: v9_17_4
script:
- *configure
- make -j${BUILD_PARALLEL_JOBS:-1} V=1
@@ -1372,3 +1346,37 @@ abi-check:
only:
- main@isc-projects/bind9
- /^v9_[1-9][0-9]$/@isc-projects/bind9
gcov:
<<: *base_image
stage: build
needs:
- job: autoreconf
artifacts: true
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
script:
- *configure
- *setup_interfaces
- *setup_softhsm
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1 || true
- make -C bin/tests/system -j${TEST_PARALLEL_JOBS:-1} -k check V=1 || cat bin/tests/system/test-suite.log
# *.gcno and *.gcda files generated for shared library objects are created
# in directories in which gcovr is unable to process them properly
# (.../.libs/...). Move such *.gcno and *.gcda files one level higher.
- find . -regex ".*/\.libs/.*\.\(gcda\|gcno\)" -execdir mv "{}" .. \;
# Help gcovr process the nasty tricks in lib/dns/code.h, where we include C
# source files from lib/dns/rdata/*/, using an even nastier trick.
- find lib/dns/rdata/* -name "*.c" -execdir cp -f "{}" ../../ \;
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' --html-details -o coverage.html
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories libltdl --exclude-directories lib/samples --exclude 'lib/.*/tests/.*' -o coverage.txt
- tail -n 3 coverage.txt
artifacts:
paths:
- coverage*.html
only:
- main@isc-projects/bind9
- /^v9_[1-9][0-9]$/@isc-projects/bind9
+1
View File
@@ -67,6 +67,7 @@
- [ ] ***(SwEng)*** Push tags for the published releases to the public repository.
- [ ] ***(QA)*** For each maintained branch, update the `BIND_BASELINE_VERSION` variable for the `abi-check` job in `.gitlab-ci.yml` to the latest published BIND version tag for a given branch.
- [ ] ***(QA)*** Prepare empty release notes for the next set of releases.
- [ ] ***(QA)*** Sanitize all confidential issues assigned to the release milestone and make them public.
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Flake8, PyLint) by modifying the relevant `Dockerfile`.
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
+192 -24
View File
@@ -1,15 +1,185 @@
5461. [bug] The header STALE attribute was not being updated with
the write lock being held leading to incorrect
statistics. Convert the header attributes to use atomic
operations. [GL #1475]
5503. [bug] Cleaned up reference counting of network manager
handles, now using isc_nmhandle_attach() and _detach()
instead of _ref() and _unref(). [GL #2122]
5502. [func] 'dig +bufsize=0' no longer disables EDNS. [GL #2054]
5501. [func] Log CDS/CDNSKEY publication. [GL #1748]
5500. [bug] Fix (non-)publication of CDS and CDNSKEY records.
[GL #2103]
5499. [func] Add '-P ds' and '-D ds' arguments to dnssec-settime.
5498. [test] The --with-gperftools-profiler configure option was
removed. [GL !4045]
5497. [placeholder]
5496. [bug] The rate limiter needs to hold a reference to its task.
[GL #2081]
5495. [bug] With query minimization enabled, named failed to
resolve ip6.arpa. names that had more labels after the
IPv6 part. [GL #1847]
5494. [bug] Silence the EPROTO syslog message on older systems.
[GL #1928]
5493. [bug] Fix off-by-one error when calculating new hashtable
size. [GL #2104]
5492. [bug] Tighten LOC parsing to reject period and/or m as a
value. Correct handling of negative altitudes which
are not whole metres. [GL #2074]
5491. [bug] rbtversion->glue_table_size could be read without the
appropriate lock being held. [GL #2080]
5490. [func] Refactor the readline support to use pkg-config and
add support for editline library. [GL !3942]
5489. [bug] Named failed to reject some invalid records resulting
in records that, after being printed, could not be
loaded or would result in DNSSEC validation failures
when re-read from zone files as the wire format
differed. The covered records records are: CERT,
IPSECKEY, NSEC3, NSEC3PARAM, NXT, SIG, TLSA, WKS, and
X25. [GL !3953]
5488. [bug] nta needed to have a weak reference on view to prevent
the view being deleted while nta tests are being
performed. [GL #2067]
5487. [cleanup] Update managed keys log messages to be less confusing.
[GL #2027]
5486. [func] Add 'rndc dnssec -checkds' command to tell named
that the DS record has been published in the parent.
[GL #1613]
--- 9.17.4 released ---
5485. [placeholder]
5484. [func] Expire zero TTL records quickly rather than using them
for stale answers. [GL #1829]
5483. [func] Keeping "stale" answers in cache has been disabled by
default and can be re-enabled with a new configuration
option "stale-cache-enable". [GL #1712]
5482. [bug] If the Duplicate Address Detection (DAD) mechanism had
not yet finished after adding a new IPv6 address to the
system, BIND 9 would fail to bind to IPv6 addresses in a
tentative state. [GL #2038]
5481. [security] "update-policy" rules of type "subdomain" were
incorrectly treated as "zonesub" rules, which allowed
keys used in "subdomain" rules to update names outside
of the specified subdomains. The problem was fixed by
making sure "subdomain" rules are again processed as
described in the ARM. (CVE-2020-8624) [GL #2055]
5480. [security] When BIND 9 was compiled with native PKCS#11 support, it
was possible to trigger an assertion failure in code
determining the number of bits in the PKCS#11 RSA public
key with a specially crafted packet. (CVE-2020-8623)
[GL #2037]
5479. [security] named could crash in certain query resolution scenarios
where QNAME minimization and forwarding were both
enabled. (CVE-2020-8621) [GL #1997]
5478. [security] It was possible to trigger an assertion failure by
sending a specially crafted large TCP DNS message.
(CVE-2020-8620) [GL #1996]
5477. [bug] The idle timeout for connected TCP sockets, which was
previously set to a high fixed value, is now derived
from the client query processing timeout configured for
a resolver. [GL #2024]
5476. [security] It was possible to trigger an assertion failure when
verifying the response to a TSIG-signed request.
(CVE-2020-8622) [GL #2028]
5475. [bug] Wildcard RPZ passthru rules could incorrectly be
overridden by other rules that were loaded from RPZ
zones which appeared later in the "response-policy"
statement. This has been fixed. [GL #1619]
5474. [bug] dns_rdata_hip_next() failed to return ISC_R_NOMORE
when it should have. [GL !3880]
5473. [func] The RBT hash table implementation has been changed
to use a faster hash function (HalfSipHash2-4) and
Fibonacci hashing for better distribution. Setting
"max-cache-size" now preallocates a fixed-size hash
table so that rehashing does not cause resolution
brownouts while the hash table is grown. [GL #1775]
5472. [func] The statistics channel has been updated to use the
new network manager. [GL #2022]
5471. [bug] The introduction of KASP support inadvertently caused
the second field of "sig-validity-interval" to always be
calculated in hours, even in cases when it should have
been calculated in days. This has been fixed. (Thanks to
Tony Finch.) [GL !3735]
5470. [port] gsskrb5_register_acceptor_identity() is now only called
if gssapi_krb5.h is present. [GL #1995]
5469. [port] On illumos, a constant called SEC is already defined in
<sys/time.h>, which conflicts with an identically named
constant in libbind9. This conflict has been resolved.
[GL #1993]
5468. [bug] Addressed potential double unlock in process_fd().
[GL #2005]
5467. [func] The control channel and the rndc utility have been
updated to use the new network manager. To support
this, the network manager was updated to enable
the initiation of client TCP connections. Its
internal reference counting has been refactored.
Note: As a side effect of this change, rndc cannot
currently be used with UNIX-domain sockets, and its
default timeout has changed from 60 seconds to 30.
These will be addressed in a future release.
[GL #1759]
5466. [bug] Addressed an error in recursive clients stats reporting.
[GL #1719]
5465. [func] Added fallback to built-in trust-anchors, managed-keys,
or trusted-keys if the bindkeys-file (bind.keys) cannot
be parsed. [GL #1235]
5464. [bug] Requesting more than 128 files to be saved when rolling
dnstap log files caused a buffer overflow. This has been
fixed. [GL #1989]
5463. [placeholder]
5462. [bug] Move LMDB locking from LMDB itself to named. [GL #1976]
5461. [bug] The STALE rdataset header attribute was updated while
the write lock was not being held, leading to incorrect
statistics. The header attributes are now converted to
use atomic operations. [GL #1475]
5460. [cleanup] tsig-keygen was previously an alias for
ddns-confgen and was documented in the ddns-confgen
man page. This has been reversed; tsig-keygen is
now the primary name. [GL #1998]
5459. [bug] Bad isc_mem_put() size when an invalid type was
specified in a update-policy rule. [GL #1990]
5459. [bug] Fixed bad isc_mem_put() size when an invalid type was
specified in an "update-policy" rule. [GL #1990]
--- 9.17.3 released ---
5458. [bug] Prevent a theoretically possible NULL dereference caused
by a data race between zone_maintenance() and
@@ -19,23 +189,21 @@
5456. [func] Added "primaries" as a synonym for "masters" in
named.conf, and "primary-only" as a synonym for
"master-only" in the parameters to "notify",
in order to bring terminology up to date with
RFC 8499. [GL #1948]
"master-only" in the parameters to "notify", to bring
terminology up-to-date with RFC 8499. [GL #1948]
5455. [bug] `named` could crash when cleaning dead nodes
in lib/dns/rbtdb.c that have been reused meanwhile.
[GL #1968]
5455. [bug] named could crash when cleaning dead nodes in
lib/dns/rbtdb.c that were being reused. [GL #1968]
5454. [bug] Address a startup crash happening when server is
under load and root zone is not yet loaded. [GL #1862]
5454. [bug] Address a startup crash that occurred when the server
was under load and the root zone had not yet been
loaded. [GL #1862]
5453. [bug] `named` would crash on shutdown when new `rndc`
connection is received at the same time as
shutting down. [GL #1747]
5453. [bug] named crashed on shutdown when a new rndc connection was
received during shutdown. [GL #1747]
5452. [bug] The "blackhole" ACL was accidentally disabled with
respect to client queries. [GL #1936]
5452. [bug] The "blackhole" ACL was accidentally disabled for client
queries. [GL #1936]
5451. [func] Add 'rndc dnssec -status' command. [GL #1612]
@@ -53,14 +221,14 @@
5446. [bug] The validator could fail to accept a properly signed
RRset if an unsupported algorithm appeared earlier in
the DNSKEY RRset than a supported algorithm. It could
the DNSKEY RRset than a supported algorithm. It could
also stop if it detected a malformed public key.
[GL #1689]
5445. [cleanup] Disable and disallow static linking. [GL #1933]
5444. [bug] 'rndc dnstap -roll <value>' was not limiting the
number of saved files to <value>. [GL !3728]
5444. [bug] 'rndc dnstap -roll <value>' did not limit the number of
saved files to <value>. [GL !3728]
5443. [bug] The "primary" and "secondary" keywords, when used
as parameters for "check-names", were not
@@ -73,8 +241,8 @@
5440. [placeholder]
5439. [bug] The dsset returned by dns_keynode_dsset() was not
thread safe. [GL #1926]
5439. [bug] The DS RRset returned by dns_keynode_dsset() was used in
a non-thread-safe manner. [GL #1926]
--- 9.17.2 released ---
+1 -1
View File
@@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.top
SUBDIRS = . libltdl lib doc bin
SUBDIRS = . libltdl lib doc bin fuzz
BUILT_SOURCES = bind.keys.h
CLEANFILES = bind.keys.h
+5
View File
@@ -33,6 +33,11 @@ LIBISC_CFLAGS += \
$(LIBXML2_CFLAGS)
endif HAVE_LIBXML2
if HAVE_READLINE
LIBISC_CFLAGS += \
$(READLINE_CFLAGS)
endif HAVE_READLINE
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
LIBDNS_CFLAGS = \
+2 -6
View File
@@ -185,9 +185,8 @@ command:
Building on macOS assumes that the "Command Tools for Xcode" are installed.
These can be downloaded from
[https://developer.apple.com/download/more/](https://developer.apple.com/download/more/)
or, if you have Xcode already installed, you can run
`xcode-select--install`. (Note that an Apple ID may be required to access the download
page.)
or, if you have Xcode already installed, you can run `xcode-select --install`.
(Note that an Apple ID may be required to access the download page.)
#### <a name="dependencies"> Dependencies
@@ -208,9 +207,6 @@ installed:
To see a full list of configuration options, run `configure --help`.
To build shared libraries, specify `--with-libtool` on the `configure`
command line.
For the server to support DNSSEC, you need to build it with crypto support.
To use OpenSSL, you should have OpenSSL 1.0.2e or newer installed. If the
OpenSSL library is installed in a nonstandard location, specify the prefix
+1 -1
View File
@@ -28,7 +28,7 @@ tsig-keygen, ddns-confgen - TSIG key generation tool
Synopsis
~~~~~~~~
:program:`tsig-keygen` [**-a** algorithm] [**-h**] [**-r** randomfile] [**-s** name]
:program:`tsig-keygen` [**-a** algorithm] [**-h**] [**-r** randomfile] [name]
:program:`ddns-confgen` [**-a** algorithm] [**-h**] [**-k** keyname] [**-q**] [**-r** randomfile] [**-s** name] [**-z** zone]
+7 -3
View File
@@ -25,6 +25,10 @@ libdighost_la_SOURCES = \
bin_PROGRAMS = dig host nslookup
nslookup_LDADD = \
$(LDADD) \
$(READLINE_LIB)
nslookup_LDADD = \
$(LDADD)
if HAVE_READLINE
nslookup_LDADD += \
$(READLINE_LIBS)
endif HAVE_READLINE
+18 -18
View File
@@ -185,7 +185,7 @@ help(void) {
" +[no]besteffort (Try to parse even "
"illegal "
"messages)\n"
" +bufsize=### (Set EDNS0 Max UDP packet "
" +bufsize[=###] (Set EDNS0 Max UDP packet "
"size)\n"
" +[no]cdflag (Set checking disabled "
"flag in query)\n"
@@ -642,7 +642,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
if (yaml) {
enum { Q = 0x1, R = 0x2 }; /* Q:query; R:ecursive */
unsigned int tflag = 0;
isc_sockaddr_t saddr;
char sockstr[ISC_SOCKADDR_FORMATSIZE];
uint16_t sport;
char *hash;
@@ -713,10 +712,9 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printf(" response_port: %u\n", sport);
}
if (query->sock != NULL &&
isc_socket_getsockname(query->sock, &saddr) ==
ISC_R_SUCCESS)
{
if (query->handle != NULL) {
isc_sockaddr_t saddr =
isc_nmhandle_localaddr(query->handle);
sport = isc_sockaddr_getport(&saddr);
isc_sockaddr_format(&saddr, sockstr, sizeof(sockstr));
hash = strchr(sockstr, '#');
@@ -1047,12 +1045,13 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
break;
case 'u': /* bufsize */
FULLCHECK("bufsize");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
if (value == NULL) {
lookup->udpsize = DEFAULT_EDNS_BUFSIZE;
break;
}
result = parse_uint(&num, value, COMMSIZE,
"buffer size");
if (result != ISC_R_SUCCESS) {
@@ -1099,7 +1098,7 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
case 'o': /* cookie */
FULLCHECK("cookie");
if (state && lookup->edns == -1) {
lookup->edns = 0;
lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->sendcookie = state;
if (value != NULL) {
@@ -1138,7 +1137,7 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
FULLCHECK("dnssec");
dnssec:
if (state && lookup->edns == -1) {
lookup->edns = 0;
lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->dnssec = state;
break;
@@ -1190,7 +1189,8 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
break;
}
if (value == NULL) {
lookup->edns = 0;
lookup->edns =
DEFAULT_EDNS_VERSION;
break;
}
result = parse_uint(&num, value,
@@ -1405,7 +1405,7 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
case 'i': /* nsid */
FULLCHECK("nsid");
if (state && lookup->edns == -1) {
lookup->edns = 0;
lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->nsid = state;
break;
@@ -1475,7 +1475,7 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
case 'p':
FULLCHECK("padding");
if (state && lookup->edns == -1) {
lookup->edns = 0;
lookup->edns = DEFAULT_EDNS_VERSION;
}
if (value == NULL) {
goto need_value;
@@ -1661,7 +1661,7 @@ plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) {
break;
}
if (lookup->edns == -1) {
lookup->edns = 0;
lookup->edns = DEFAULT_EDNS_VERSION;
}
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
@@ -1967,10 +1967,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
srcport = 0;
}
if (have_ipv6 && inet_pton(AF_INET6, value, &in6) == 1) {
isc_sockaddr_fromin6(&bind_address, &in6, srcport);
isc_sockaddr_fromin6(&localaddr, &in6, srcport);
isc_net_disableipv4();
} else if (have_ipv4 && inet_pton(AF_INET, value, &in4) == 1) {
isc_sockaddr_fromin(&bind_address, &in4, srcport);
isc_sockaddr_fromin(&localaddr, &in4, srcport);
isc_net_disableipv6();
} else {
if (hash != NULL) {
@@ -2276,7 +2276,7 @@ parse_args(bool is_batchfile, bool config_only, int argc, char **argv) {
debug("making new lookup");
default_lookup = make_empty_lookup();
default_lookup->adflag = true;
default_lookup->edns = 0;
default_lookup->edns = DEFAULT_EDNS_VERSION;
default_lookup->sendcookie = true;
#ifndef NOPOSIX
+4 -6
View File
@@ -251,12 +251,10 @@ abbreviation is unambiguous; for example, ``+cd`` is equivalent to
This option attempts to display the contents of messages which are malformed. The
default is to not display malformed answers.
``+bufsize=B``
This option sets the UDP message buffer size advertised using EDNS0 to ``B``
bytes. The maximum and minimum sizes of this buffer are 65535 and 0,
respectively. Values outside this range are rounded up or down
appropriately. Values other than zero cause an EDNS query to be
sent.
``+bufsize[=B]``
This option sets the UDP message buffer size advertised using EDNS0 to
``B`` bytes. The maximum and minimum sizes of this buffer are 65535 and
0, respectively. ``+bufsize`` restores the default buffer size.
``+[no]cdflag``
This option sets [or does not set] the CD (checking disabled) bit in the query. This
+334 -430
View File
File diff suppressed because it is too large Load Diff
+11 -5
View File
@@ -71,6 +71,10 @@
#define SERVER_TIMEOUT 1
#define LOOKUP_LIMIT 64
#define DEFAULT_EDNS_VERSION 0
#define DEFAULT_EDNS_BUFSIZE 4096
/*%
* Lookup_limit is just a limiter, keeping too many lookups from being
* created. It's job is mainly to prevent the program from running away
@@ -141,7 +145,7 @@ struct dig_lookup {
dig_query_t *xfr_q;
uint32_t retries;
int nsfound;
uint16_t udpsize;
int16_t udpsize;
int16_t edns;
int16_t padding;
uint32_t ixfr_serial;
@@ -168,7 +172,7 @@ struct dig_query {
unsigned int magic;
dig_lookup_t *lookup;
bool waiting_connect, pending_free, waiting_senddone, first_pass,
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made,
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd,
warn_id, timedout;
uint32_t first_rr_serial;
uint32_t second_rr_serial;
@@ -177,9 +181,11 @@ struct dig_query {
bool ixfr_axfr;
char *servname;
char *userarg;
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
isc_buffer_t sendbuf;
char *recvspace, *tmpsendspace, lengthspace[4];
isc_socket_t *sock;
isc_nmhandle_t *handle;
isc_nmhandle_t *readhandle;
isc_nmhandle_t *sendhandle;
ISC_LINK(dig_query_t) link;
ISC_LINK(dig_query_t) clink;
isc_sockaddr_t sockaddr;
@@ -221,7 +227,7 @@ extern int sendcount;
extern int ndots;
extern int lookup_counter;
extern int exitcode;
extern isc_sockaddr_t bind_address;
extern isc_sockaddr_t localaddr;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
+12 -42
View File
@@ -22,6 +22,7 @@
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/readline.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
@@ -38,22 +39,6 @@
#include "dighost.h"
#if defined(HAVE_READLINE)
#if defined(HAVE_EDIT_READLINE_READLINE_H)
#include <edit/readline/readline.h>
#if defined(HAVE_EDIT_READLINE_HISTORY_H)
#include <edit/readline/history.h>
#endif /* if defined(HAVE_EDIT_READLINE_HISTORY_H) */
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_READLINE_H)
#include <readline/readline.h>
#if defined(HAVE_READLINE_HISTORY_H)
#include <readline/history.h>
#endif /* if defined(HAVE_READLINE_HISTORY_H) */
#endif /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
#endif /* if defined(HAVE_READLINE) */
static bool short_form = true, tcpmode = false, tcpmode_set = false,
identify = false, stats = true, comments = true,
section_question = true, section_answer = true,
@@ -787,7 +772,6 @@ addlookup(char *opt) {
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->retries = tries;
lookup->udpsize = 0;
lookup->setqid = false;
lookup->qid = 0;
lookup->comments = comments;
@@ -848,38 +832,27 @@ do_next_command(char *input) {
static void
get_next_command(void) {
char *buf;
char *ptr;
char cmdlinebuf[COMMSIZE];
char *cmdline, *ptr = NULL;
fflush(stdout);
buf = isc_mem_allocate(mctx, COMMSIZE);
isc_app_block();
if (interactive) {
#ifdef HAVE_READLINE
ptr = readline("> ");
if (ptr != NULL) {
cmdline = ptr = readline("> ");
if (ptr != NULL && *ptr != 0) {
add_history(ptr);
}
#else /* ifdef HAVE_READLINE */
fprintf(stderr, "> ");
fflush(stderr);
ptr = fgets(buf, COMMSIZE, stdin);
#endif /* ifdef HAVE_READLINE */
} else {
ptr = fgets(buf, COMMSIZE, stdin);
cmdline = fgets(cmdlinebuf, COMMSIZE, stdin);
}
isc_app_unblock();
if (ptr == NULL) {
if (cmdline == NULL) {
in_use = false;
} else {
do_next_command(ptr);
do_next_command(cmdline);
}
#ifdef HAVE_READLINE
if (interactive) {
if (ptr != NULL) {
free(ptr);
}
#endif /* ifdef HAVE_READLINE */
isc_mem_free(mctx, buf);
}
ISC_NORETURN static void
@@ -942,13 +915,10 @@ flush_lookup_list(void) {
while (l != NULL) {
q = ISC_LIST_HEAD(l->q);
while (q != NULL) {
if (q->sock != NULL) {
isc_socket_cancel(q->sock, NULL,
ISC_SOCKCANCEL_ALL);
isc_socket_detach(&q->sock);
if (q->handle != NULL) {
isc_nm_cancelread(q->handle);
isc_nmhandle_detach(&q->handle);
}
isc_buffer_invalidate(&q->recvbuf);
isc_buffer_invalidate(&q->lengthbuf);
qp = q;
q = ISC_LIST_NEXT(q, link);
ISC_LIST_DEQUEUE(l->q, qp, link);
+65
View File
@@ -75,6 +75,8 @@ usage(void) {
fprintf(stderr, "Timing options:\n");
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
"publication date\n");
fprintf(stderr, " -P ds date/[+-]offset/none: set/unset "
"DS publication date\n");
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY publication date\n");
fprintf(stderr, " -A date/[+-]offset/none: set/unset key "
@@ -85,6 +87,8 @@ usage(void) {
"inactivation date\n");
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
"deletion date\n");
fprintf(stderr, " -D ds date/[+-]offset/none: set/unset "
"DS deletion date\n");
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
fprintf(stderr, " -S <key>: generate a successor to an existing "
@@ -243,6 +247,10 @@ main(int argc, char **argv) {
bool unsetsyncadd = false, setsyncadd = false;
bool unsetsyncdel = false, setsyncdel = false;
bool printsyncadd = false, printsyncdel = false;
isc_stdtime_t dsadd = 0, dsdel = 0;
bool unsetdsadd = false, setdsadd = false;
bool unsetdsdel = false, setdsdel = false;
bool printdsadd = false, printdsdel = false;
options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
@@ -290,6 +298,18 @@ main(int argc, char **argv) {
unsetsyncdel = !setsyncdel;
break;
}
/* -Dds ? */
if (isoptarg("ds", argv, usage)) {
if (unsetdsdel || setdsdel) {
fatal("-D ds specified more than once");
}
changed = true;
dsdel = strtotime(isc_commandline_argument, now,
now, &setdsdel);
unsetdsdel = !setdsdel;
break;
}
/* -Ddnskey ? */
(void)isoptarg("dnskey", argv, usage);
if (setdel || unsetdel) {
@@ -394,6 +414,19 @@ main(int argc, char **argv) {
unsetsyncadd = !setsyncadd;
break;
}
/* -Pds ? */
if (isoptarg("ds", argv, usage)) {
if (unsetdsadd || setdsadd) {
fatal("-P ds specified more than once");
}
changed = true;
dsadd = strtotime(isc_commandline_argument, now,
now, &setdsadd);
unsetdsadd = !setdsadd;
break;
}
/* -Pdnskey ? */
(void)isoptarg("dnskey", argv, usage);
if (setpub || unsetpub) {
fatal("-P specified more than once");
@@ -415,6 +448,8 @@ main(int argc, char **argv) {
printdel = true;
printsyncadd = true;
printsyncdel = true;
printdsadd = true;
printdsdel = true;
break;
}
@@ -432,6 +467,11 @@ main(int argc, char **argv) {
printsyncdel = true;
break;
}
if (!strncmp(p, "ds", 2)) {
p += 2;
printdsdel = true;
break;
}
printdel = true;
break;
case 'I':
@@ -443,6 +483,11 @@ main(int argc, char **argv) {
printsyncadd = true;
break;
}
if (!strncmp(p, "ds", 2)) {
p += 2;
printdsadd = true;
break;
}
printpub = true;
break;
case 'R':
@@ -777,6 +822,18 @@ main(int argc, char **argv) {
dst_key_unsettime(key, DST_TIME_SYNCDELETE);
}
if (setdsadd) {
dst_key_settime(key, DST_TIME_DSPUBLISH, dsadd);
} else if (unsetdsadd) {
dst_key_unsettime(key, DST_TIME_DSPUBLISH);
}
if (setdsdel) {
dst_key_settime(key, DST_TIME_DSDELETE, dsdel);
} else if (unsetdsdel) {
dst_key_unsettime(key, DST_TIME_DSDELETE);
}
if (setttl) {
dst_key_setttl(key, ttl);
}
@@ -894,6 +951,14 @@ main(int argc, char **argv) {
stdout);
}
if (printdsadd) {
printtime(key, DST_TIME_DSPUBLISH, "DS Publish", epoch, stdout);
}
if (printdsdel) {
printtime(key, DST_TIME_DSDELETE, "DS Delete", epoch, stdout);
}
if (changed) {
writekey(key, directory, write_state);
if (predecessor != NULL && prevkey != NULL) {
+18 -9
View File
@@ -29,7 +29,7 @@ dnssec-settime: set the key timing metadata for a DNSSEC key
Synopsis
~~~~~~~~
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] [**-E** engine] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** ds date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** ds date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] [**-E** engine] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
Description
~~~~~~~~~~~
@@ -126,6 +126,10 @@ explicitly prevent a date from being set, use ``none`` or ``never``.
that date, the key is included in the zone but is not used
to sign it.
``-P ds date/offset``
This option sets the date on which DS records that match this key have been
seen in the parent zone.
``-P sync date/offset``
This option sets the date on which CDS and CDNSKEY records that match this key
are to be published to the zone.
@@ -149,6 +153,10 @@ explicitly prevent a date from being set, use ``none`` or ``never``.
key is no longer included in the zone. (However, it may remain in the key
repository.)
``-D ds date/offset``
This option sets the date on which the DS records that match this key have
been seen removed from the parent zone.
``-D sync date/offset``
This option sets the date on which the CDS and CDNSKEY records that match this
key are to be deleted.
@@ -215,15 +223,16 @@ associated with a key.
``-u``
This option indicates that times should be printed in Unix epoch format.
``-p C/P/Psync/A/R/I/D/Dsync/all``
This option prints a specific metadata value or set of metadata values. The ``-p``
option may be followed by one or more of the following letters or
``-p C/P/Pds/Psync/A/R/I/D/Dds/Dsync/all``
This option prints a specific metadata value or set of metadata values.
The ``-p`` option may be followed by one or more of the following letters or
strings to indicate which value or values to print: ``C`` for the
creation date, ``P`` for the publication date, ``Psync`` for the CDS
and CDNSKEY publication date, ``A`` for the activation date, ``R``
for the revocation date, ``I`` for the inactivation date, ``D`` for
the deletion date, and ``Dsync`` for the CDS and CDNSKEY deletion
date. To print all of the metadata, use ``all``.
creation date, ``P`` for the publication date, ``Pds` for the DS publication
date, ``Psync`` for the CDS and CDNSKEY publication date, ``A`` for the
activation date, ``R`` for the revocation date, ``I`` for the inactivation
date, ``D`` for the deletion date, ``Dds`` for the DS deletion date,
and ``Dsync`` for the CDS and CDNSKEY deletion date. To print all of the
metadata, use ``all``.
See Also
~~~~~~~~
+2
View File
@@ -15,6 +15,7 @@ AM_CPPFLAGS += \
$(LMDB_CFLAGS) \
$(MAXMINDDB_CFLAGS) \
$(DNSTAP_CFLAGS) \
$(LIBUV_CFLAGS) \
$(ZLIB_CFLAGS)
if HAVE_JSON_C
@@ -102,6 +103,7 @@ named_LDADD = \
$(LMDB_LIBS) \
$(MAXMINDDB_LIBS) \
$(DNSTAP_LIBS) \
$(LIBUV_LIBS) \
$(LIBXML2_LIBS) \
$(ZLIB_LIBS)
+1
View File
@@ -196,6 +196,7 @@ options {\n\
# sortlist <none>\n\
stale-answer-enable false;\n\
stale-answer-ttl 1; /* 1 second */\n\
stale-cache-enable false;\n\
synth-from-dnssec no;\n\
# topology <none>\n\
transfer-format many-answers;\n\
+434 -477
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -143,6 +143,7 @@ EXTERN bool named_g_memstatistics INIT(false);
EXTERN bool named_g_keepstderr INIT(false);
EXTERN unsigned int named_g_tat_interval INIT(24 * 3600);
EXTERN unsigned int named_g_maxcachesize INIT(0);
#if defined(HAVE_GEOIP2)
EXTERN dns_geoip_databases_t *named_g_geoip INIT(NULL);
+1 -2
View File
@@ -38,6 +38,7 @@
#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
#define NAMED_EVENT_COMMAND (NAMED_EVENTCLASS + 2)
/*%
* Name server state. Better here than in lots of separate global variables.
@@ -80,8 +81,6 @@ struct named_server {
uint32_t interface_interval;
uint32_t heartbeat_interval;
isc_mutex_t reload_event_lock;
isc_event_t * reload_event;
named_reload_t reload_status;
bool flushonshutdown;
+6
View File
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <uv.h>
#include <isc/app.h>
#include <isc/attributes.h>
@@ -525,6 +526,9 @@ printversion(bool verbose) {
printf("linked to OpenSSL version: %s\n",
SSLeay_version(SSLEAY_VERSION));
#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
printf("compiled with libuv version: %d.%d.%d\n", UV_VERSION_MAJOR,
UV_VERSION_MINOR, UV_VERSION_PATCH);
printf("linked to libuv version: %s\n", uv_version_string());
#ifdef HAVE_LIBXML2
printf("compiled with libxml2 version: %s\n", LIBXML_DOTTED_VERSION);
printf("linked to libxml2 version: %s\n", xmlParserVersion);
@@ -646,6 +650,8 @@ parse_T_opt(char *option) {
named_g_nosyslog = true;
} else if (!strcmp(option, "notcp")) {
notcp = true;
} else if (!strncmp(option, "maxcachesize=", 13)) {
named_g_maxcachesize = atoi(option + 13);
} else if (!strcmp(option, "maxudp512")) {
maxudp = 512;
} else if (!strcmp(option, "maxudp1460")) {
+2 -1
View File
@@ -68,7 +68,6 @@ DNSSEC-POLICY
max-zone-ttl duration;
parent-ds-ttl duration;
parent-propagation-delay duration;
parent-registration-delay duration;
publish-safety duration;
retire-safety duration;
signatures-refresh duration;
@@ -401,6 +400,7 @@ OPTIONS
stacksize ( default | unlimited | sizeval );
stale-answer-enable boolean;
stale-answer-ttl duration;
stale-cache-enable boolean;
startup-notify-rate integer;
statistics-file quoted_string;
synth-from-dnssec boolean;
@@ -785,6 +785,7 @@ VIEW
sortlist { address_match_element; ... };
stale-answer-enable boolean;
stale-answer-ttl duration;
stale-cache-enable boolean;
synth-from-dnssec boolean;
transfer-format ( many-answers | one-answer );
transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [
+276 -86
View File
@@ -89,6 +89,7 @@
#include <dns/secalg.h>
#include <dns/soa.h>
#include <dns/stats.h>
#include <dns/time.h>
#include <dns/tkey.h>
#include <dns/tsig.h>
#include <dns/ttl.h>
@@ -3895,7 +3896,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
uint32_t max_cache_size_percent = 0;
size_t max_adb_size;
uint32_t lame_ttl, fail_ttl;
uint32_t max_stale_ttl;
uint32_t max_stale_ttl = 0;
dns_tsig_keyring_t *ring = NULL;
dns_view_t *pview = NULL; /* Production view */
isc_mem_t *cmctx = NULL, *hmctx = NULL;
@@ -4113,7 +4114,16 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
obj = NULL;
result = named_config_get(maps, "max-cache-size", &obj);
INSIST(result == ISC_R_SUCCESS);
if (cfg_obj_isstring(obj)) {
/*
* If "-T maxcachesize=..." is in effect, it overrides any other
* "max-cache-size" setting found in configuration, either implicit or
* explicit. For simplicity, the value passed to that command line
* option is always treated as the number of bytes to set
* "max-cache-size" to.
*/
if (named_g_maxcachesize != 0) {
max_cache_size = named_g_maxcachesize;
} else if (cfg_obj_isstring(obj)) {
str = cfg_obj_asstring(obj);
INSIST(strcasecmp(str, "unlimited") == 0);
max_cache_size = 0;
@@ -4358,9 +4368,18 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
view->synthfromdnssec = cfg_obj_asboolean(obj);
obj = NULL;
result = named_config_get(maps, "max-stale-ttl", &obj);
result = named_config_get(maps, "stale-cache-enable", &obj);
INSIST(result == ISC_R_SUCCESS);
max_stale_ttl = ISC_MAX(cfg_obj_asduration(obj), 1);
if (cfg_obj_asboolean(obj)) {
obj = NULL;
result = named_config_get(maps, "max-stale-ttl", &obj);
INSIST(result == ISC_R_SUCCESS);
max_stale_ttl = ISC_MAX(cfg_obj_asduration(obj), 1);
}
/*
* If 'stale-cache-enable' is false, max_stale_ttl is set to 0,
* meaning keeping stale RRsets in cache is disabled.
*/
obj = NULL;
result = named_config_get(maps, "stale-answer-enable", &obj);
@@ -7574,6 +7593,8 @@ count_newzones(dns_view_t *view, ns_cfgctx_t *nzcfg, int *num_zonesp) {
REQUIRE(num_zonesp != NULL);
LOCK(&view->new_zone_lock);
CHECK(migrate_nzf(view));
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -7596,6 +7617,8 @@ cleanup:
*num_zonesp = 0;
}
UNLOCK(&view->new_zone_lock);
return (ISC_R_SUCCESS);
}
@@ -7924,6 +7947,8 @@ typedef isc_result_t (*newzone_cfg_cb_t)(const cfg_obj_t *zconfig,
* Immediately interrupt processing if an error is encountered while
* transforming NZD data into a zone configuration object or if "callback"
* returns an error.
*
* Caller must hold 'view->new_zone_lock'.
*/
static isc_result_t
for_all_newzone_cfgs(newzone_cfg_cb_t callback, cfg_obj_t *config,
@@ -8032,8 +8057,11 @@ configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
return (ISC_R_SUCCESS);
}
LOCK(&view->new_zone_lock);
result = nzd_open(view, MDB_RDONLY, &txn, &dbi);
if (result != ISC_R_SUCCESS) {
UNLOCK(&view->new_zone_lock);
return (ISC_R_SUCCESS);
}
@@ -8059,6 +8087,9 @@ configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
}
(void)nzd_close(&txn, false);
UNLOCK(&view->new_zone_lock);
return (result);
}
@@ -8079,6 +8110,8 @@ get_newzone_config(dns_view_t *view, const char *zonename,
INSIST(zoneconfig != NULL && *zoneconfig == NULL);
LOCK(&view->new_zone_lock);
CHECK(nzd_open(view, MDB_RDONLY, &txn, &dbi));
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -8112,6 +8145,8 @@ get_newzone_config(dns_view_t *view, const char *zonename,
cleanup:
(void)nzd_close(&txn, false);
UNLOCK(&view->new_zone_lock);
if (zoneconf != NULL) {
cfg_obj_destroy(named_g_addparser, &zoneconf);
}
@@ -8362,7 +8397,14 @@ load_configuration(const char *filename, named_server_t *server,
result = cfg_parse_file(bindkeys_parser, server->bindkeysfile,
&cfg_type_bindkeys, &bindkeys);
CHECK(result);
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"unable to parse '%s' error '%s'; using "
"built-in keys instead",
server->bindkeysfile,
isc_result_totext(result));
}
} else {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
@@ -9641,7 +9683,7 @@ load_zones(named_server_t *server, bool init, bool reconfig) {
isc_refcount_increment(&zl->refs);
result = dns_view_asyncload(view, reconfig, view_loaded, zl);
if (result != ISC_R_SUCCESS) {
(void)isc_refcount_decrement(&zl->refs);
isc_refcount_decrement1(&zl->refs);
goto cleanup;
}
}
@@ -9913,14 +9955,6 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
&server->in_roothints),
"setting up root hints");
isc_mutex_init(&server->reload_event_lock);
server->reload_event = isc_event_allocate(
named_g_mctx, server, NAMED_EVENT_RELOAD, named_server_reload,
server, sizeof(isc_event_t));
CHECKFATAL(server->reload_event == NULL ? ISC_R_NOMEMORY
: ISC_R_SUCCESS,
"allocating reload event");
server->reload_status = NAMED_RELOAD_IN_PROGRESS;
/*
@@ -10090,9 +10124,6 @@ named_server_destroy(named_server_t **serverp) {
dst_lib_destroy();
isc_event_free(&server->reload_event);
isc_mutex_destroy(&server->reload_event_lock);
INSIST(ISC_LIST_EMPTY(server->kasplist));
INSIST(ISC_LIST_EMPTY(server->viewlist));
INSIST(ISC_LIST_EMPTY(server->cachelist));
@@ -10104,7 +10135,7 @@ named_server_destroy(named_server_t **serverp) {
static void
fatal(named_server_t *server, const char *msg, isc_result_t result) {
if (server != NULL) {
if (server != NULL && server->task != NULL) {
/*
* Prevent races between the OpenSSL on_exit registered
* function and any other OpenSSL calls from other tasks
@@ -10270,7 +10301,7 @@ cleanup:
*/
static void
named_server_reload(isc_task_t *task, isc_event_t *event) {
named_server_t *server = (named_server_t *)event->ev_arg;
named_server_t *server = (named_server_t *)event->ev_sender;
INSIST(task == server->task);
UNUSED(task);
@@ -10280,19 +10311,15 @@ named_server_reload(isc_task_t *task, isc_event_t *event) {
"received SIGHUP signal to reload zones");
(void)reload(server);
LOCK(&server->reload_event_lock);
INSIST(server->reload_event == NULL);
server->reload_event = event;
UNLOCK(&server->reload_event_lock);
isc_event_free(&event);
}
void
named_server_reloadwanted(named_server_t *server) {
LOCK(&server->reload_event_lock);
if (server->reload_event != NULL) {
isc_task_send(server->task, &server->reload_event);
}
UNLOCK(&server->reload_event_lock);
isc_event_t *event = isc_event_allocate(
named_g_mctx, server, NAMED_EVENT_RELOAD, named_server_reload,
NULL, sizeof(isc_event_t));
isc_task_send(server->task, &event);
}
void
@@ -12063,12 +12090,10 @@ cleanup:
isc_result_t
named_server_tsiglist(named_server_t *server, isc_buffer_t **text) {
isc_result_t result;
isc_result_t result = ISC_R_SUCCESS;
dns_view_t *view;
unsigned int foundkeys = 0;
result = isc_task_beginexclusive(server->task);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
for (view = ISC_LIST_HEAD(server->viewlist); view != NULL;
view = ISC_LIST_NEXT(view, link))
{
@@ -12077,7 +12102,6 @@ named_server_tsiglist(named_server_t *server, isc_buffer_t **text) {
&foundkeys);
RWUNLOCK(&view->statickeys->lock, isc_rwlocktype_read);
if (result != ISC_R_SUCCESS) {
isc_task_endexclusive(server->task);
return (result);
}
RWLOCK(&view->dynamickeys->lock, isc_rwlocktype_read);
@@ -12085,11 +12109,9 @@ named_server_tsiglist(named_server_t *server, isc_buffer_t **text) {
&foundkeys);
RWUNLOCK(&view->dynamickeys->lock, isc_rwlocktype_read);
if (result != ISC_R_SUCCESS) {
isc_task_endexclusive(server->task);
return (result);
}
}
isc_task_endexclusive(server->task);
if (foundkeys == 0) {
CHECK(putstr(text, "no tsig keys found."));
@@ -12569,8 +12591,6 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
nzd_setkey(&key, dns_zone_getorigin(zone), namebuf, sizeof(namebuf));
LOCK(&view->new_zone_lock);
if (zconfig == NULL) {
/* We're deleting the zone from the database */
status = mdb_del(*txnp, dbi, &key, NULL);
@@ -12650,8 +12670,6 @@ cleanup:
}
*txnp = NULL;
UNLOCK(&view->new_zone_lock);
if (text != NULL) {
isc_buffer_free(&text);
}
@@ -12659,6 +12677,11 @@ cleanup:
return (result);
}
/*
* Check whether the new zone database for 'view' can be opened for writing.
*
* Caller must hold 'view->new_zone_lock'.
*/
static isc_result_t
nzd_writable(dns_view_t *view) {
isc_result_t result = ISC_R_SUCCESS;
@@ -12688,6 +12711,11 @@ nzd_writable(dns_view_t *view) {
return (result);
}
/*
* Open the new zone database for 'view' and start a transaction for it.
*
* Caller must hold 'view->new_zone_lock'.
*/
static isc_result_t
nzd_open(dns_view_t *view, unsigned int flags, MDB_txn **txnp, MDB_dbi *dbi) {
int status;
@@ -12815,6 +12843,13 @@ cleanup:
return (result);
}
/*
* If 'commit' is true, commit the new zone database transaction pointed to by
* 'txnp'; otherwise, abort that transaction.
*
* Caller must hold 'view->new_zone_lock' for the view that the transaction
* pointed to by 'txnp' was started for.
*/
static isc_result_t
nzd_close(MDB_txn **txnp, bool commit) {
isc_result_t result = ISC_R_SUCCESS;
@@ -12837,6 +12872,12 @@ nzd_close(MDB_txn **txnp, bool commit) {
return (result);
}
/*
* Count the zones configured in the new zone database for 'view' and store the
* result in 'countp'.
*
* Caller must hold 'view->new_zone_lock'.
*/
static isc_result_t
nzd_count(dns_view_t *view, int *countp) {
isc_result_t result;
@@ -12869,6 +12910,10 @@ cleanup:
return (result);
}
/*
* Migrate zone configuration from an NZF file to an NZD database.
* Caller must hold view->new_zone_lock.
*/
static isc_result_t
migrate_nzf(dns_view_t *view) {
isc_result_t result;
@@ -13228,6 +13273,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
MDB_dbi dbi;
UNUSED(zoneconf);
LOCK(&view->new_zone_lock);
#endif /* HAVE_LMDB */
/* Zone shouldn't already exist */
@@ -13381,6 +13427,7 @@ cleanup:
if (txn != NULL) {
(void)nzd_close(&txn, false);
}
UNLOCK(&view->new_zone_lock);
#endif /* HAVE_LMDB */
if (zone != NULL) {
@@ -13404,6 +13451,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
#else /* HAVE_LMDB */
MDB_txn *txn = NULL;
MDB_dbi dbi;
LOCK(&view->new_zone_lock);
#endif /* HAVE_LMDB */
/* Zone must already exist */
@@ -13601,6 +13649,7 @@ cleanup:
if (txn != NULL) {
(void)nzd_close(&txn, false);
}
UNLOCK(&view->new_zone_lock);
#endif /* HAVE_LMDB */
if (zone != NULL) {
@@ -13764,6 +13813,7 @@ rmzone(isc_task_t *task, isc_event_t *event) {
if (added && cfg != NULL) {
#ifdef HAVE_LMDB
/* Make sure we can open the NZD database */
LOCK(&view->new_zone_lock);
result = nzd_open(view, 0, &txn, &dbi);
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -13781,6 +13831,11 @@ rmzone(isc_task_t *task, isc_event_t *event) {
"delete zone configuration: %s",
isc_result_totext(result));
}
if (txn != NULL) {
(void)nzd_close(&txn, false);
}
UNLOCK(&view->new_zone_lock);
#else /* ifdef HAVE_LMDB */
result = delete_zoneconf(view, cfg->add_parser, cfg->nzf_config,
dns_zone_getorigin(zone),
@@ -13870,11 +13925,6 @@ rmzone(isc_task_t *task, isc_event_t *event) {
}
}
#ifdef HAVE_LMDB
if (txn != NULL) {
(void)nzd_close(&txn, false);
}
#endif /* ifdef HAVE_LMDB */
if (raw != NULL) {
dns_zone_detach(&raw);
}
@@ -14110,7 +14160,6 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex,
dns_view_t *view = NULL;
dns_zone_t *zone = NULL;
ns_cfgctx_t *cfg = NULL;
bool exclusive = false;
#ifdef HAVE_LMDB
cfg_obj_t *nzconfig = NULL;
#endif /* HAVE_LMDB */
@@ -14135,10 +14184,6 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex,
goto cleanup;
}
result = isc_task_beginexclusive(server->task);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
exclusive = true;
if (!added) {
/* Find the view statement */
vconfig = find_name_in_list_from_map(cfg->config, "view",
@@ -14197,9 +14242,6 @@ cleanup:
if (isc_buffer_usedlength(*text) > 0) {
(void)putnull(text);
}
if (exclusive) {
isc_task_endexclusive(server->task);
}
return (result);
}
@@ -14465,6 +14507,23 @@ cleanup:
return (result);
}
static inline bool
argcheck(char *cmd, const char *full) {
size_t l;
if (cmd == NULL || cmd[0] != '-') {
return (false);
}
cmd++;
l = strlen(cmd);
if (l > strlen(full) || strncasecmp(cmd, full, l) != 0) {
return (false);
}
return (true);
}
isc_result_t
named_server_dnssec(named_server_t *server, isc_lex_t *lex,
isc_buffer_t **text) {
@@ -14473,11 +14532,17 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
dns_kasp_t *kasp = NULL;
dns_dnsseckeylist_t keys;
dns_dnsseckey_t *key;
const char *ptr;
char *ptr;
const char *msg = NULL;
/* variables for -checkds */
bool checkds = false, dspublish = false, use_keyid = false;
dns_keytag_t keyid = 0;
uint8_t algorithm = 0;
/* variables for -status */
bool status = false;
char output[4096];
isc_stdtime_t now;
isc_time_t timenow;
isc_stdtime_t now, when;
isc_time_t timenow, timewhen;
const char *dir;
/* Skip the command name. */
@@ -14492,43 +14557,184 @@ named_server_dnssec(named_server_t *server, isc_lex_t *lex,
return (ISC_R_UNEXPECTEDEND);
}
if (strcasecmp(ptr, "-status") != 0) {
return (DNS_R_SYNTAX);
}
/* Initialize current time and key list. */
TIME_NOW(&timenow);
now = isc_time_seconds(&timenow);
when = now;
ISC_LIST_INIT(keys);
if (strcasecmp(ptr, "-status") == 0) {
status = true;
} else if (strcasecmp(ptr, "-checkds") == 0) {
checkds = true;
/* Check for options */
for (;;) {
ptr = next_token(lex, text);
if (ptr == NULL) {
msg = "Bad format";
CHECK(ISC_R_UNEXPECTEDEND);
} else if (argcheck(ptr, "alg")) {
isc_consttextregion_t alg;
ptr = next_token(lex, text);
if (ptr == NULL) {
msg = "No key algorithm specified";
CHECK(ISC_R_UNEXPECTEDEND);
}
alg.base = ptr;
alg.length = strlen(alg.base);
result = dns_secalg_fromtext(
&algorithm, (isc_textregion_t *)&alg);
if (result != ISC_R_SUCCESS) {
msg = "Bad algorithm";
CHECK(DNS_R_SYNTAX);
}
continue;
} else if (argcheck(ptr, "key")) {
uint16_t id;
ptr = next_token(lex, text);
if (ptr == NULL) {
msg = "No key identifier specified";
CHECK(ISC_R_UNEXPECTEDEND);
}
CHECK(isc_parse_uint16(&id, ptr, 10));
keyid = (dns_keytag_t)id;
use_keyid = true;
continue;
} else if (argcheck(ptr, "when")) {
uint32_t tw;
ptr = next_token(lex, text);
if (ptr == NULL) {
msg = "No time specified";
CHECK(ISC_R_UNEXPECTEDEND);
}
CHECK(dns_time32_fromtext(ptr, &tw));
when = (isc_stdtime_t)tw;
continue;
} else if (ptr[0] == '-') {
msg = "Unknown option";
CHECK(DNS_R_SYNTAX);
} else {
/*
* No arguments provided, so we must be
* parsing "published|withdrawn".
*/
if (strcasecmp(ptr, "published") == 0) {
dspublish = true;
} else if (strcasecmp(ptr, "withdrawn") != 0) {
CHECK(DNS_R_SYNTAX);
}
}
break;
}
if (algorithm > 0 && !use_keyid) {
msg = "Key id is required when setting algorithm";
CHECK(DNS_R_SYNTAX);
}
} else {
CHECK(DNS_R_SYNTAX);
}
/* Get zone. */
CHECK(zone_from_args(server, lex, NULL, &zone, NULL, text, false));
if (zone == NULL) {
msg = "Zone not found";
CHECK(ISC_R_UNEXPECTEDEND);
}
/* Trailing garbage? */
ptr = next_token(lex, text);
if (ptr != NULL) {
msg = "Too many arguments";
CHECK(DNS_R_SYNTAX);
}
/* Get dnssec-policy. */
kasp = dns_zone_getkasp(zone);
if (kasp == NULL) {
CHECK(putstr(text, "zone does not have dnssec-policy"));
CHECK(putnull(text));
msg = "Zone does not have dnssec-policy";
goto cleanup;
}
/* -status */
TIME_NOW(&timenow);
now = isc_time_seconds(&timenow);
/* Get DNSSEC keys. */
dir = dns_zone_getkeydirectory(zone);
LOCK(&kasp->lock);
result = dns_dnssec_findmatchingkeys(dns_zone_getorigin(zone), dir, now,
dns_zone_getmctx(zone), &keys);
UNLOCK(&kasp->lock);
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
goto cleanup;
}
LOCK(&kasp->lock);
dns_keymgr_status(kasp, &keys, now, &output[0], sizeof(output));
UNLOCK(&kasp->lock);
CHECK(putstr(text, output));
if (status) {
/*
* Output the DNSSEC status of the key and signing policy.
*/
LOCK(&kasp->lock);
dns_keymgr_status(kasp, &keys, now, &output[0], sizeof(output));
UNLOCK(&kasp->lock);
CHECK(putstr(text, output));
} else if (checkds) {
/*
* Mark DS record has been seen, so it may move to the
* rumoured state.
*/
char whenbuf[80];
isc_time_set(&timewhen, when, 0);
isc_time_formattimestamp(&timewhen, whenbuf, sizeof(whenbuf));
LOCK(&kasp->lock);
if (use_keyid) {
result = dns_keymgr_checkds_id(kasp, &keys, dir, when,
dspublish, keyid,
(unsigned int)algorithm);
} else {
result = dns_keymgr_checkds(kasp, &keys, dir, when,
dspublish);
}
UNLOCK(&kasp->lock);
switch (result) {
case ISC_R_SUCCESS:
if (use_keyid) {
char tagbuf[6];
snprintf(tagbuf, sizeof(tagbuf), "%u", keyid);
CHECK(putstr(text, "KSK "));
CHECK(putstr(text, tagbuf));
CHECK(putstr(text, ": "));
}
CHECK(putstr(text, "Marked DS as "));
if (dspublish) {
CHECK(putstr(text, "published "));
} else {
CHECK(putstr(text, "withdrawn "));
}
CHECK(putstr(text, "since "));
CHECK(putstr(text, whenbuf));
break;
case ISC_R_NOTFOUND:
CHECK(putstr(text, "No matching KSK found"));
break;
case ISC_R_FAILURE:
CHECK(putstr(text,
"Error: multiple possible KSKs found, "
"retry command with -key id"));
break;
default:
CHECK(putstr(text, "Error executing checkds command"));
break;
}
}
CHECK(putnull(text));
cleanup:
if (msg != NULL) {
(void)putstr(text, msg);
(void)putnull(text);
}
while (!ISC_LIST_EMPTY(keys)) {
key = ISC_LIST_HEAD(keys);
ISC_LIST_UNLINK(keys, key, link);
@@ -14659,14 +14865,15 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
/* Serial number */
result = dns_zone_getserial(mayberaw, &serial);
/* XXXWPK TODO this is to mirror old behavior with dns_zone_getserial */
/* This is to mirror old behavior with dns_zone_getserial */
if (result != ISC_R_SUCCESS) {
serial = 0;
}
snprintf(serbuf, sizeof(serbuf), "%u", serial);
if (hasraw) {
result = dns_zone_getserial(zone, &signed_serial);
/* XXXWPK TODO ut supra */
if (result != ISC_R_SUCCESS) {
serial = 0;
}
@@ -14873,23 +15080,6 @@ cleanup:
return (result);
}
static inline bool
argcheck(char *cmd, const char *full) {
size_t l;
if (cmd == NULL || cmd[0] != '-') {
return (false);
}
cmd++;
l = strlen(cmd);
if (l > strlen(full) || strncasecmp(cmd, full, l) != 0) {
return (false);
}
return (true);
}
isc_result_t
named_server_nta(named_server_t *server, isc_lex_t *lex, bool readonly,
isc_buffer_t **text) {
+171 -293
View File
@@ -22,7 +22,6 @@
#include <isc/socket.h>
#include <isc/stats.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/cache.h>
@@ -54,6 +53,14 @@
#include "xsl_p.h"
#define CHECK(m) \
do { \
result = (m); \
if (result != ISC_R_SUCCESS) { \
goto cleanup; \
} \
} while (0)
struct named_statschannel {
/* Unlocked */
isc_httpdmgr_t *httpdmgr;
@@ -170,11 +177,11 @@ static const char *gluecachestats_xmldesc[dns_gluecachestatscounter_max];
#define gluecachestats_xmldesc NULL
#endif /* EXTENDED_STATS */
#define TRY0(a) \
do { \
xmlrc = (a); \
if (xmlrc < 0) \
goto error; \
#define TRY0(a) \
do { \
xmlrc = (a); \
if (xmlrc < 0) \
goto cleanup; \
} while (0)
/*%
@@ -1424,7 +1431,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
}
return (ISC_R_SUCCESS);
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at dump_counters()");
@@ -1486,7 +1493,7 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
}
return;
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at rdtypestat_dump()");
@@ -1574,7 +1581,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
}
return;
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at rdatasetstats_dump()");
@@ -1629,7 +1636,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
return;
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at opcodestat_dump()");
@@ -1685,7 +1692,7 @@ rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) {
return;
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at rcodestat_dump()");
@@ -1738,7 +1745,7 @@ dnssecsignstat_dump(dns_keytag_t tag, uint64_t val, void *arg) {
}
return;
#ifdef HAVE_LIBXML2
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at dnssecsignstat_dump()");
@@ -1772,6 +1779,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
int xmlrc;
stats_dumparg_t dumparg;
const char *ztype;
isc_time_t timestamp;
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
@@ -1814,12 +1822,8 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
* master zones, only include the loaded time. For slave zones, also
* include the expires and refresh times.
*/
isc_time_t timestamp;
result = dns_zone_getloadtime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getloadtime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "loaded"));
@@ -1827,19 +1831,13 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer));
if (dns_zone_gettype(zone) == dns_zone_slave) {
result = dns_zone_getexpiretime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getexpiretime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "expires"));
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR buf));
TRY0(xmlTextWriterEndElement(writer));
result = dns_zone_getrefreshtime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getrefreshtime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "refresh"));
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR buf));
@@ -1862,14 +1860,11 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
ISC_XMLCHAR "type",
ISC_XMLCHAR "rcode"));
result = dump_counters(zonestats, isc_statsformat_xml,
writer, NULL, nsstats_xmldesc,
ns_statscounter_max,
nsstats_index, nsstat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(zonestats, isc_statsformat_xml,
writer, NULL, nsstats_xmldesc,
ns_statscounter_max, nsstats_index,
nsstat_values,
ISC_STATSDUMP_VERBOSE));
/* counters type="rcode"*/
TRY0(xmlTextWriterEndElement(writer));
}
@@ -1882,15 +1877,12 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "gluecache"));
result = dump_counters(
CHECK(dump_counters(
gluecachestats, isc_statsformat_xml, writer,
NULL, gluecachestats_xmldesc,
dns_gluecachestatscounter_max,
gluecachestats_index, gluecachestats_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
ISC_STATSDUMP_VERBOSE));
/* counters type="rcode"*/
TRY0(xmlTextWriterEndElement(writer));
}
@@ -1906,9 +1898,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
dumparg.result = ISC_R_SUCCESS;
dns_rdatatypestats_dump(rcvquerystats, rdtypestat_dump,
&dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
/* counters type="qtype"*/
TRY0(xmlTextWriterEndElement(writer));
@@ -1927,9 +1917,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
dns_dnssecsignstats_dump(
dnssecsignstats, dns_dnssecsignstats_sign,
dnssecsignstat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
/* counters type="dnssec-sign"*/
TRY0(xmlTextWriterEndElement(writer));
@@ -1945,9 +1933,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
dns_dnssecsignstats_dump(
dnssecsignstats, dns_dnssecsignstats_refresh,
dnssecsignstat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
/* counters type="dnssec-refresh"*/
TRY0(xmlTextWriterEndElement(writer));
@@ -1957,7 +1943,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer)); /* zone */
return (ISC_R_SUCCESS);
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Failed at zone_xmlrender()");
@@ -1999,7 +1985,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
writer = xmlNewTextWriterDoc(&doc, 0);
if (writer == NULL) {
goto error;
goto cleanup;
}
TRY0(xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL));
TRY0(xmlTextWriterWritePI(writer, ISC_XMLCHAR "xml-stylesheet",
@@ -2037,9 +2023,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dns_opcodestats_dump(server->sctx->opcodestats, opcodestat_dump,
&dumparg, ISC_STATSDUMP_VERBOSE);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
TRY0(xmlTextWriterEndElement(writer));
@@ -2049,9 +2033,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dns_rcodestats_dump(server->sctx->rcodestats, rcodestat_dump,
&dumparg, ISC_STATSDUMP_VERBOSE);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
TRY0(xmlTextWriterEndElement(writer));
@@ -2062,23 +2044,19 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dumparg.result = ISC_R_SUCCESS;
dns_rdatatypestats_dump(server->sctx->rcvquerystats,
rdtypestat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
TRY0(xmlTextWriterEndElement(writer)); /* counters */
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "nsstat"));
result = dump_counters(ns_stats_get(server->sctx->nsstats),
isc_statsformat_xml, writer, NULL,
nsstats_xmldesc, ns_statscounter_max,
nsstats_index, nsstat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(ns_stats_get(server->sctx->nsstats),
isc_statsformat_xml, writer, NULL,
nsstats_xmldesc, ns_statscounter_max,
nsstats_index, nsstat_values,
ISC_STATSDUMP_VERBOSE));
TRY0(xmlTextWriterEndElement(writer)); /* /nsstat */
@@ -2086,14 +2064,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "zonestat"));
result = dump_counters(server->zonestats, isc_statsformat_xml,
writer, NULL, zonestats_xmldesc,
dns_zonestatscounter_max,
zonestats_index, zonestat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(server->zonestats, isc_statsformat_xml,
writer, NULL, zonestats_xmldesc,
dns_zonestatscounter_max, zonestats_index,
zonestat_values, ISC_STATSDUMP_VERBOSE));
TRY0(xmlTextWriterEndElement(writer)); /* /zonestat */
@@ -2104,13 +2078,11 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "resstat"));
result = dump_counters(
server->resolverstats, isc_statsformat_xml, writer,
NULL, resstats_xmldesc, dns_resstatscounter_max,
resstats_index, resstat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(server->resolverstats, isc_statsformat_xml,
writer, NULL, resstats_xmldesc,
dns_resstatscounter_max, resstats_index,
resstat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* resstat */
#ifdef HAVE_DNSTAP
@@ -2127,9 +2099,8 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dnstapstats_xmldesc, dns_dnstapcounter_max,
dnstapstats_index, dnstapstat_values, 0);
isc_stats_detach(&dnstapstats);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(result);
TRY0(xmlTextWriterEndElement(writer)); /* dnstap */
}
#endif /* ifdef HAVE_DNSTAP */
@@ -2140,14 +2111,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "sockstat"));
result = dump_counters(server->sockstats, isc_statsformat_xml,
writer, NULL, sockstats_xmldesc,
isc_sockstatscounter_max,
sockstats_index, sockstat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(server->sockstats, isc_statsformat_xml,
writer, NULL, sockstats_xmldesc,
isc_sockstatscounter_max, sockstats_index,
sockstat_values, ISC_STATSDUMP_VERBOSE));
TRY0(xmlTextWriterEndElement(writer)); /* /sockstat */
}
@@ -2161,13 +2128,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "request-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->udpinstats4, isc_statsformat_xml, writer,
NULL, udpinsizestats_xmldesc, dns_sizecounter_in_max,
udpinsizestats_index, udpinsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
udpinsizestats_index, udpinsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
@@ -2175,13 +2139,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "response-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->udpoutstats4, isc_statsformat_xml, writer,
NULL, udpoutsizestats_xmldesc, dns_sizecounter_out_max,
udpoutsizestats_index, udpoutsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
udpoutsizestats_index, udpoutsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
TRY0(xmlTextWriterEndElement(writer)); /* </udp> */
@@ -2191,27 +2152,20 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "request-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->tcpinstats4, isc_statsformat_xml, writer,
NULL, tcpinsizestats_xmldesc, dns_sizecounter_in_max,
tcpinsizestats_index, tcpinsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
tcpinsizestats_index, tcpinsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "response-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->tcpoutstats4, isc_statsformat_xml, writer,
NULL, tcpoutsizestats_xmldesc, dns_sizecounter_out_max,
tcpoutsizestats_index, tcpoutsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
tcpoutsizestats_index, tcpoutsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
TRY0(xmlTextWriterEndElement(writer)); /* </tcp> */
@@ -2223,13 +2177,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "request-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->udpinstats6, isc_statsformat_xml, writer,
NULL, udpinsizestats_xmldesc, dns_sizecounter_in_max,
udpinsizestats_index, udpinsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
udpinsizestats_index, udpinsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
@@ -2237,13 +2188,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "response-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->udpoutstats6, isc_statsformat_xml, writer,
NULL, udpoutsizestats_xmldesc, dns_sizecounter_out_max,
udpoutsizestats_index, udpoutsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
udpoutsizestats_index, udpoutsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
TRY0(xmlTextWriterEndElement(writer)); /* </udp> */
@@ -2253,13 +2201,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "request-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->tcpinstats6, isc_statsformat_xml, writer,
NULL, tcpinsizestats_xmldesc, dns_sizecounter_in_max,
tcpinsizestats_index, tcpinsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
tcpinsizestats_index, tcpinsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
@@ -2267,13 +2212,10 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "response-size"));
result = dump_counters(
CHECK(dump_counters(
server->sctx->tcpoutstats6, isc_statsformat_xml, writer,
NULL, tcpoutsizestats_xmldesc, dns_sizecounter_out_max,
tcpoutsizestats_index, tcpoutsizestat_values, 0);
if (result != ISC_R_SUCCESS) {
goto error;
}
tcpoutsizestats_index, tcpoutsizestat_values, 0));
TRY0(xmlTextWriterEndElement(writer)); /* </counters> */
TRY0(xmlTextWriterEndElement(writer)); /* </tcp> */
@@ -2296,11 +2238,8 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
if ((flags & STATS_XML_ZONES) != 0) {
TRY0(xmlTextWriterStartElement(writer,
ISC_XMLCHAR "zones"));
result = dns_zt_apply(view->zonetable, true, NULL,
zone_xmlrender, writer);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zt_apply(view->zonetable, true, NULL,
zone_xmlrender, writer));
TRY0(xmlTextWriterEndElement(writer)); /* /zones */
}
@@ -2318,9 +2257,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dumparg.result = ISC_R_SUCCESS;
dns_rdatatypestats_dump(view->resquerystats,
rdtypestat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
}
TRY0(xmlTextWriterEndElement(writer));
@@ -2329,14 +2266,11 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "resstats"));
if (view->resstats != NULL) {
result = dump_counters(
view->resstats, isc_statsformat_xml, writer,
NULL, resstats_xmldesc, dns_resstatscounter_max,
resstats_index, resstat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(view->resstats, isc_statsformat_xml,
writer, NULL, resstats_xmldesc,
dns_resstatscounter_max,
resstats_index, resstat_values,
ISC_STATSDUMP_VERBOSE));
}
TRY0(xmlTextWriterEndElement(writer)); /* </resstats> */
@@ -2350,9 +2284,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
dumparg.result = ISC_R_SUCCESS;
dns_rdatasetstats_dump(cacherrstats, rdatasetstats_dump,
&dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dumparg.result);
TRY0(xmlTextWriterEndElement(writer)); /* cache */
}
@@ -2361,14 +2293,11 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "adbstat"));
if (view->adbstats != NULL) {
result = dump_counters(
view->adbstats, isc_statsformat_xml, writer,
NULL, adbstats_xmldesc, dns_adbstats_max,
adbstats_index, adbstat_values,
ISC_STATSDUMP_VERBOSE);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dump_counters(view->adbstats, isc_statsformat_xml,
writer, NULL, adbstats_xmldesc,
dns_adbstats_max, adbstats_index,
adbstat_values,
ISC_STATSDUMP_VERBOSE));
}
TRY0(xmlTextWriterEndElement(writer)); /* </adbstats> */
@@ -2411,12 +2340,12 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
xmlDocDumpFormatMemoryEnc(doc, buf, buflen, "UTF-8", 0);
if (*buf == NULL) {
goto error;
goto cleanup;
}
xmlFreeDoc(doc);
return (ISC_R_SUCCESS);
error:
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed generating XML response");
@@ -2573,18 +2502,11 @@ render_xml_traffic(const char *url, isc_httpdurl_t *urlinfo,
#define STATS_JSON_TRAFFIC 0x20
#define STATS_JSON_ALL 0xff
#define CHECK(m) \
do { \
result = (m); \
if (result != ISC_R_SUCCESS) \
goto error; \
} while (0)
#define CHECKMEM(m) \
do { \
if (m == NULL) { \
result = ISC_R_NOMEMORY; \
goto error; \
goto cleanup; \
} \
} while (0)
@@ -2664,27 +2586,18 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
isc_time_t timestamp;
result = dns_zone_getloadtime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getloadtime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
json_object_object_add(zoneobj, "loaded", json_object_new_string(buf));
if (dns_zone_gettype(zone) == dns_zone_slave) {
result = dns_zone_getexpiretime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getexpiretime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
json_object_object_add(zoneobj, "expires",
json_object_new_string(buf));
result = dns_zone_getrefreshtime(zone, &timestamp);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zone_getrefreshtime(zone, &timestamp));
isc_time_formatISO8601(&timestamp, buf, 64);
json_object_object_add(zoneobj, "refresh",
json_object_new_string(buf));
@@ -2703,7 +2616,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
json_object *counters = json_object_new_object();
if (counters == NULL) {
result = ISC_R_NOMEMORY;
goto error;
goto cleanup;
}
result = dump_counters(zonestats, isc_statsformat_json,
@@ -2712,7 +2625,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
nsstats_index, nsstat_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2728,7 +2641,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
json_object *counters = json_object_new_object();
if (counters == NULL) {
result = ISC_R_NOMEMORY;
goto error;
goto cleanup;
}
result = dump_counters(
@@ -2738,7 +2651,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
gluecachestats_index, gluecachestats_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2762,7 +2675,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
&dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2787,7 +2700,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
dnssecsignstat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(sign_counters);
goto error;
goto cleanup;
}
if (json_object_get_object(sign_counters)->count != 0) {
@@ -2809,7 +2722,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
dnssecsignstat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(refresh_counters);
goto error;
goto cleanup;
}
if (json_object_get_object(refresh_counters)->count !=
@@ -2827,7 +2740,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
zoneobj = NULL;
result = ISC_R_SUCCESS;
error:
cleanup:
if (zoneobj != NULL) {
json_object_put(zoneobj);
}
@@ -2912,7 +2825,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
&dumparg, ISC_STATSDUMP_VERBOSE);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2931,7 +2844,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
&dumparg, ISC_STATSDUMP_VERBOSE);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2950,7 +2863,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
rdtypestat_dump, &dumparg, 0);
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2971,7 +2884,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
nsstats_index, nsstat_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -2992,7 +2905,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
zonestats_index, zonestat_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -3014,7 +2927,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
resstats_index, resstat_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -3039,7 +2952,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
isc_stats_detach(&dnstapstats);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -3069,12 +2982,8 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
CHECKMEM(za);
if ((flags & STATS_JSON_ZONES) != 0) {
result = dns_zt_apply(view->zonetable, true,
NULL, zone_jsonrender,
za);
if (result != ISC_R_SUCCESS) {
goto error;
}
CHECK(dns_zt_apply(view->zonetable, true, NULL,
zone_jsonrender, za));
}
if (json_object_array_length(za) != 0) {
@@ -3107,7 +3016,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
result = dumparg.result;
goto error;
goto cleanup;
}
json_object_object_add(res, "stats",
@@ -3127,7 +3036,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
result = dumparg.result;
goto error;
goto cleanup;
}
json_object_object_add(res, "qtypes",
@@ -3147,7 +3056,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
if (dumparg.result != ISC_R_SUCCESS) {
json_object_put(counters);
result = dumparg.result;
goto error;
goto cleanup;
}
json_object_object_add(res, "cache",
@@ -3161,7 +3070,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
counters);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
json_object_object_add(res, "cachestats",
@@ -3182,7 +3091,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
result = dumparg.result;
goto error;
goto cleanup;
}
json_object_object_add(res, "adb",
@@ -3208,7 +3117,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
sockstats_index, sockstat_values, 0);
if (result != ISC_R_SUCCESS) {
json_object_put(counters);
goto error;
goto cleanup;
}
if (json_object_get_object(counters)->count != 0) {
@@ -3224,7 +3133,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
result = isc_socketmgr_renderjson(named_g_socketmgr, sockets);
if (result != ISC_R_SUCCESS) {
json_object_put(sockets);
goto error;
goto cleanup;
}
json_object_object_add(bindstats, "socketmgr", sockets);
@@ -3237,7 +3146,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
result = isc_taskmgr_renderjson(named_g_taskmgr, tasks);
if (result != ISC_R_SUCCESS) {
json_object_put(tasks);
goto error;
goto cleanup;
}
json_object_object_add(bindstats, "taskmgr", tasks);
@@ -3250,7 +3159,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
result = isc_mem_renderjson(memory);
if (result != ISC_R_SUCCESS) {
json_object_put(memory);
goto error;
goto cleanup;
}
json_object_object_add(bindstats, "memory", memory);
@@ -3375,7 +3284,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
result = ISC_R_SUCCESS;
error:
cleanup:
if (udpreq4 != NULL) {
json_object_put(udpreq4);
}
@@ -3654,7 +3563,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
static void
destroy_listener(void *arg) {
named_statschannel_t *listener = arg;
named_statschannel_t *listener = (named_statschannel_t *)arg;
REQUIRE(listener != NULL);
REQUIRE(!ISC_LINK_LINKED(listener, link));
@@ -3672,22 +3581,15 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
const char *socktext) {
isc_result_t result;
named_statschannel_t *listener;
isc_task_t *task = NULL;
isc_socket_t *sock = NULL;
const cfg_obj_t *allow;
named_statschannel_t *listener = NULL;
const cfg_obj_t *allow = NULL;
dns_acl_t *new_acl = NULL;
int pf;
listener = isc_mem_get(server->mctx, sizeof(*listener));
listener->httpdmgr = NULL;
listener->address = *addr;
listener->acl = NULL;
listener->mctx = NULL;
*listener = (named_statschannel_t){ .address = *addr };
ISC_LINK_INIT(listener, link);
isc_mutex_init(&listener->lock);
isc_mem_attach(server->mctx, &listener->mctx);
allow = cfg_tuple_get(listen_params, "allow");
@@ -3698,104 +3600,80 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
} else {
result = dns_acl_any(listener->mctx, &new_acl);
}
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
CHECK(result);
dns_acl_attach(new_acl, &listener->acl);
dns_acl_detach(&new_acl);
result = isc_task_create(named_g_taskmgr, 0, &task);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
isc_task_setname(task, "statchannel", NULL);
result = isc_socket_create(named_g_socketmgr, isc_sockaddr_pf(addr),
isc_sockettype_tcp, &sock);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
isc_socket_setname(sock, "statchannel", NULL);
#ifndef ISC_ALLOW_MAPPED
isc_socket_ipv6only(sock, true);
#endif /* ifndef ISC_ALLOW_MAPPED */
result = isc_socket_bind(sock, addr, ISC_SOCKET_REUSEADDRESS);
if (result != ISC_R_SUCCESS) {
goto cleanup;
pf = isc_sockaddr_pf(&listener->address);
if ((pf == AF_INET && isc_net_probeipv4() != ISC_R_SUCCESS) ||
(pf == AF_INET6 && isc_net_probeipv6() != ISC_R_SUCCESS))
{
CHECK(ISC_R_FAMILYNOSUPPORT);
}
result = isc_httpdmgr_create(server->mctx, sock, task, client_ok,
destroy_listener, listener,
named_g_timermgr, &listener->httpdmgr);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
CHECK(isc_httpdmgr_create(named_g_nm, server->mctx, addr, client_ok,
destroy_listener, listener,
&listener->httpdmgr));
#ifdef HAVE_LIBXML2
isc_httpdmgr_addurl(listener->httpdmgr, "/", render_xml_all, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml", render_xml_all, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3", render_xml_all,
isc_httpdmgr_addurl(listener->httpdmgr, "/", false, render_xml_all,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/status",
isc_httpdmgr_addurl(listener->httpdmgr, "/xml", false, render_xml_all,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3", false,
render_xml_all, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/status", false,
render_xml_status, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/server",
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/server", false,
render_xml_server, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/zones",
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/zones", false,
render_xml_zones, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/net", render_xml_net,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/tasks",
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/net", false,
render_xml_net, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/tasks", false,
render_xml_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/mem", render_xml_mem,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/traffic",
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/mem", false,
render_xml_mem, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/xml/v3/traffic", false,
render_xml_traffic, server);
#endif /* ifdef HAVE_LIBXML2 */
#ifdef HAVE_JSON_C
isc_httpdmgr_addurl(listener->httpdmgr, "/json", render_json_all,
isc_httpdmgr_addurl(listener->httpdmgr, "/json", false, render_json_all,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1", render_json_all,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/status",
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1", false,
render_json_all, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/status", false,
render_json_status, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/server",
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/server", false,
render_json_server, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/zones",
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/zones", false,
render_json_zones, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/tasks",
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/tasks", false,
render_json_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/net", render_json_net,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/mem", render_json_mem,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/traffic",
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/net", false,
render_json_net, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/mem", false,
render_json_mem, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/traffic", false,
render_json_traffic, server);
#endif /* ifdef HAVE_JSON_C */
isc_httpdmgr_addurl2(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
isc_httpdmgr_addurl(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
*listenerp = listener;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_NOTICE,
"statistics channel listening on %s", socktext);
return (ISC_R_SUCCESS);
cleanup:
if (result != ISC_R_SUCCESS) {
if (listener->acl != NULL) {
dns_acl_detach(&listener->acl);
}
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener,
sizeof(*listener));
}
if (task != NULL) {
isc_task_detach(&task);
}
if (sock != NULL) {
isc_socket_detach(&sock);
if (listener->acl != NULL) {
dns_acl_detach(&listener->acl);
}
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
return (result);
}
+4 -4
View File
@@ -67,7 +67,7 @@
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<BrowseInformation>true</BrowseInformation>
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
@@ -75,7 +75,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@OPENSSL_LIB@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>cd ..
@@ -103,7 +103,7 @@ perl -e "print \";\";" &gt;&gt; xsl.c
<ObjectFileName>.\$(Configuration)\</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
@@ -114,7 +114,7 @@ perl -e "print \";\";" &gt;&gt; xsl.c
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@OPENSSL_LIB@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIB@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>cd ..
+5 -4
View File
@@ -252,7 +252,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
str = cfg_obj_asstring(matchtype);
CHECK(dns_ssu_mtypefromstring(str, &mtype));
if (mtype == dns_ssumatchtype_subdomain) {
if (mtype == dns_ssumatchtype_subdomain &&
strcasecmp(str, "zonesub") == 0) {
usezone = true;
}
@@ -1594,11 +1595,11 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (cfg_obj_isvoid(resign)) {
seconds /= 4;
} else if (!sigvalinsecs) {
seconds = cfg_obj_asuint32(resign);
uint32_t r = cfg_obj_asuint32(resign);
if (seconds > 7 * 86400) {
seconds *= 86400;
seconds = r * 86400;
} else {
seconds *= 3600;
seconds = r * 3600;
}
} else {
seconds = cfg_obj_asuint32(resign);
+5 -1
View File
@@ -18,8 +18,12 @@ LDADD = \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(READLINE_LIB) \
$(GSSAPI_LIBS) \
$(KRB5_LIBS)
if HAVE_READLINE
LDADD += \
$(READLINE_LIBS)
endif
bin_PROGRAMS = nsupdate
+8 -28
View File
@@ -36,6 +36,7 @@
#include <isc/portset.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/readline.h>
#include <isc/region.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
@@ -94,20 +95,6 @@
#include <bind9/getaddresses.h>
#if defined(HAVE_READLINE)
#if defined(HAVE_EDIT_READLINE_READLINE_H)
#include <edit/readline/readline.h>
#if defined(HAVE_EDIT_READLINE_HISTORY_H)
#include <edit/readline/history.h>
#endif /* if defined(HAVE_EDIT_READLINE_HISTORY_H) */
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#else /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
#include <readline/history.h>
#include <readline/readline.h>
#endif /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
#endif /* if defined(HAVE_READLINE) */
#define MAXCMD (128 * 1024)
#define MAXWIRE (64 * 1024)
#define PACKETSIZE ((64 * 1024) - 1)
@@ -2290,20 +2277,14 @@ static uint16_t
get_next_command(void) {
uint16_t result = STATUS_QUIT;
char cmdlinebuf[MAXCMD];
char *cmdline;
char *cmdline = NULL, *ptr = NULL;
isc_app_block();
if (interactive) {
#ifdef HAVE_READLINE
cmdline = readline("> ");
if (cmdline != NULL) {
add_history(cmdline);
cmdline = ptr = readline("> ");
if (ptr != NULL && *ptr != 0) {
add_history(ptr);
}
#else /* ifdef HAVE_READLINE */
fprintf(stdout, "> ");
fflush(stdout);
cmdline = fgets(cmdlinebuf, MAXCMD, input);
#endif /* ifdef HAVE_READLINE */
} else {
cmdline = fgets(cmdlinebuf, MAXCMD, input);
}
@@ -2319,11 +2300,10 @@ get_next_command(void) {
(void)nsu_strsep(&tmp, "\r\n");
result = do_next_command(cmdline);
}
#ifdef HAVE_READLINE
if (interactive) {
free(cmdline);
if (ptr != NULL) {
free(ptr);
}
#endif /* ifdef HAVE_READLINE */
return (result);
}
+1 -1
View File
@@ -169,7 +169,7 @@ install_hooks(ns_hooktable_t *hooktable, isc_mem_t *mctx,
.action_data = inst,
};
ns_hook_add(hooktable, mctx, -NS_QUERY_QCTX_INITIALIZED, &filter_init);
ns_hook_add(hooktable, mctx, NS_QUERY_QCTX_INITIALIZED, &filter_init);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_BEGIN, &filter_respbegin);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_ANY_FOUND,
&filter_respanyfound);
+153 -123
View File
@@ -24,6 +24,7 @@
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/refcount.h>
@@ -55,11 +56,14 @@
#define SERVERADDRS 10
const char *progname;
const char *progname = NULL;
bool verbose;
static const char *admin_conffile;
static const char *admin_keyfile;
static isc_taskmgr_t *taskmgr = NULL;
static isc_task_t *rndc_task = NULL;
static const char *admin_conffile = NULL;
static const char *admin_keyfile = NULL;
static const char *version = PACKAGE_VERSION;
static const char *servername = NULL;
static isc_sockaddr_t serveraddrs[SERVERADDRS];
@@ -68,27 +72,28 @@ static bool local4set = false, local6set = false;
static int nserveraddrs;
static int currentaddr = 0;
static unsigned int remoteport = 0;
static isc_socketmgr_t *socketmgr = NULL;
static isc_buffer_t *databuf;
static isccc_ccmsg_t ccmsg;
static isc_nm_t *netmgr = NULL;
static isc_buffer_t *databuf = NULL;
static isccc_ccmsg_t rndc_ccmsg;
static uint32_t algorithm;
static isccc_region_t secret;
static bool failed = false;
static bool c_flag = false;
static isc_mem_t *rndc_mctx;
static isc_mem_t *rndc_mctx = NULL;
static atomic_uint_fast32_t sends = ATOMIC_VAR_INIT(0);
static atomic_uint_fast32_t recvs = ATOMIC_VAR_INIT(0);
static atomic_uint_fast32_t connects = ATOMIC_VAR_INIT(0);
static char *command;
static char *args;
static char *command = NULL;
static char *args = NULL;
static char program[256];
static isc_socket_t *sock = NULL;
static uint32_t serial;
static bool quiet = false;
static bool showresult = false;
static bool shuttingdown = false;
static isc_nmhandle_t *readhandle = NULL, *sendhandle = NULL;
static void
rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
rndc_startconnect(isc_sockaddr_t *addr);
ISC_NORETURN static void
usage(int status);
@@ -105,6 +110,12 @@ command is one of the following:\n\
Add zone to given view. Requires allow-new-zones option.\n\
delzone [-clean] zone [class [view]]\n\
Removes zone from given view.\n\
dnssec -checkds [-key id [-alg algorithm] [-when time] (published|withdrawn) zone [class [view]]\n\
Mark the DS record for the KSK of the given zone as seen\n\
in the parent. If the zone has multiple KSKs, select a\n\
specific key by providing the keytag with -key id and\n\
optionally the key's algorithm with -alg algorithm.\n\
Requires the zone to have a dnssec-policy.\n\
dnssec -status zone [class [view]]\n\
Show the DNSSEC signing state for the specified zone.\n\
Requires the zone to have a dnssec-policy.\n\
@@ -114,7 +125,7 @@ command is one of the following:\n\
Close, rename and re-open the DNSTAP output file(s).\n\
dumpdb [-all|-cache|-zones|-adb|-bad|-fail] [view ...]\n\
Dump cache(s) to the dump file (named_dump.db).\n\
flush Flushes all of the server's caches.\n\
flush Flushes all of the server's caches.\n\
flush [view] Flushes the server's cache for a view.\n\
flushname name [view]\n\
Flush the given name from the server's cache(s)\n\
@@ -278,51 +289,59 @@ get_addresses(const char *host, in_port_t port) {
}
static void
rndc_senddone(isc_task_t *task, isc_event_t *event) {
isc_socketevent_t *sevent = (isc_socketevent_t *)event;
rndc_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
REQUIRE(handle == sendhandle);
UNUSED(task);
UNUSED(arg);
if (sevent->result != ISC_R_SUCCESS) {
fatal("send failed: %s", isc_result_totext(sevent->result));
if (result != ISC_R_SUCCESS) {
fatal("send failed: %s", isc_result_totext(result));
}
isc_event_free(&event);
isc_nmhandle_detach(&sendhandle);
if (atomic_fetch_sub_release(&sends, 1) == 1 &&
atomic_load_acquire(&recvs) == 0)
{
isc_socket_detach(&sock);
isc_task_shutdown(task);
shuttingdown = true;
isc_task_shutdown(rndc_task);
isc_app_shutdown();
}
}
static void
rndc_recvdone(isc_task_t *task, isc_event_t *event) {
rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
isccc_ccmsg_t *ccmsg = (isccc_ccmsg_t *)arg;
isccc_sexpr_t *response = NULL;
isccc_sexpr_t *data;
isccc_region_t source;
char *errormsg = NULL;
char *textmsg = NULL;
isc_result_t result;
REQUIRE(ccmsg != NULL);
atomic_fetch_sub_release(&recvs, 1);
if (ccmsg.result == ISC_R_EOF) {
fatal("connection to remote host closed\n"
"This may indicate that\n"
"* the remote server is using an older version of"
" the command protocol,\n"
if (shuttingdown && (result == ISC_R_EOF || result == ISC_R_CANCELED)) {
if (readhandle != NULL) {
INSIST(handle == readhandle);
isc_nmhandle_detach(&readhandle);
}
return;
} else if (result == ISC_R_EOF) {
fatal("connection to remote host closed.\n"
"* This may indicate that the\n"
"* remote server is using an older\n"
"* version of the command protocol,\n"
"* this host is not authorized to connect,\n"
"* the clocks are not synchronized, or\n"
"* the key is invalid.");
"* the clocks are not synchronized,\n"
"* the key signing algorithm is incorrect,\n"
"* or the key is invalid.");
} else if (result != ISC_R_SUCCESS && result != ISC_R_CANCELED) {
fatal("recv failed: %s", isc_result_totext(result));
}
if (ccmsg.result != ISC_R_SUCCESS) {
fatal("recv failed: %s", isc_result_totext(ccmsg.result));
}
source.rstart = isc_buffer_base(&ccmsg.buffer);
source.rend = isc_buffer_used(&ccmsg.buffer);
source.rstart = isc_buffer_base(ccmsg->buffer);
source.rend = isc_buffer_used(ccmsg->buffer);
DO("parse message",
isccc_cc_fromwire(&source, &response, algorithm, &secret));
@@ -362,22 +381,23 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) {
}
}
isc_event_free(&event);
isccc_sexpr_free(&response);
if (atomic_load_acquire(&sends) == 0 &&
atomic_load_acquire(&recvs) == 0) {
isc_socket_detach(&sock);
isc_task_shutdown(task);
isc_nmhandle_detach(&readhandle);
shuttingdown = true;
isc_task_shutdown(rndc_task);
isc_app_shutdown();
}
}
static void
rndc_recvnonce(isc_task_t *task, isc_event_t *event) {
rndc_recvnonce(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
isccc_ccmsg_t *ccmsg = (isccc_ccmsg_t *)arg;
isccc_sexpr_t *response = NULL;
isccc_sexpr_t *_ctrl;
isccc_region_t source;
isc_result_t result;
uint32_t nonce;
isccc_sexpr_t *request = NULL;
isccc_time_t now;
@@ -385,25 +405,29 @@ rndc_recvnonce(isc_task_t *task, isc_event_t *event) {
isccc_sexpr_t *data;
isc_buffer_t b;
REQUIRE(handle == readhandle);
REQUIRE(ccmsg != NULL);
atomic_fetch_sub_release(&recvs, 1);
if (ccmsg.result == ISC_R_EOF) {
fatal("connection to remote host closed\n"
"This may indicate that\n"
"* the remote server is using an older version of"
" the command protocol,\n"
if (shuttingdown && result == ISC_R_EOF) {
isc_nmhandle_detach(&readhandle);
return;
} else if (result == ISC_R_EOF) {
fatal("connection to remote host closed.\n"
"* This may indicate that the\n"
"* remote server is using an older\n"
"* version of the command protocol,\n"
"* this host is not authorized to connect,\n"
"* the clocks are not synchronized,\n"
"* the key signing algorithm is incorrect, or\n"
"* the key is invalid.");
"* the key signing algorithm is incorrect\n"
"* or the key is invalid.");
} else if (result != ISC_R_SUCCESS) {
fatal("recv failed: %s", isc_result_totext(result));
}
if (ccmsg.result != ISC_R_SUCCESS) {
fatal("recv failed: %s", isc_result_totext(ccmsg.result));
}
source.rstart = isc_buffer_base(&ccmsg.buffer);
source.rend = isc_buffer_used(&ccmsg.buffer);
source.rstart = isc_buffer_base(ccmsg->buffer);
source.rend = isc_buffer_used(ccmsg->buffer);
DO("parse message",
isccc_cc_fromwire(&source, &response, algorithm, &secret));
@@ -451,48 +475,47 @@ rndc_recvnonce(isc_task_t *task, isc_event_t *event) {
r.base = databuf->base;
r.length = databuf->used;
isccc_ccmsg_cancelread(&ccmsg);
DO("schedule recv",
isccc_ccmsg_readmessage(&ccmsg, task, rndc_recvdone, NULL));
isccc_ccmsg_readmessage(ccmsg, rndc_recvdone, ccmsg));
atomic_fetch_add_relaxed(&recvs, 1);
DO("send message",
isc_socket_send(sock, &r, task, rndc_senddone, NULL));
if (sendhandle == NULL) {
isc_nmhandle_attach(handle, &sendhandle);
}
DO("send message", isc_nm_send(handle, &r, rndc_senddone, NULL));
atomic_fetch_add_relaxed(&sends, 1);
isc_event_free(&event);
isccc_sexpr_free(&response);
isccc_sexpr_free(&request);
return;
}
static void
rndc_connected(isc_task_t *task, isc_event_t *event) {
rndc_connected(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
isccc_ccmsg_t *ccmsg = (isccc_ccmsg_t *)arg;
char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_socketevent_t *sevent = (isc_socketevent_t *)event;
isccc_sexpr_t *request = NULL;
isccc_sexpr_t *data;
isccc_time_t now;
isc_region_t r;
isc_buffer_t b;
isc_result_t result;
REQUIRE(ccmsg != NULL);
atomic_fetch_sub_release(&connects, 1);
if (sevent->result != ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS) {
isc_sockaddr_format(&serveraddrs[currentaddr], socktext,
sizeof(socktext));
if (sevent->result != ISC_R_CANCELED &&
++currentaddr < nserveraddrs) {
if (++currentaddr < nserveraddrs) {
notify("connection failed: %s: %s", socktext,
isc_result_totext(sevent->result));
isc_socket_detach(&sock);
isc_event_free(&event);
rndc_startconnect(&serveraddrs[currentaddr], task);
isc_result_totext(result));
rndc_startconnect(&serveraddrs[currentaddr]);
return;
} else {
fatal("connect failed: %s: %s", socktext,
isc_result_totext(sevent->result));
}
fatal("connect failed: %s: %s", socktext,
isc_result_totext(result));
}
isc_stdtime_get(&now);
@@ -519,50 +542,56 @@ rndc_connected(isc_task_t *task, isc_event_t *event) {
r.base = databuf->base;
r.length = databuf->used;
isccc_ccmsg_init(rndc_mctx, sock, &ccmsg);
isccc_ccmsg_setmaxsize(&ccmsg, 1024 * 1024);
isccc_ccmsg_init(rndc_mctx, handle, ccmsg);
isccc_ccmsg_setmaxsize(ccmsg, 1024 * 1024);
if (readhandle == NULL) {
isc_nmhandle_attach(handle, &readhandle);
}
DO("schedule recv",
isccc_ccmsg_readmessage(&ccmsg, task, rndc_recvnonce, NULL));
isccc_ccmsg_readmessage(ccmsg, rndc_recvnonce, ccmsg));
atomic_fetch_add_relaxed(&recvs, 1);
DO("send message",
isc_socket_send(sock, &r, task, rndc_senddone, NULL));
if (sendhandle == NULL) {
isc_nmhandle_attach(handle, &sendhandle);
}
DO("send message", isc_nm_send(handle, &r, rndc_senddone, NULL));
atomic_fetch_add_relaxed(&sends, 1);
isc_event_free(&event);
isccc_sexpr_free(&request);
}
static void
rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task) {
rndc_startconnect(isc_sockaddr_t *addr) {
isc_result_t result;
int pf;
isc_sockettype_t type;
char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t *local = NULL;
isc_sockaddr_format(addr, socktext, sizeof(socktext));
notify("using server %s (%s)", servername, socktext);
pf = isc_sockaddr_pf(addr);
if (pf == AF_INET || pf == AF_INET6) {
type = isc_sockettype_tcp;
} else {
type = isc_sockettype_unix;
}
DO("create socket", isc_socket_create(socketmgr, pf, type, &sock));
switch (isc_sockaddr_pf(addr)) {
case AF_INET:
DO("bind socket", isc_socket_bind(sock, &local4, 0));
local = &local4;
break;
case AF_INET6:
DO("bind socket", isc_socket_bind(sock, &local6, 0));
local = &local6;
break;
case AF_UNIX:
/*
* TODO: support UNIX domain sockets in netgmr.
*/
fatal("UNIX domain sockets not currently supported");
default:
break;
INSIST(0);
ISC_UNREACHABLE();
}
DO("connect",
isc_socket_connect(sock, addr, task, rndc_connected, NULL));
DO("create connection",
isc_nm_tcpconnect(netmgr, (isc_nmiface_t *)local,
(isc_nmiface_t *)addr, rndc_connected, &rndc_ccmsg,
0));
atomic_fetch_add_relaxed(&connects, 1);
}
@@ -570,8 +599,10 @@ static void
rndc_start(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
UNUSED(task);
currentaddr = 0;
rndc_startconnect(&serveraddrs[currentaddr], task);
rndc_startconnect(&serveraddrs[currentaddr]);
}
static void
@@ -652,7 +683,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
if (servers != NULL) {
for (elt = cfg_list_first(servers); elt != NULL;
elt = cfg_list_next(elt)) {
const char *name;
const char *name = NULL;
server = cfg_listelt_value(elt);
name = cfg_obj_asstring(
cfg_map_getname(server));
@@ -689,9 +720,11 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
DO("get config key list", cfg_map_get(config, "key", &keys));
for (elt = cfg_list_first(keys); elt != NULL;
elt = cfg_list_next(elt)) {
const char *name = NULL;
key = cfg_listelt_value(elt);
if (strcasecmp(cfg_obj_asstring(cfg_map_getname(key)),
keyname) == 0) {
name = cfg_obj_asstring(cfg_map_getname(key));
if (strcasecmp(name, keyname) == 0) {
break;
}
}
@@ -851,8 +884,6 @@ int
main(int argc, char **argv) {
isc_result_t result = ISC_R_SUCCESS;
bool show_final_mem = false;
isc_taskmgr_t *taskmgr = NULL;
isc_task_t *task = NULL;
isc_log_t *log = NULL;
isc_logconfig_t *logconfig = NULL;
isc_logdestination_t logdest;
@@ -978,19 +1009,23 @@ main(int argc, char **argv) {
argc -= isc_commandline_index;
argv += isc_commandline_index;
if (argc < 1) {
if (argv[0] == NULL) {
usage(1);
} else {
command = argv[0];
if (strcmp(command, "restart") == 0) {
fatal("'%s' is not implemented", command);
}
notify("%s", command);
}
serial = isc_random32();
isc_mem_create(&rndc_mctx);
DO("create socket manager",
isc_socketmgr_create(rndc_mctx, &socketmgr));
netmgr = isc_nm_start(rndc_mctx, 1);
DO("create task manager",
isc_taskmgr_create(rndc_mctx, 1, 0, NULL, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &task));
isc_taskmgr_create(rndc_mctx, 1, 0, netmgr, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &rndc_task));
isc_log_create(rndc_mctx, &log, &logconfig);
isc_log_setcontext(log);
isc_log_settag(logconfig, progname);
@@ -1008,8 +1043,6 @@ main(int argc, char **argv) {
isccc_result_register();
command = *argv;
isc_buffer_allocate(rndc_mctx, &databuf, 2048);
/*
@@ -1036,32 +1069,30 @@ main(int argc, char **argv) {
*p++ = '\0';
INSIST(p == args + argslen);
notify("%s", command);
if (strcmp(command, "restart") == 0) {
fatal("'%s' is not implemented", command);
}
if (nserveraddrs == 0 && servername != NULL) {
get_addresses(servername, (in_port_t)remoteport);
}
DO("post event", isc_app_onrun(rndc_mctx, task, rndc_start, NULL));
DO("post event", isc_app_onrun(rndc_mctx, rndc_task, rndc_start, NULL));
result = isc_app_run();
if (result != ISC_R_SUCCESS) {
fatal("isc_app_run() failed: %s", isc_result_totext(result));
}
if (atomic_load_acquire(&connects) > 0 ||
atomic_load_acquire(&sends) > 0 || atomic_load_acquire(&recvs) > 0)
{
isc_socket_cancel(sock, task, ISC_SOCKCANCEL_ALL);
}
isc_task_detach(&task);
isc_task_detach(&rndc_task);
isc_taskmgr_destroy(&taskmgr);
isc_socketmgr_destroy(&socketmgr);
isc_nm_destroy(&netmgr);
/*
* Note: when TCP connections are shut down, there will be a final
* call to the isccc callback routine with &rndc_ccmsg as its
* argument. We therefore need to delay invalidating it until
* after the netmgr is destroyed.
*/
isccc_ccmsg_invalidate(&rndc_ccmsg);
isc_log_destroy(&log);
isc_log_setcontext(NULL);
@@ -1069,7 +1100,6 @@ main(int argc, char **argv) {
cfg_parser_destroy(&pctx);
isc_mem_put(rndc_mctx, args, argslen);
isccc_ccmsg_invalidate(&ccmsg);
isc_buffer_free(&databuf);
+15 -3
View File
@@ -161,9 +161,21 @@ Currently supported commands are:
See also ``rndc addzone`` and ``rndc modzone``.
``dnssec`` [**-status** *zone* [*class* [*view*]]
Show the DNSSEC signing state for the specified zone. Requires the
zone to have a "dnssec-policy".
``dnssec`` ( **-status** | **-checkds** [**-key** *id* [**-alg** *algorithm*]] [**-when** *time*] ( *published* | *withdrawn* )) *zone* [*class* [*view*]]
This command allows you to interact with the "dnssec-policy" of a given
zone.
``rndc dnssec -status`` show the DNSSEC signing state for the specified
zone.
``rndc dnssec -checkds`` will let ``named`` know that the DS for the given
key has been seen published into or withdrawn from the parent. This is
required in order to complete a KSK rollover. If the ``-key id`` argument
is specified, look for the key with the given identifier, otherwise if there
is only one key acting as a KSK in the zone, assume the DS of that key (if
there are multiple keys with the same tag, use ``-alg algorithm`` to
select the correct algorithm). The time that the DS has been published or
withdrawn is set to now, unless otherwise specified with the argument ``-when time``.
``dnstap`` ( **-reopen** | **-roll** [*number*] )
This command closes and re-opens DNSTAP output files. ``rndc dnstap -reopen`` allows
+1 -1
View File
@@ -374,7 +374,7 @@ a run of the full test suite (e.g. the tests are started with "runall.sh").
3. Each script should start with the following lines:
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
"conf.sh" defines a series of environment variables together with functions
useful for the test scripts. (conf.sh.win32 is the Windows equivalent of this
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/example.db
+2 -2
View File
@@ -9,10 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
status=0
t=0
+1 -1
View File
@@ -1,2 +1,2 @@
# this server runs named with only one worker thread
-m record,size,mctx -c named.conf -d 99 -D additional-ns1 -X named.lock -g -n 1
-m record,size,mctx -c named.conf -d 99 -D additional-ns1 -X named.lock -g -n 1 -T maxcachesize=2097152
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
copy_setports ns1/named1.conf.in ns1/named.conf
+2 -2
View File
@@ -9,10 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="-p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
status=0
n=0
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
cp -f ns1/redirect.db.1 ns1/redirect.db
cp -f ns2/redirect.db.1 ns2/redirect.db
+2 -2
View File
@@ -9,10 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
check_zonestatus() (
$RNDCCMD "10.53.0.$1" zonestatus -redirect > "zonestatus.out.ns$1.$n" &&
+1 -1
View File
@@ -1,2 +1,2 @@
# this server only has 127.0.0.1 in its localhost/localnets ACLs
-m record,size,mctx -c named.conf -d 99 -D allow-query-ns3 -X named.lock -g -T fixedlocal
-m record,size,mctx -c named.conf -d 99 -D allow-query-ns3 -X named.lock -g -T maxcachesize=2097152 -T fixedlocal
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ../common/controls.conf.in ns2/controls.conf
copy_setports ns1/named.conf.in ns1/named.conf
+1 -1
View File
@@ -50,7 +50,7 @@
# and querying as necessary.
#
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p ${PORT}"
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp -p ${PORT}"
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../../conf.sh
zone=.
zonefile=root.db
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../../conf.sh
# Have the child generate subdomain keys and pass DS sets to us.
( cd ../ns3 && $SHELL keygen.sh )
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../../conf.sh
SYSTESTDIR=autosign
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+2 -2
View File
@@ -9,13 +9,13 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
# convert private-type records to readable form
showprivate () {
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+2 -2
View File
@@ -7,10 +7,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="-p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
status=0
n=0
@@ -18,7 +18,6 @@ options {
listen-on { 10.53.0.2; };
listen-on-v6 { none; };
notify yes;
max-cache-size 80%;
disable-empty-zone 127.IN-ADDR.ARPA;
recursion yes;
dnssec-validation yes;
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -7,7 +7,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
cp -f ns1/dynamic.db.in ns1/dynamic.db
copy_setports ns1/named.conf.in ns1/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
+2 -2
View File
@@ -12,14 +12,14 @@
set -e
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../conf.sh
dig_with_opts() {
"$DIG" -p "${PORT}" "$@"
}
rndccmd() (
"$RNDC" -c "$SYSTEMTESTTOP/common/rndc.conf" -p "${CONTROLPORT}" -s "$@"
"$RNDC" -c ../common/rndc.conf -p "${CONTROLPORT}" -s "$@"
)
_wait_for_message() (
+1 -1
View File
@@ -11,7 +11,7 @@
set -eu
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
touch empty
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../../conf.sh
zone=example.
zonefile=example.db
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+2 -2
View File
@@ -7,10 +7,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="-p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
sendcmd() {
send 10.53.0.4 "${EXTRAPORT1}"
@@ -24,7 +24,6 @@ dnssec-policy "test" {
max-zone-ttl 86400;
parent-ds-ttl 7200;
parent-propagation-delay PT1H;
parent-registration-delay P1D;
publish-safety PT3600S;
retire-safety PT3600S;
signatures-refresh P3D;
-1
View File
@@ -24,7 +24,6 @@ dnssec-policy "test" {
max-zone-ttl 86400;
parent-ds-ttl 7200;
parent-propagation-delay PT1H;
parent-registration-delay P1D;
publish-safety PT3600S;
retire-safety PT3600S;
signatures-refresh P3D;
+1 -1
View File
@@ -7,7 +7,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -7,7 +7,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=1
+1 -1
View File
@@ -7,7 +7,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
ln -s $CHECKZONE named-compilezone
+1 -1
View File
@@ -7,7 +7,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=1
@@ -17,7 +17,7 @@ set -e
# and differ from dnsrpz.conf which is used by dnsrpzd.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DNSRPS_CMD=../rpz/dnsrps
+2 -3
View File
@@ -13,8 +13,7 @@
# Clean up after system tests.
#
SYSTEMTESTTOP=.
. $SYSTEMTESTTOP/conf.sh
. ./conf.sh
find . -type f \( \
@@ -25,7 +24,7 @@ find . -type f \( \
status=0
rm -f $SYSTEMTESTTOP/random.data
rm -f ../random.data
for d in $SUBDIRS
do
+1 -1
View File
@@ -9,6 +9,6 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. "$SYSTEMTESTTOP/conf.sh"
. ./conf.sh
[ -x "$TOP_BUILDDIR/bin/pkcs11/pkcs11-destroy" ] && $PK11DEL -w0 > /dev/null 2>&1
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+2 -2
View File
@@ -9,10 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="-p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
status=0
n=0
+1 -1
View File
@@ -9,6 +9,6 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named1.conf.in ns1/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -1 +1 @@
-D delzone-ns2 -X named.lock -m record,size,mctx -c named.conf -g -U 4
-D delzone-ns2 -X named.lock -m record,size,mctx -c named.conf -g -U 4 -T maxcachesize=2097152
+1 -1
View File
@@ -9,6 +9,6 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p 5300"
status=0
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
+1 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../../conf.sh
set -e
+1 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../conf.sh
set -e
+22 -5
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../conf.sh
set -e
@@ -82,7 +82,7 @@ if [ -x "$NSLOOKUP" -a $checkupdate -eq 1 ] ; then
n=$((n+1))
echo_i "check nslookup handles UPDATE response ($n)"
ret=0
"$NSLOOKUP" -q=CNAME "-port=$PORT" foo.bar 10.53.0.7 > nslookup.out.test$n 2>&1 && ret=1
"$NSLOOKUP" -q=CNAME -timeout=1 "-port=$PORT" foo.bar 10.53.0.7 > nslookup.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" nslookup.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
@@ -94,7 +94,7 @@ if [ -x "$HOST" -a $checkupdate -eq 1 ] ; then
n=$((n+1))
echo_i "check host handles UPDATE response ($n)"
ret=0
"$HOST" -t CNAME -p $PORT foo.bar 10.53.0.7 > host.out.test$n 2>&1 && ret=1
"$HOST" -W 1 -t CNAME -p $PORT foo.bar 10.53.0.7 > host.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" host.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
@@ -108,7 +108,7 @@ if [ -x "$DIG" ] ; then
n=$((n+1))
echo_i "check dig handles UPDATE response ($n)"
ret=0
dig_with_opts @10.53.0.7 cname foo.bar > dig.out.test$n 2>&1 && ret=1
dig_with_opts @10.53.0.7 +tries=1 +timeout=1 cname foo.bar > dig.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" dig.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
@@ -922,7 +922,7 @@ if [ -x "$DIG" ] ; then
n=$((n+1))
echo_i "check that dig +unexpected works ($n)"
ret=0
dig_with_opts @10.53.0.6 +unexpected a a.example > dig.out.test$n || ret=1
dig_with_opts @10.53.0.6 +tries=1 +time=2 +unexpected a a.example > dig.out.test$n || ret=1
grep 'reply from unexpected source' dig.out.test$n > /dev/null || ret=1
grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -946,6 +946,23 @@ if [ -x "$DIG" ] ; then
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig +bufsize=0 just sets the buffer size to 0 ($n)"
ret=0
dig_with_opts @10.53.0.3 a.example +bufsize=0 +qr > dig.out.test$n 2>&1 || ret=1
grep "EDNS:" dig.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig +bufsize restores default bufsize ($n)"
ret=0
dig_with_opts @10.53.0.3 a.example +bufsize=0 +bufsize +qr > dig.out.test$n 2>&1 || ret=1
lines=`grep "EDNS:.* udp: 4096" dig.out.test$n | wc -l`
test $lines -eq 2 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
else
echo_i "$DIG is needed, so skipping these dig tests"
fi
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
if ! $FEATURETEST --with-dlz-filesystem; then
echo_i "DLZ filesystem driver not supported"
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$SHELL clean.sh
copy_setports ns1/named.conf.in ns1/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
$TSIGKEYGEN ddns-key.example.nil > ns1/ddns.key
+2 -2
View File
@@ -9,13 +9,13 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
DIGOPTS="@10.53.0.1 -p ${PORT} +nocookie"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
newtest() {
n=`expr $n + 1`
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../../conf.sh
zone=signed
infile=example.db
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
+1 -1
View File
@@ -9,7 +9,7 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
. $SYSTEMTESTTOP/conf.sh
. ../conf.sh
status=0
n=0
+1 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../../conf.sh
set -e
@@ -0,0 +1,165 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 300 ; 5 minutes
@ IN SOA mname1. . (
2000042407 ; serial
20 ; refresh (20 seconds)
20 ; retry (20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns2
NS ns3
ns2 A 10.53.0.2
ns3 A 10.53.0.3
a A 10.0.0.1
b A 10.0.0.2
d A 10.0.0.4
; Used for testing ANY queries
foo TXT "testing"
foo A 10.0.1.0
bad-cname CNAME a
bad-dname DNAME @
; Used for testing CNAME queries
cname1 CNAME cname1-target
cname1-target TXT "testing cname"
cname2 CNAME cname2-target
cname2-target TXT "testing cname"
; Used for testing DNAME queries
dname1 DNAME dname1-target
foo.dname1-target TXT "testing dname"
dname2 DNAME dname2-target
foo.dname2-target TXT "testing dname"
; A secure subdomain
secure NS ns3.secure
ns3.secure A 10.53.0.3
; An insecure subdomain
insecure NS ns.insecure
ns.insecure A 10.53.0.3
; A secure subdomain we're going to inject bogus data into
bogus NS ns.bogus
ns.bogus A 10.53.0.3
; A subdomain with a corrupt DS
badds NS ns.badds
ns.badds A 10.53.0.3
; A dynamic secure subdomain
dynamic NS dynamic
dynamic A 10.53.0.3
; A insecure subdomain
mustbesecure NS ns.mustbesecure
ns.mustbesecure A 10.53.0.3
; A subdomain with expired signatures
expired NS ns.expired
ns.expired A 10.53.0.3
; A rfc2535 signed zone w/ CNAME
rfc2535 NS ns.rfc2535
ns.rfc2535 A 10.53.0.3
z A 10.0.0.26
keyless NS ns.keyless
ns.keyless A 10.53.0.3
nsec3 NS ns.nsec3
ns.nsec3 A 10.53.0.3
optout NS ns.optout
ns.optout A 10.53.0.3
nsec3-unknown NS ns.nsec3-unknown
ns.nsec3-unknown A 10.53.0.3
optout-unknown NS ns.optout-unknown
ns.optout-unknown A 10.53.0.3
dnskey-unknown NS ns.dnskey-unknown
ns.dnskey-unknown A 10.53.0.3
dnskey-unsupported NS ns.dnskey-unsupported
ns.dnskey-unsupported A 10.53.0.3
dnskey-nsec3-unknown NS ns.dnskey-nsec3-unknown
ns.dnskey-nsec3-unknown A 10.53.0.3
multiple NS ns.multiple
ns.multiple A 10.53.0.3
*.wild A 10.0.0.27
rsasha256 NS ns.rsasha256
ns.rsasha256 A 10.53.0.3
rsasha512 NS ns.rsasha512
ns.rsasha512 A 10.53.0.3
kskonly NS ns.kskonly
ns.kskonly A 10.53.0.3
update-nsec3 NS ns.update-nsec3
ns.update-nsec3 A 10.53.0.3
auto-nsec NS ns.auto-nsec
ns.auto-nsec A 10.53.0.3
auto-nsec3 NS ns.auto-nsec3
ns.auto-nsec3 A 10.53.0.3
below-cname CNAME some.where.else.
insecure.below-cname NS ns.insecure.below-cname
ns.insecure.below-cname A 10.53.0.3
secure.below-cname NS ns.secure.below-cname
ns.secure.below-cname A 10.53.0.3
ttlpatch NS ns.ttlpatch
ns.ttlpatch A 10.53.0.3
split-dnssec NS ns.split-dnssec
ns.split-dnssec A 10.53.0.3
split-smart NS ns.split-smart
ns.split-smart A 10.53.0.3
upper NS ns.upper
ns.upper A 10.53.0.3
LOWER NS NS.LOWER
NS.LOWER A 10.53.0.3
expiring NS ns.expiring
ns.expiring A 10.53.0.3
future NS ns.future
ns.future A 10.53.0.3
managed-future NS ns.managed-future
ns.managed-future A 10.53.0.3
revkey NS ns.revkey
ns.revkey A 10.53.0.3
dname-at-apex-nsec3 NS ns3
@@ -182,4 +182,13 @@ zone "corp" {
file "corp.db";
};
zone "hours-vs-days" {
type master;
file "hours-vs-days.db.signed";
auto-dnssec maintain;
/* validity 500 days, resign in 499 days */
sig-validity-interval 500 499;
allow-update { any; };
};
include "trusted.conf";
+9 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../../conf.sh
set -e
@@ -308,3 +308,11 @@ sed 's/DNSKEY/CDNSKEY/' "$key1.key" > "$key1.cdnskey"
cat "$infile" "$key1.key" "$key2.key" "$key1.cdnskey" "$key1.cds" > "$zonefile"
# Don't sign, let auto-dnssec maintain do it.
mv $zonefile "$zonefile.signed"
zone=hours-vs-days
infile=hours-vs-days.db.in
zonefile=hours-vs-days.db
key1=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone -f KSK "$zone")
key2=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
$SETTIME -P sync now "$key1" > /dev/null
cat "$infile" > "$zonefile.signed"
+1 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../../conf.sh
set -e
+1 -1
View File
@@ -10,7 +10,7 @@
# information regarding copyright ownership.
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
. ../../conf.sh
set -e
+1 -1
View File
@@ -1 +1 @@
-m record,size,mctx -c named.conf -d 99 -D dnssec-ns6 -X named.lock -g -T nonearest -T tat=1
-m record,size,mctx -c named.conf -d 99 -D dnssec-ns6 -X named.lock -g -T maxcachesize=2097152 -T nonearest -T tat=1

Some files were not shown because too many files have changed in this diff Show More