Systemd/src/resolve
Dan Streetman 1c089741d3 resolved: set stream type during DnsStream creation
The DnsStreamType was added to track different types of DNS TCP streams,
instead of refcounting all of them together.  However, the stream type was
not actually set into the stream->type field, so while the reference count
was correctly incremented per-stream-type, the reference count was always
decremented in the cleanup function for stream type 0, leading to
underflow for the type 0 stream (unsigned) refcount, and preventing new
type 0 streams from being created.

Since type 0 is DNS_STREAM_LOOKUP, which is used to communicate with
upstream nameservers, once the refcount underflows the stub resolver
no longer is able to successfully fall back to TCP upstream lookups
for any truncated UDP packets.

This was found because lookups of A records with a large number of
addresses, too much to fit into a single 512 byte DNS UDP reply,
were causing getaddrinfo() to fall back to TCP and trigger this bug,
which then caused the TCP fallback for later large record lookups
to fail with 'connection timed out; no servers could be reached'.

The stream type was introduced in commit:
652ba568c6
2019-10-25 13:36:29 +09:00
..
dns-type.c Drop my copyright headers 2018-06-14 13:03:20 +02:00
dns-type.h Drop my copyright headers 2018-06-14 13:03:20 +02:00
dns_type-to-name.awk meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
generate-dns_type-gperf.py tree-wide: adjust fall through comments so that gcc is happy 2017-11-20 13:06:25 -08:00
generate-dns_type-list.sed meson: build systemd using meson 2017-04-23 21:47:26 -04:00
meson.build Merge pull request #9770 from keszybz/etc-resolved-no-address 2018-08-02 12:54:50 +09:00
org.freedesktop.resolve1.conf resolved: add legacy dbus service and policy files 2014-07-16 03:41:39 +02:00
org.freedesktop.resolve1.policy polkit: fix typo 2019-09-20 21:02:47 +09:00
org.freedesktop.resolve1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
resolv.conf resolve: enable EDNS0 towards the 127.0.0.53 stub resolver 2018-12-17 15:15:18 +01:00
resolvconf-compat.c Rename EXTRACT_QUOTES to EXTRACT_UNQUOTE 2019-06-28 11:35:05 +02:00
resolvconf-compat.h tree-wide: add multiple inclusion guard 2018-06-25 13:04:59 +09:00
resolvectl.c Highlight the synopsis and summary in --help 2019-10-08 18:21:27 +02:00
resolvectl.h resolvectl: remove allow_loopback parameter from ifname_mangle() 2018-12-05 18:46:23 +01:00
resolved-bus.c resolved: query polkit only after parsing the data 2019-08-27 19:49:09 +02:00
resolved-bus.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-conf.c Rename EXTRACT_QUOTES to EXTRACT_UNQUOTE 2019-06-28 11:35:05 +02:00
resolved-conf.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
resolved-def.h resolve: expose dns_server_address_valid() 2019-07-17 06:59:12 +09:00
resolved-dns-answer.c tree-wide: get rid of strappend() 2019-07-12 14:31:12 +09:00
resolved-dns-answer.h tree-wide: always declare bitflag enums the same way 2019-01-07 17:50:39 +01:00
resolved-dns-cache.c resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-dns-cache.h resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-dns-dnssec.c tree-wide: get rid of strappend() 2019-07-12 14:31:12 +09:00
resolved-dns-dnssec.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-packet.c Drop trailing slash from assert_cc() definition 2019-07-17 12:57:20 +02:00
resolved-dns-packet.h resolved: don't let EDNS0 OPT dgram size affect TCP 2019-03-13 19:34:05 +01:00
resolved-dns-query.c resolved: keep stub stream connections up for as long as client wants 2019-02-15 17:13:58 +01:00
resolved-dns-query.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-question.c codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
resolved-dns-question.h resolved: use a temporary Set to speed up dns question parsing 2019-03-04 15:53:37 +01:00
resolved-dns-rr.c travis: turn on nonnull-attribute on Fuzzit 2019-06-15 23:12:24 +02:00
resolved-dns-rr.h headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00
resolved-dns-scope.c Drop RATELIMIT macros 2019-09-20 16:05:53 +02:00
resolved-dns-scope.h resolved: add an explicit way to configure whether a link is useful as default route 2018-12-21 12:10:07 +01:00
resolved-dns-search-domain.c resolve: reject host names with leading or trailing dashes in /etc/hosts 2018-12-10 09:56:56 +01:00
resolved-dns-search-domain.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-server.c resolve: expose dns_server_address_valid() 2019-07-17 06:59:12 +09:00
resolved-dns-server.h resolve: expose dns_server_address_valid() 2019-07-17 06:59:12 +09:00
resolved-dns-stream.c resolved: set stream type during DnsStream creation 2019-10-25 13:36:29 +09:00
resolved-dns-stream.h resolved: don't require check when importing resolved-dnstls.h 2019-06-19 13:10:44 +02:00
resolved-dns-stub.c tree-wide: port users over to use new ERRNO_IS_ACCEPT_AGAIN() call 2019-04-10 22:11:18 +02:00
resolved-dns-stub.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-synthesize.c util: drop missing.h from socket-util.h 2018-12-06 13:31:16 +01:00
resolved-dns-synthesize.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-transaction.c resolved: fix abort when recv() returns 0 2019-09-13 13:31:43 +09:00
resolved-dns-transaction.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-trust-anchor.c Rename EXTRACT_QUOTES to EXTRACT_UNQUOTE 2019-06-28 11:35:05 +02:00
resolved-dns-trust-anchor.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dns-zone.c codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
resolved-dns-zone.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-dnssd-bus.c util: drop missing.h from socket-util.h 2018-12-06 13:31:16 +01:00
resolved-dnssd-bus.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
resolved-dnssd-gperf.gperf resolved: add enablers for DNS-SD 2017-12-08 14:29:27 +02:00
resolved-dnssd.c resolved: use standard paths for .dnssd files 2019-02-18 10:25:25 +01:00
resolved-dnssd.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
resolved-dnstls-gnutls.c resolved: fix connection failures with TLS 1.3 and GnuTLS 2019-10-21 20:35:05 +02:00
resolved-dnstls-gnutls.h resolved: move TLS data shared by all servers to manager 2019-06-18 19:16:36 +02:00
resolved-dnstls-openssl.c resolved: add strict mode for DNS-over-TLS 2019-06-19 13:10:44 +02:00
resolved-dnstls-openssl.h resolved: move TLS data shared by all servers to manager 2019-06-18 19:16:36 +02:00
resolved-dnstls.h resolved: don't require check when importing resolved-dnstls.h 2019-06-19 13:10:44 +02:00
resolved-etc-hosts.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00
resolved-etc-hosts.h test-resolved-etc-hosts: add tests for /etc/hosts parsing 2018-08-01 12:38:39 +02:00
resolved-gperf.gperf resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-link-bus.c resolved: allow access to Set*Link and Revert methods through polkit 2019-08-27 19:49:09 +02:00
resolved-link-bus.h resolved: add bus API to set per-link "default route" boolean 2018-12-21 12:10:07 +01:00
resolved-link.c resolved: add strict mode for DNS-over-TLS 2019-06-19 13:10:44 +02:00
resolved-link.h resolve: rename Link.name -> Link.ifname 2019-04-13 17:51:59 +09:00
resolved-llmnr.c tree-wide: port users over to use new ERRNO_IS_ACCEPT_AGAIN() call 2019-04-10 22:11:18 +02:00
resolved-llmnr.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
resolved-manager.c resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-manager.h resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-mdns.c resolved: switch cache option to a tri-state option (systemd#5552). 2019-07-17 10:42:53 -04:00
resolved-mdns.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
resolved-resolv-conf.c Make fopen_temporary and fopen_temporary_label unlocked 2019-04-12 11:44:56 +02:00
resolved-resolv-conf.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
resolved.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00
resolved.conf.in resolved: have the stub resolver listen on both TCP and UDP by default 2018-12-12 21:21:04 +01:00
RFCs resolve: add support for RFC 8080 (#7600) 2017-12-12 16:30:12 +01:00
test-dns-packet.c tree-wide: rename path_join_many() to path_join() 2018-11-30 10:59:47 +01:00
test-dnssec-complex.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
test-dnssec.c tree-wide: add whitespace between type and variable name 2018-12-04 09:29:54 +01:00
test-resolve-tables.c test: add more string-table tests in test-resolve-tables 2018-07-24 01:26:14 +09:00
test-resolved-etc-hosts.c tests: use the test helpers in more places 2019-03-04 14:15:38 +01:00
test-resolved-packet.c tests: use the test helpers in more places 2019-03-04 14:15:38 +01:00