summaryrefslogtreecommitdiffstats
path: root/src/resolve (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #17203 from poettering/resolv-conf-modeLennart Poettering2020-09-304-0/+96
|\ | | | | expose resolv.conf mode bus property
| * resolvectl: show resolv.conf mode in resolvectl outputLennart Poettering2020-09-301-0/+10
| |
| * resolved: expose a new bus property that informs about the /etc/resolv.conf modeLennart Poettering2020-09-303-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be one of "foreign", "missing", "stub", "static", "uplink", depending on how /etc/resolv.conf is set up: foreign → someone/something else manages /etc/resolv.conf, systemd-resolved is just the consumer missing → /etc/resolv.conf is missing altogether stub/static/uplink → the file is managed by resolved, with the well-known modes Fixes: #17159
* | resolved: turn off that a search domain is derived from the host's fqdnLennart Poettering2020-09-302-2/+9
|/ | | | | | | | | | | | | | | | | | | | If the hostname of a system is set to an fqdn, glibc traditionally derives a search domain from it if none is explicitly configured. This is a bit weird, and we currently don't do that in our own search path logic. Following #17193 let's turn this behaviour off for now. Yes, this has a slight chance of pissing people off who think this behaviour is good. If this is indeed an issue, we can revisit the issue but in that case if we readd the concept we should do it properly: derive the search domain from the fqdn in our codebase too and report it in resolvectl, and in our generated stub files. But I have the suspicion most people who set the hostname to an fqdn aren#t even aware of this behaviour nor want it, so let's wait until people complain. Fixes: #17193
* resolved: imply SD_RESOLVED_NO_SEARCH when looking up trailing dot domainsLennart Poettering2020-09-292-11/+39
| | | | | | | | | | | | | | Let's turn off the search domain logic if a trailing dot is specified when looking up hostnames and RRs via the Varlink + D-Bus APIs (and thus also when doing so via nss-resolve). (This doesn't affect lookups via the stub, since for the any search path logic is done client side anyway) It might make sense to force the DNS protocol in this case too (and disable LLMR + mDNS), but we'll leave that for a different PR — if it even makes sense. It might also make sense to disable the logic of never routing single-label lookups to the Internet if a trailing to is specified, but this needs more discussion too.
* tree-wide: fix typos found by codespellFrantisek Sumsal2020-09-141-1/+1
| | | | Reported by Fossies.org
* tree-wide: add helper for IPv4/IPv6 sockoptsLennart Poettering2020-09-113-70/+22
| | | | | | | | | | A variety of sockopts exist both for IPv4 and IPv6 but require a different pair of sockopt level/option number. Let's add helpers for these that internally determine the right sockopt to call. This should shorten code that generically wants to support both ipv4 + ipv6 and for the first time adds correct support for some cases where we only called the ipv4 versions, and not the ipv6 options.
* Merge pull request #16947 from keszybz/socket-parsing-reworkLennart Poettering2020-09-102-194/+93
|\ | | | | Socket parsing rework
| * resolved: drop duplicated checkZbigniew Jędrzejewski-Szmek2020-09-101-9/+2
| | | | | | | | The same conditional appears a few lines down.
| * Get rid of in_addr_port_from_string_auto() againZbigniew Jędrzejewski-Szmek2020-09-101-1/+1
| | | | | | | | | | With the commit "shared/socket-netlink: only allow ifindex if explicitly supported" this helper is not necessary anymore.
| * resolved: unify the two functions to create main stubsZbigniew Jędrzejewski-Szmek2020-09-101-72/+32
| | | | | | | | | | There is a small functional difference: IP_TTL==1 is now also set for the UDP socket. I assume that it wasn't set by mistake.
| * resolved: unify the two functions to create extra stubsZbigniew Jędrzejewski-Szmek2020-09-101-100/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a minor functional change: IPV6_FREEBIND is set of IPv6 sockets, not IP_FREEBIND. This was missed in af8b1384, but I noticed only after the merging the two functions. And a not-so-minor functional chagnge: 7216a3b5dcde36245 changed manager_dns_stub_tcp_fd_extra() to return the fd even if the source was already initialized, but it didn't do the same change for manager_dns_stub_udp_fd_extra(), so it would return 0 in that case. But 0354029bf572489b uses manager_dns_stub_udp_fd_extra() when preparing to call manager_send(), and will pass 0 as the fd in that case. For both socket types fd is now always returned.
| * resolve: move handler functions higherZbigniew Jędrzejewski-Szmek2020-09-101-56/+56
| | | | | | | | No functional change, preparation for subsequent refactoring.
* | resolve: downgrade error level when the error will be ignoredYu Watanabe2020-09-101-19/+45
| |
* | resolve: check DNSSD service name template before assigning itYu Watanabe2020-09-104-41/+36
|/
* Merge pull request #16985 from poettering/resolve-dns-stub-extra-fixletsZbigniew Jędrzejewski-Szmek2020-09-0910-128/+168
|\ | | | | resolved: dns stub listener extra fixes
| * resolved: don't store udp/tcp fd in DnsPacket objectLennart Poettering2020-09-087-50/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DnsPacket should better be a "dead" object, i.e. list facts, not track resources. By including an fd in its fields it started tracking resources however, without actually taking a ref to the fd (i.e. no dup() or so was called on it). Let's hence rework things so that we don#t have to keep track of the fd a packet came in from. Instead, pass around the DnsStubListenerExtra object wherever we need to. This should be useful as soon as we start caching whole DnsPacket objects to allow replying to DNSSEC/CO packets, i.e. where we have to keep a copy of the original DnsPacket around for a long time in cache, potentially much longer than the fds the packet was received on.
| * resolved: move dns stub definitions to resolved-dns-stub.[ch]Lennart Poettering2020-09-086-71/+78
| | | | | | | | Just some moving around, no logic changes.
| * resolve: DNSStubListenerExtra → DnsStubListenerExtraLennart Poettering2020-09-084-15/+15
| | | | | | | | | | All our other struct types use the "Dns" spelling, rather than "DNS". Do the same for this struct.
* | Merge pull request #16979 from keszybz/return-log-debugLennart Poettering2020-09-081-1/+2
|\ \ | |/ |/| Fix 'return log_error()' and 'return log_warning()' patterns
| * tree-wide: correct cases where return log_{error,warning} is used without valueZbigniew Jędrzejewski-Szmek2020-09-081-1/+2
| | | | | | | | | | | | | | | | In various cases, we would say 'return log_warning()' or 'return log_error()'. Those functions return 0 if no error is passed in. For log_warning or log_error this doesn't make sense, and we generally want to propagate the error. In the few cases where the error should be ignored, I think it's better to split it in two, and call 'return 0' on a separate line.
* | tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-0818-105/+54
|/
* Merge pull request #16951 from ↵Zbigniew Jędrzejewski-Szmek2020-09-057-216/+217
|\ | | | | | | | | yuwata/resolve-follow-ups-for-extra-dns-stub-listener resolve: follow-ups for extra DNS stub listener
| * resolve: use correct fd for UDP stub listnerYu Watanabe2020-09-043-10/+3
| |
| * resolve: do not check sender and destination for packet received by extra ↵Yu Watanabe2020-09-041-13/+36
| | | | | | | | DNS stub listner
| * resolve: use sd_event_source_set_io_fd_own() for stub listnersYu Watanabe2020-09-043-35/+29
| |
| * resolve: introduce dns_stub_listener_extra_free() and set it as a key destructorYu Watanabe2020-09-044-20/+17
| |
| * resolve: adjust error messagesYu Watanabe2020-09-041-22/+6
| |
| * resolve: do not set IPv4 specific options on IPv6 socketYu Watanabe2020-09-041-13/+34
| |
| * resolve: do not set IP_TTL for extra DNS stub listenersYu Watanabe2020-09-041-3/+2
| |
| * resolve: use in_addr_union to store addresses for extra dns stub listenersYu Watanabe2020-09-043-24/+50
| |
| * resolve: fix indentationYu Watanabe2020-09-041-26/+26
| |
| * resolve: stop extra stub listners before freeing information about themYu Watanabe2020-09-041-1/+1
| |
| * resolve: set DNS_STUB_LISTENER_YES if no protocol is specified in ↵Yu Watanabe2020-09-043-84/+51
| | | | | | | | DNSStubListenExtra=
| * resolve: Manager::dns_stub_listener_mode is not relevant to extra stub listenersYu Watanabe2020-09-041-4/+1
| |
| * resolve: make DnsStubListenerMode bitfieldYu Watanabe2020-09-042-5/+5
| |
| * resolve: rename dns_stub_extra_event_source -> event_sourceYu Watanabe2020-09-042-6/+6
| | | | | | | | As the name is too redundant.
* | resolvectl: add 'log-level' to help messageYu Watanabe2020-09-041-0/+1
|/ | | | Follow-up for df9578498f3f566409fcb71229d9fc99e4ab0568.
* resolved: ttl/hopcount sockopt is not a booleanLennart Poettering2020-09-043-6/+6
| | | | | These are integer values, hence specify them as integers, not as booleans.
* Merge pull request #16044 from ssahani/resolved-interfaceZbigniew Jędrzejewski-Szmek2020-09-037-30/+370
|\ | | | | systemd-resolved: allow configurable bind address
| * resolve: allow configurable bind addressSusant Sahani2020-09-037-30/+370
| |
* | resolved: remove superfluous ;;Lennart Poettering2020-08-281-1/+1
| |
* | tree-wide: no need to negate argument to ERROR_IS_XYZ()Lennart Poettering2020-08-281-2/+2
| | | | | | | | These macros call abs() internally, hence let's simplify invocations.
* | resolved: make sure we initialize t->answer_errno before completing the ↵Lennart Poettering2020-08-281-14/+15
|/ | | | | | | | | | transaction We must have the error number around when completing the transaction. Let's hence make sure we always initialize it *first* (we accidentally did it once after). Fixes: #11626
* resolved: add minimal varlink api for resolving hostnames/addressesLennart Poettering2020-08-267-39/+598
| | | | | | This allows us to later port nss-resolve to use Varlink rather than D-Bus for resolution. This has the benefit that nss-resolve based resoluton works even without D-Bus being up. And it's faster too.
* resolved: minor clean-ups for resolved-bus.cLennart Poettering2020-08-261-11/+29
|
* resolved: move query bus tracking to resolved-bus.cLennart Poettering2020-08-263-37/+39
| | | | | | | | It's strictly bus-specific, hence let's move this to resolved-bus.c like the rest of the bus specific logic. This is also in preparation for adding an alternative varlink transport, which needs similar functionality, but varlink instead of bus-specific.
* resolved: rename request → bus_requestLennart Poettering2020-08-263-38/+38
| | | | | | Let's prepare for adding a new varlink interface, and thus rename the "request" field to "bus_request", so that we can later add a varlink_request field too.
* resolved: drop suppress_unroutable_family fieldLennart Poettering2020-08-262-5/+0
| | | | It's unused since 90bdc8be66765df09bbc355783cee7204a5ebb31.
* resolve: lift limits on search domains count or lengthDimitri John Ledkov2020-08-181-10/+0
| | | | | | | | | glibc 2.26 lifted restrictions on search domains count or length to unlimited. This has also been backported to 2.17 in some distributions (RHEL 7 and derivatives). Other softwares may have their own limits for search domains, but we should not restrict what is written out any more. https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html