2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

30796 Commits

Author SHA1 Message Date
Witold Kręcicki
eda4300bbb netmgr: have a single source of truth for tcpdns callback
We pass interface as an opaque argument to tcpdns listening socket.
If we stop listening on an interface but still have in-flight connections
the opaque 'interface' is not properly reference counted, and we might
hit a dead memory. We put just a single source of truth in a listening
socket and make the child sockets use that instead of copying the
value from listening socket. We clean the callback when we stop listening.
2020-01-15 17:22:13 +01:00
Witold Kręcicki
0d637b5985 netmgr: we can't uv_close(sock->timer) when in sock->timer close callback 2020-01-15 14:56:40 +01:00
Ondřej Surý
1bee87a364 Merge branch 'wpk/fix-uvtransfers-on-windows' into 'master'
Fixes for netmgr on Windows after recent TCP changes

See merge request isc-projects/bind9!2896
2020-01-15 13:50:10 +00:00
Witold Kręcicki
525c583145 netmgr:
- isc__netievent_storage_t was to small to contain
   isc__netievent__socket_streaminfo_t on Windows
 - handle isc_uv_export and isc_uv_import errors properly
 - rewrite isc_uv_export and isc_uv_import on Windows
2020-01-15 14:08:44 +01:00
Michał Kępień
0cf47ed363 Merge branch '1493-make-hazard-pointers-dynamic' into 'master'
Make hazard pointers max_threads configurable at runtime.

Closes #1493

See merge request isc-projects/bind9!2885
2020-01-15 07:56:58 +00:00
Witold Kręcicki
ea7cc30f7c CHANGES 2020-01-15 08:55:39 +01:00
Witold Kręcicki
493b6a9f33 Make hazard pointers max_threads configurable at runtime.
hp implementation requires an object for each thread accessing
a hazard pointer. previous implementation had a hardcoded
HP_MAX_THREAD value of 128, which failed on machines with lots of
CPU cores (named uses 3n threads). We make isc__hp_max_threads
configurable at startup, with the value set to 4*named_g_cpus.
It's also important for this value not to be too big as we do
linear searches on a list.
2020-01-14 21:26:57 +01:00
Evan Hunt
1639dc8dca Merge branch 'each-allow-ds-with-key' into 'master'
allow DS with key trust anchors

See merge request isc-projects/bind9!2892
2020-01-14 19:56:16 +00:00
Evan Hunt
fc36798a81 allow both key and DS trust anchors to be used for the same name. 2020-01-14 11:17:30 -08:00
Evan Hunt
72b3b458d3 Merge branch '1237-keytable-refactoring' into 'master'
Resolve "refactor dns_keytable"

Closes #1237

See merge request isc-projects/bind9!2798
2020-01-14 18:10:16 +00:00
Evan Hunt
6799a222d1 keep the keynode attached as long as dsset is in use
when using the trust anchor dsset as val->dsset, keep a reference
to the keynode so dsset can't be freed.
2020-01-14 09:26:19 -08:00
Evan Hunt
2d249ebeae make dns_keytable_deletekey() work correctly
it now removes matching trust anchors from from the dslist while leaving
the other trust anchors in place.

also cleaned up the API to remove functions that were never being used.
2020-01-14 09:26:13 -08:00
Evan Hunt
678e2d3cfa fix a bug with the insertion of DS records into existing keynodes
NOTE: the keytable test is still failing because dns_keytable_deletekey()
is looking for exact matches in keynodes containing dst_key objects,
which no keynode has anymore.
2020-01-14 09:24:23 -08:00
Evan Hunt
b984a4b647 disable adding keys to keytable; only DS trust anchors can now be added
the internal keytable structure has not yet been changed, but
insertion of DS anchors is the only method now available.

NOTE: the keytable unit test is currently failing because of tests
that expect individual keynode objects to contain single DST key
objects.
2020-01-14 09:24:22 -08:00
Evan Hunt
7fdf40770f remove all code that uses non-DS trust anchors
as initial-key and static-key trust anchors will now be stored as a
DS rrset, code referencing keynodes storing DNSKEY trust anchors will
no longer be reached.
2020-01-14 09:24:13 -08:00
Evan Hunt
21d3f66f1c rename dns_keytable_deletekeynode to dns_keytable_deletekey
this function is used by dns_view_untrust() to handle revoked keys, so
it will still be needed after the keytable/validator refactoring is
complete, even though the keytable will be storing DS trust anchors
instead of keys. to simplify the way it's called, it now takes a DNSKEY
rdata struct instead of a DST key.
2020-01-14 09:23:21 -08:00
Ondřej Surý
8f902a72ff Merge branch '1396-document-bind-9-15-x-need-for-pkg-config' into 'master'
Fail the autoconf script early if pkg-config is not present.

Closes #1396

See merge request isc-projects/bind9!2889
2020-01-14 13:31:17 +00:00
Ondřej Surý
fc9c7025bc Fail the autoconf script early if pkg-config is not present. 2020-01-14 14:07:36 +01:00
Ondřej Surý
4f74e75632 Merge branch 'ondrej/more-conversions-to-isc_refcount-API' into 'master'
Convert more reference counting to isc_refcount API

See merge request isc-projects/bind9!2153
2020-01-14 12:16:17 +00:00
Ondřej Surý
3000f14eba Use isc_refcount_increment0() when reusing handle or socket; remove extra DbC checks 2020-01-14 13:12:13 +01:00
Ondřej Surý
4d1e3b1e10 Move the NO_SANITIZE attribute to a correct place (gcc is picky) 2020-01-14 13:12:13 +01:00
Ondřej Surý
ede2208d96 ATOMIC_VAR_INIT() must be used only for static variables (C17) 2020-01-14 13:12:13 +01:00
Ondřej Surý
c4aec79079 When compiling with MSVC, use inline functions for isc_refcount_increment/decrement 2020-01-14 13:12:13 +01:00
Ondřej Surý
49976947ab Restore DbC checks in isc_refcount API
The isc_refcount API that provides reference counting lost DbC checks for
overflows and underflows in the isc_refcount_{increment,decrement} functions.

The commit restores the overflow check in the isc_refcount_increment and
underflows check in the isc_refcount_decrement by checking for the previous
value to not be on the boundary.
2020-01-14 13:12:13 +01:00
Ondřej Surý
a910b0a839 Protect globally accessed variables in rndc.c by making them C11 atomic 2020-01-14 13:12:13 +01:00
Ondřej Surý
64e2331843 Convert global responses variable in dispatch_test to C11 atomics 2020-01-14 13:12:13 +01:00
Ondřej Surý
6afa99362a Remove duplicate INSIST checks for isc_refcount API
This commits removes superfluous checks when using the isc_refcount API.

Examples of superfluous checks:

1. The isc_refcount_decrement function ensures there was not underflow,
   so this check is superfluous:

    INSIST(isc_refcount_decrement(&r) > 0);

2 .The isc_refcount_destroy() includes check whether the counter
   is zero, therefore this is superfluous:

    INSIST(isc_refcount_decrement(&r) == 1 && isc_refcount_destroy(&r));
2020-01-14 13:12:13 +01:00
Ondřej Surý
e711b0304f Convert more reference counting to isc_refcount API 2020-01-14 13:12:13 +01:00
Ondřej Surý
7c3e342935 Use isc_refcount_increment0() where appropriate 2020-01-14 13:12:13 +01:00
Ondřej Surý
9ce3254a1b Improve code style when checking old references values 2020-01-14 13:12:13 +01:00
Ondřej Surý
7dfc092f06 Use C11 atomics for nfctx, kill unused dns_resolver_nrunning() 2020-01-14 13:12:13 +01:00
Ondřej Surý
5208505f03 Use dns_keytable_attachkeynode() and switch to C11 atomics for .active_nodes 2020-01-14 13:12:13 +01:00
Ondřej Surý
fbf9856f43 Add isc_refcount_destroy() as appropriate 2020-01-14 13:12:13 +01:00
Witold Krecicki
4643ee04bd Merge branch 'wpk-netmgr-tcp-error-handling' into 'master'
netmgr: handle errors properly in accept_connection.

See merge request isc-projects/bind9!2880
2020-01-14 12:05:25 +00:00
Witold Krecicki
b665ce2a96 CHANGES 2020-01-14 11:06:02 +01:00
Witold Krecicki
6ee1461cc3 netmgr: handle errors properly in accept_connection.
If a connection was closed early (right after accept()) an assertion
that assumed that the connection was still alive could be triggered
in accept_connection. Handle those errors properly and not with
assertions, free all the resources afterwards.
2020-01-14 11:03:06 +01:00
Mark Andrews
0d4d65e7f2 Merge branch '1531-add-calls-to-dns_rdata_additionaldata-to-lib-dns-tests-rdata_test-c' into 'master'
Resolve "Add calls to dns_rdata_additionaldata to lib/dns/tests/rdata_test.c"

Closes #1531

See merge request isc-projects/bind9!2795
2020-01-14 04:44:58 +00:00
Mark Andrews
b3c1b2a869 exercise dns_rdata_checknames 2020-01-14 15:01:09 +11:00
Mark Andrews
649a34d628 exercise dns_rdata_additionaldata 2020-01-14 03:49:11 +00:00
Mark Andrews
5e74550740 call dns_rdata_towire on valid output from dns_rdata_fromtext and dns_rdata_fromwire 2020-01-14 03:49:11 +00:00
Evan Hunt
6ad0133156 Merge branch '1311-netmgr-stats' into 'master'
Resolve "netmgr doesn't count networking statistics"

Closes #1311

See merge request isc-projects/bind9!2844
2020-01-14 00:10:06 +00:00
Evan Hunt
c3ed086cf0 CHANGES 2020-01-13 14:09:42 -08:00
Evan Hunt
5234a8e00a count statistics in netmgr TCP code 2020-01-13 14:09:42 -08:00
Evan Hunt
90a1dabe74 count statistics in netmgr UDP code
- also restored a test in the statistics test which was changed when
  the netmgr was introduced because active sockets were not being
  counted.
2020-01-13 14:09:37 -08:00
Evan Hunt
80a5c9f5c8 associate socket stats counters with netmgr socket objects
- the socket stat counters have been moved from socket.h to stats.h.
- isc_nm_t now attaches to the same stats counter group as
  isc_socketmgr_t, so that both managers can increment the same
  set of statistics
- isc__nmsocket_init() now takes an interface as a paramter so that
  the address family can be determined when initializing the socket.
- based on the address family and socket type, a group of statistics
  counters will be associated with the socket - for example, UDP4Active
  with IPv4 UDP sockets and TCP6Active with IPv6 TCP sockets.  note
  that no counters are currently associated with TCPDNS sockets; those
  stats will be handled by the underlying TCP socket.
- the counters are not actually used by netmgr sockets yet; counter
  increment and decrement calls will be added in a later commit.
2020-01-13 14:05:02 -08:00
Witold Krecicki
a4ec0ccb91 Merge branch 'wpk-no-ipc-tcp-passing' into 'master'
Pass TCP listening sockets using async channel, not IPC

Closes #1433, #1499, and #1500

See merge request isc-projects/bind9!2825
2020-01-13 21:50:33 +00:00
Witold Kręcicki
7a7b09fee6 CHANGES note 2020-01-13 22:00:31 +01:00
Witold Kręcicki
20c077afc5 Disable pktinfo for ipv6 on all unices
If pktinfo were supported then we could listen on :: for ipv6 and get
the information about the destination address from pktinfo structure passed
in recvmsg but this method is not portable and libuv doesn't support it - so
we need to listen on all interfaces.
We should verify that this doesn't impact performance (we already do it for
ipv4) and either remove all the ipv6pktinfo detection code or think of fixing
libuv.
2020-01-13 22:00:20 +01:00
Evan Hunt
e38004457c netmgr fixes:
- use UV_{TC,UD}P_IPV6ONLY for IPv6 sockets, keeping the pre-netmgr
   behaviour.
 - add a new listening_error bool flag which is set if the child
   listener fails to start listening. This fixes a bug where named would
   hang if, e.g.,  we failed to bind to a TCP socket.
2020-01-13 10:54:17 -08:00
Witold Kręcicki
67c1ca9a79 Use isc_uv_export() to pass bound TCP listening socket to child listeners.
For multithreaded TCP listening we need to pass a bound socket to all
listening threads. Instead of using uv_pipe handle passing method which
is quite complex (lots of callbacks, each of them with its own error
handling) we now use isc_uv_export() to export the socket, pass it as a
member of the isc__netievent_tcpchildlisten_t structure, and then
isc_uv_import() it in the child thread, simplifying the process
significantly.
2020-01-13 10:53:44 -08:00