Commit Graph
32689 Commits
Author SHA1 Message Date
Evan Hunt cc5d0e9ade experiment: extend dig timeout 2020-10-06 12:03:38 -07:00
Evan Hunt 3cebd43f09 ensure errors are caught when UDP send() fails 2020-10-06 12:03:38 -07:00
Evan Hunt e4853efb9d fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:38 -07:00
Evan Hunt 545cd3934e fixup! dig: remove "+unexpected" option 2020-10-06 12:03:38 -07:00
Evan Hunt 230085c176 fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:38 -07:00
Evan Hunt a68a93a1ce handle TCP read timeout in connect_timeout()
when the code to handle TCP connect timeouts was moved out of
connect_timeout(), it caused hangs when dig connected via TCP to a
server and the connection succeded but the server never sent a
response. we should add a read timeout mechanism for client TCP
connections as well as a connect timeout mechanism. in the meantime,
however, I've restored the TCP functionality in connect_timeout()
so it can handle the case of read timeouts.
2020-10-06 12:03:38 -07:00
Evan Hunt 43c4891758 fixup! kluge: prevent crash on interrupt when TCP connect is pending 2020-10-06 12:03:38 -07:00
Evan Hunt 378afa9979 kluge: prevent crash on interrupt when TCP connect is pending
- stop and clean up resources from the TCP connect timer in
  isc__nm_tcp_shutdown(), and call the connect callback with
  ISC_R_CANCELED
- don't clear TCP queries that are waiting for connect in
  clear_query(); they'll be taken care of by tcp_connected() now.
2020-10-06 12:03:38 -07:00
Ondřej SurýandEvan Hunt 9243e6d935 fixup! Clone the csock in accept_connection(), not in callback 2020-10-06 12:03:38 -07:00
Ondřej SurýandEvan Hunt f02c68f884 fixup! Clone the csock in accept_connection(), not in callback 2020-10-06 12:03:38 -07:00
Ondřej SurýandEvan Hunt d3c0a04ad7 Clone the csock in accept_connection(), not in callback
If we clone the csock (children socket) in TCP accept_connection() instead of
passing the ssock (server socket) to the call back and cloning it there we
unbreak the assumption that every socket is handled inside it's own worker
thread and therefore we can get rid of (at least) callback locking.
2020-10-06 12:03:33 -07:00
Evan Hunt 6521a3b69c fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:05 -07:00
Ondřej SurýandEvan Hunt 44a431cee6 Add isc_uv_udp_connect() shim
The uv_udp_connect() function is available from libuv 1.27+, move the code to
connect to udp socket to a (limited) shim function called isc_uv_udp_connect().
2020-10-06 12:03:05 -07:00
Evan Hunt 5aee9f642b implement a TCP connect timeout
Attempting to connect dig to the wrong address via TCP caused a hang on
shutdown due to a dangling socket reference; tcp_connect_cb() was never
reached and so the TCP socket was never detached.

This commit adds a connection timeout mechanism to isc_nm_tcpconnect()
and isc_nm_tcpdnsconnect().

NOTE: Currently this only works correctly with "dig +tries=1". If the
connection is retried, we get a segfault on shutdown in uv_walk(); I
haven't yet worked out why.
2020-10-06 12:03:05 -07:00
Evan Hunt e70823f14a fixup! fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt 255b180964 fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt 91d143999e fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Ondřej SurýandEvan Hunt 6bc352ea56 WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt 795085ffc2 kluge: extra handle detach when canceling
when dig is interrupted with SIGINT while a UDP connection is still
pending, it hangs due to recv_done() never being called. adding
an extra handle detach in cancel_all() corrects this, but is probably
not the correct way to fix it.
2020-10-06 12:03:05 -07:00
Evan Hunt e4282ad606 CHANGES and release note 2020-10-06 12:03:03 -07:00
Evan Hunt 7cd82f419f dig: setup IDN whenever printing a message
because dig now uses the netmgr, printing of response messages
happens in a different thread than setup. the IDN output filtering
procedure, which set using dns_name_settotextfilter(), is stored as
thread-local data, and so if it's set during setup, it won't be
accessible when printing. we now set it immediately before printing,
in the same thread, and clear it immedately afterward.
2020-10-06 12:02:47 -07:00
Evan Hunt d9542cf35d dig: remove "+unexpected" option
The network manager does not support returning UDP datagrams to
clients from unexpected sources; it is therefore not possible for
dig to accept them.  The "+[no]unexpected" option has therefore
been removed from the dig command and its documentation.
2020-10-06 12:02:47 -07:00
Evan Hunt 1fa4db11d6 fixup! convert dig/host/nslookup to use the netmgr 2020-10-06 12:02:47 -07:00
Evan Hunt 569cf55243 convert dig/host/nslookup to use the netmgr
use netmgr functions instead of isc_socket for dig, host, and
nslookup. note that `dig +unexpected` is not working.
2020-10-06 12:02:47 -07:00
Evan Hunt 6831adf3df 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-10-06 12:02:47 -07:00
Evan Hunt 68c2ddb63a 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-10-06 12:02:45 -07:00
Mark Andrews 08c996c80a Merge branch '2200-the-fuzzer-dns_message_parser-c-is-leaking-memory' into 'main'
Resolve "The fuzzer dns_message_parse.c is leaking memory."

Closes #2200

See merge request isc-projects/bind9!4239
2020-10-06 13:20:36 +00:00
Mark Andrews 0d978878c5 invalidate cctx on error 2020-10-06 23:50:01 +11:00
Mark Andrews 40e54142f8 Merge branch 'marka-create_query-fix-REVERSE_INULL' into 'main'
Silence Coverity REVERSE_INULL report

Closes #2198

See merge request isc-projects/bind9!4234
2020-10-06 12:33:56 +00:00
Mark Andrews f0a66cb5aa Silence Coverity REVERSE_INULL report
message does not need to be tested to NULL
2020-10-06 12:11:25 +00:00
Matthijs Mekking d2d7f2a14e Merge branch 'he32-test-fix' into 'main'
Avoid a non-standard bashism: use of "==" in "test".

See merge request isc-projects/bind9!4235
2020-10-06 08:28:12 +00:00
Havard EidnesandMatthijs Mekking 1f83daa4ac Avoid a non-standard bashism: use of "==" in "test". 2020-10-06 08:27:56 +00:00
Mark Andrews 4134980448 Merge branch 'marka-render_buf-was-too-big' into 'main'
render_buf was too big

See merge request isc-projects/bind9!4231
2020-10-06 07:37:30 +00:00
Mark Andrews 8faf12eace render buf was too big
It was misdeclared as a array of pointers (uint8_t*[]) and there
where too many elements (64 * 1024) instead of (64 * 1024 - 1).
2020-10-06 09:49:28 +11:00
Ondřej Surý 50df71a881 Merge branch '2183-dns-flag-day-2020' into 'main'
Resolve "DNS Flag Day 2020"

Closes #2183

See merge request isc-projects/bind9!4179
2020-10-05 15:13:12 +00:00
Ondřej SurýandOndřej Surý 096d41b4e2 Add text describing the changes done in the MR in more detail 2020-10-05 16:21:21 +02:00
Ondřej SurýandOndřej Surý b9a42446e8 Enable DF (don't fragment) flag on listening UDP sockets
This commits uses the isc__nm_socket_dontfrag() helper function to
enable setting DF bit on the outgoing UDP packets.
2020-10-05 16:21:21 +02:00
Ondřej SurýandOndřej Surý 63c29dcdfa Change the default EDNS buffer size for dig, mdig and host to 1232
The dig should behave closely to how the resolver code in `named` work,
so we need to change the buffer size in dig, mdig and host too.
2020-10-05 16:21:21 +02:00
Ondřej Surý f1556f8c41 Adjust legacy and digdelv tests for default 1232 EDNS Buffer Size
* the legacy test with -T maxudp512 will just fail, e.g. if the packets
  larger than 512 octets are dropped along the path, the proper response
  is to fail

* digdelv test was just expecting default server EDNS buffer size to be
  4096, the test needed only slight adjustment
2020-10-05 16:21:21 +02:00
Ondřej Surý bb990030d3 Simplify the EDNS buffer size logic for DNS Flag Day 2020
The DNS Flag Day 2020 aims to remove the IP fragmentation problem from
the UDP DNS communication.  In this commit, we implement the required
changes and simplify the logic for picking the EDNS Buffer Size.

1. The defaults for `edns-udp-size`, `max-udp-size` and
   `nocookie-udp-size` have been changed to `1232` (the value picked by
   DNS Flag Day 2020).

2. The probing heuristics that would try 512->4096->1432->1232 buffer
   sizes has been removed and the resolver will always use just the
   `edns-udp-size` value.

3. Instead of just disabling the PMTUD mechanism on the UDP sockets, we
   now set IP_DONTFRAG (IPV6_DONTFRAG) flag.  That means that the UDP
   packets won't get ever fragmented.  If the ICMP packets are lost the
   UDP will just timeout and eventually be retried over TCP.
2020-10-05 16:21:21 +02:00
Ondřej Surý d51f09a8d0 Merge branch 'ondrej/refactor-setsockopt' into 'main'
Refactor the setsockopt() code in network manager into helper functions

See merge request isc-projects/bind9!4227
2020-10-05 14:11:55 +00:00
Ondřej Surý fd975a551d Split reusing the addr/port and load-balancing socket options
The SO_REUSEADDR, SO_REUSEPORT and SO_REUSEPORT_LB has different meaning
on different platform. In this commit, we split the function to set the
reuse of address/port and setting the load-balancing into separate
functions.

The libuv library already have multiplatform support for setting
SO_REUSEADDR and SO_REUSEPORT that allows binding to the same address
and port, but unfortunately, when used after the load-balancing socket
options have been already set, it overrides the previous setting, so we
need our own helper function to enable the SO_REUSEADDR/SO_REUSEPORT
first and then enable the load-balancing socket option.
2020-10-05 15:18:28 +02:00
Ondřej SurýandOndřej Surý acb6ad9e3c Use uv_os_sock_t instead of uv_os_fd_t for sockets
On POSIX based systems both uv_os_sock_t and uv_os_fd_t are both typedef
to int.  That's not true on Windows, where uv_os_sock_t is SOCKET and
uv_os_fd_t is HANDLE and they differ in level of indirection.
2020-10-05 15:18:28 +02:00
Ondřej SurýandOndřej Surý 9dc01a636b Refactor isc__nm_socket_freebind() to take fd and sa_family as args
The isc__nm_socket_freebind() has been refactored to match other
isc__nm_socket_...() helper functions and take uv_os_fd_t and
sa_family_t as function arguments.
2020-10-05 15:18:24 +02:00
Ondřej SurýandOndřej Surý d685bbc822 Add helper function to enable DF (don't fragment) flag on UDP sockets
This commits add isc__nm_socket_dontfrag() helper functions.
2020-10-05 14:55:20 +02:00
Ondřej SurýandOndřej Surý 5daaca7146 Add SO_REUSEPORT and SO_INCOMING_CPU helper functions
The setting of SO_REUSE**** and SO_INCOMING_CPU have been moved into a
separate helper functions.
2020-10-05 14:54:24 +02:00
Matthijs Mekking 1567524a4f Merge branch '1749-rndc-dnssec-rollover' into 'main'
Resolve "rndc trigger rollover"

Closes #1749

See merge request isc-projects/bind9!4004
2020-10-05 09:46:48 +00:00
Matthijs Mekking 78c09f5622 Use default algorithm in kasp test if possible
These tests don't require a specific algorithm so they should use
the DEFAULT_ALGORITHM from 'conf.sh.common'.
2020-10-05 10:53:46 +02:00
Matthijs Mekking 70d1ec432f Use explicit result codes for 'rndc dnssec' cmd
It is better to add new result codes than to overload existing codes.
2020-10-05 10:53:46 +02:00
Matthijs Mekking edc53fc416 Various rndc dnssec -checkds fixes
While working on 'rndc dnssec -rollover' I noticed the following
(small) issues:

- The key files where updated with hints set to "-when" and that
  should always be "now.
- The kasp system test did not properly update the test number when
  calling 'rndc dnssec -checkds' (and ensuring that works).
- There was a missing ']' in the rndc.c help output.
2020-10-05 10:53:46 +02:00