Commit Graph

2298 Commits

Author SHA1 Message Date
Jim Hague 686285ef59 Re-remove strings.h include.
Again, looks like another copied-from-elsewhere problem.
2021-05-28 00:04:11 +01:00
Jim Hague ae854a8650 Re-add include guards to parseutil.c.
The lack of them breaks the build on Windows.

I suspect we may have another copied-from-elsewhere problem.
2021-05-27 22:24:17 +01:00
Willem Toorop 50463c7480 Merge branch 'develop4' of https://github.com/amialkow/getdns into amialkow-develop4 2021-05-27 21:56:38 +02:00
Willem Toorop 1012e34441 update of ldns 2021-05-27 21:23:16 +02:00
Jim Hague f9c3a359ed Revise recent lookup3.c update to restore building on Windows.
As we're now building with CMake, and CMake can supply endianness, just insist on using that.
2021-05-27 09:45:30 +01:00
Willem Toorop 6c3f75f4e9 Test transports with OpenSSL 2021-05-26 23:16:02 +02:00
Willem Toorop 880189367a Make tcp_send_timeout work with GnuTLS 2021-05-26 23:01:45 +02:00
Willem Toorop 189be4b5a5 Try to improve travis results with tcp_send_timeout 2021-05-26 22:37:55 +02:00
amialkow bfdba6d9d7 Merge branch 'getdnsapi:develop' into develop4 2021-05-26 09:55:16 -07:00
Willem Toorop 75b750b3f9
Merge pull request #506 from amialkow/develop3
Fixes #504
2021-05-26 16:11:01 +02:00
Willem Toorop 6a722f5d79
Merge pull request #496 from banburybill/develop
Some Windows behaviour fixes.
2021-05-26 16:09:35 +02:00
Willem Toorop eeb460af8d Merge branch 'develop' of github.com:getdnsapi/getdns into develop 2021-05-26 16:06:30 +02:00
Willem Toorop 624f688967 Honour the claim from documentation: When not set (the default), the system default is left alone. 2021-05-26 15:57:52 +02:00
Willem Toorop 515127289c Merge branch 'tcp-send-timeout' of https://github.com/maciejsszmigiero/getdns into maciejsszmigiero-tcp-send-timeout 2021-05-26 15:56:55 +02:00
Willem Toorop ae090a29b1
Merge pull request #482 from neheb/patch-1
val_secalgo: add missing DSA header
2021-05-26 15:48:10 +02:00
Willem Toorop df2997d9b7 Eliminate compiler warnings in tests 2021-05-26 15:44:24 +02:00
Willem Toorop 1184f2b8ea Update components from Unbound 2021-05-26 15:43:40 +02:00
Willem Toorop 8abc3b62b8
Merge pull request #468 from renaudallard/develop
Added checks for LibreSSL and OpenBSD
2021-05-26 11:18:20 +02:00
Willem Toorop 63e4d1a1ef
Merge pull request #474 from banburybill/feature/blocking-select
Observe blocking flag in select run_once.
2021-05-26 11:17:20 +02:00
Andrzej Mialkowski 8b558afde0 Fixes #505. Disable packet size checking. 2021-05-15 13:20:30 -07:00
Andrzej Mialkowski 7f606ea14f Add missing rr types: SVCB and HTTPS 2021-05-15 12:32:58 -07:00
Andrzej Mialkowski fa282a59ec Add missing rr types: SVCB and HTTPS 2021-05-15 12:32:58 -07:00
Andrzej Mialkowski 7b12e21ad0 Implement name compression during response packet generation. Compression is required by certain clients like UDP to fit response in packet size limit. While generating packet small cache stores recently used names (currently 4 entries) and uses relative references to previous instances of the same name. Each reused instance is just two bytes of relative reference (0xC000 + offset). Cache is currently performing lookup for query name, responses and CNAMEs. 2021-05-09 14:45:16 -07:00
Jim Hague 42e4cfc383 Windowqs mkstemp: open() needs more permissions.
Specifically:

1. The open must be for read only or read/write - use read/write.
2. The file permission must permit read and write.
2020-12-12 21:16:46 +00:00
Jim Hague 6439b0407a Add platform functions for reporting file errors.
Windows socket error numbers are not reported using errno, but with
WSAGetLastError(). _getdns_errnostr() and friends as implemented on
Windows don't work for errors resulting from file open/close/read/write
etc.

So add a parallel set of functions specifically for file errors.
2020-12-11 16:08:02 +00:00
Eli Lindsey 71521626d9 only check for and process read/write events if status is success 2020-09-10 10:59:12 -04:00
Rosen Penev 80cdfb3bd0
fix compilation without deprecated OpenSSL APIs
Several cmake header checks were missing and added.

Added rsa.h include.

Remove ENGINE_load_dynamic. ENGINE_load_builtin_engines already does
this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-04 19:54:18 -07:00
Willem Toorop bda845ce43 Issue #430 listeners reply returned wireformat
So that proxies based on `getdns_set_listen_addresses()` reply with compression from the original response.
2020-08-04 00:05:04 +02:00
Maciej S. Szmigiero 606a88f9aa
Add "tcp_send_timeout" option to set a TCP send data timeout
When using Stubby as a system DNS over TLS resolver with a Internet
connection that disconnects and reconnects from time to time there is often
a long waiting time (~20 minutes) after the connection reconnects before
DNS queries start to work again.

This is because in this particular case all the upstream TLS TCP
connections in Stubby are stuck waiting for upstream server response.
Which will never arrive since the host external IP address might have
changed and / or NAT router connection tracking entries for these TCP
connections might have been removed when the Internet connection
reconnected.

By default Linux tries to retransmit data on a TCP connection 15 times
before finally terminating it.
This takes 16 - 20 minutes, which is obviously a very long time to wait for
system DNS resolving to work again.
This is a real problem on weak mobile connections.

Thankfully, there is a "TCP_USER_TIMEOUT" per-socket option that allows
explicitly setting how long the network stack will wait in such cases.

Let's add a matching "tcp_send_timeout" option to getdns that allows
setting this option on outgoing TCP sockets.
For backward compatibility the code won't try to set it by default.

With this option set to, for example, 15 seconds Stubby recovers pretty
much instantly in such cases.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2020-07-13 00:21:16 +02:00
Eli Lindsey 2673a5736c register only a single poll_t with libuv
Most of the time we only need a read _or_ a write callback registered
with libuv - for example, on a UDP request a write callback is
registered, when executed the write callback performs the write,
deregisters itself, and registers a read callback.

However there is one case where getdns registers both read and write
callbacks: when a backlog of TCP requests is going to the same upstream
resolver, we use a single fd and queue the requests. In this instance we
want to listen for both read (to get responses for requests we've
already sent) and write (to continue to send our pending requests).

libuv, like most event libraries, only allows one callback to be
registered per fd. To get notification for both reads and writes, you
should examine the event flags and have appropriate conditional logic
within the single callback. Today getdns incorrectly tries to register
two separate poll_t with libuv, one for read and one for write - this
results in a crash (internal libuv assertion guaranteeing that only a
single poll_t is registered per fd).

Testing was done by using flamethrower
(https://github.com/DNS-OARC/flamethrower) to toss queries at a program
that embeds getdns.

Note that a higher qps trigger a _different_ getdns/libuv crashing bug
that occurs when the TCP backlog grows so large that requests start to
time out. That crash is not addressed in this PR, and will be more
involved to fix.
2020-06-18 17:31:34 -04:00
Jim Hague 8a95f3d279 Observe blocking flag in select run_once.
Currently run_once always blocks.
2020-06-12 10:49:47 +01:00
Willem Toorop 8bd87c490e Fix of const-info.c 2020-04-14 20:58:36 +02:00
Willem Toorop 9ecd3fde1c Privacy aware DNS Cookies
Track source IP address in an efficient manner to make sure the same cookie will not be sent from different source IP addresses.
2020-04-09 16:24:34 +02:00
Willem Toorop de13a0c32d Better retry on badcookie flooding prevention 2020-04-08 19:16:51 +02:00
Willem Toorop 8b62970e0c Response to BADCOOKIE extended rcode 2020-04-08 16:08:56 +02:00
Willem Toorop 563b2b113a Show dns_root_servers setting in API information 2020-03-27 10:11:26 +01:00
Renaud Allard 31031d7c57 Added checks for LibreSSL and OpenBSD 2020-03-24 14:14:39 +01:00
Willem Toorop 73cee29f55 Make TLS Handshake timeout max 4/5th of timeout
for the query, just like connection setup timeout was, so fallback transport have a chance too when TCP connection setup is less well detectable (as with TCP_FASTOPEN on MacOS).
2020-03-16 14:50:59 +01:00
Jim Hague 0b01ad8e6f Merge branch 'develop' of https://github.com/getdnsapi/getdns into develop 2020-03-16 11:23:52 +00:00
Willem Toorop 3c6756d68b Issue #466: Memory leak with retrying queries
(for examples with search paths).
Thanks doublez13.
2020-03-13 22:31:01 +01:00
Jim Hague cd386cd917 Merge commit '26a95b5b8a213096641654c5b97976e66ec32e5d' into my-develop
# Conflicts:
#	src/gnutls/tls.c
2020-03-12 15:51:22 +00:00
Willem Toorop 26a95b5b8a Fix DoT with GnuTLS >= 3.6 2020-03-05 14:46:32 +01:00
Jim Hague 9baf655a7b Relax GnuTLS priority strings slightly to allow getdns to work with TLS1.3 servers.
Now GnuTLS 3.6.5 and later are in the field, we've run into problems handshaking with TLS1.3 servers with a GnuTLS build. OpenSSL works fine. Comparing the client handshake of GnuTLS and OpenSSL, we found GnuTLS was being considerably more restrictive. This change loosens the restriction so GnuTLS presents nearly the same set of cipher and other options and OpenSSL. OpenSSL provides more signature algorithms. The change gets GetDNS working against Quad1, Quad8, Quad9 and the getdnsapi servers.
2020-03-05 13:24:44 +00:00
Willem Toorop c234865a80 Print GnuTLS debug messages 2020-03-05 13:39:30 +01:00
Jim Hague e96e334932 Point ssl_dane submodule back at getdnsapi version. 2020-03-04 15:30:26 +00:00
Jim Hague 1328fac5ae Merge commit 'ef455471f4f1db778e7bcc58818fc780a280c16d' into develop 2020-03-04 15:13:02 +00:00
Willem Toorop ef455471f4 Work around dnsmasq issue 2020-03-04 10:57:11 +00:00
Jim Hague 822d8ad703 Revise recent lookup3.c update to restore building on Windows.
As we're now building with CMake, and CMake can supply endianness, just insist on using that.
2020-03-03 17:28:34 +00:00
Willem Toorop e7d435e426 Name only authentication with GNUTLS 2020-03-03 13:04:27 +00:00
Willem Toorop 9c8b70e4bc Eliminate compile error 2020-03-03 13:03:58 +00:00