summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-manager.c
AgeCommit message (Collapse)Author
2015-08-21remove unused variablesThomas Hindoe Paaboel Andersen
2015-08-21resolved: rework synthesizing logicLennart Poettering
With this change we'll now also generate synthesized RRs for the local LLMNR hostname (first label of system hostname), the local mDNS hostname (first label of system hostname suffixed with .local), the "gateway" hostname and all the reverse PTRs. This hence takes over part of what nss-myhostname already implemented. Local hostnames resolve to the set of local IP addresses. Since the addresses are possibly on different interfaces it is necessary to change the internal DnsAnswer object to track per-RR interface indexes, and to change the bus API to always return the interface per-address rather than per-reply. This change also patches the existing clients for resolved accordingly (nss-resolve + systemd-resolve-host). This also changes the routing logic for queries slightly: we now ensure that the local hostname is never resolved via LLMNR, thus making it trustable on the local system.
2015-08-17Bug #944: Deletion of unnecessary checks before a few calls of systemd functionsMarkus Elfring
The following functions return immediately if a null pointer was passed. * calendar_spec_free * link_address_free * manager_free * sd_bus_unref * sd_journal_close * udev_monitor_unref * udev_unref It is therefore not needed that a function caller repeats a corresponding check. This issue was fixed by using the software Coccinelle 1.0.1.
2015-07-27resolved: scope - write() unicast DNS packetsTom Gundersen
As we have connect()ed to the desired DNS server, we no longer need to pass control messages manually when sending packets. Simplify the logic accordingly.
2015-07-27resolved: transaction - don't request PKTINFO for unicast DNSTom Gundersen
This was only ever used by LLMNR, so don't request this for unicast DNS packets.
2015-07-14resolved: use one UDP socket per transactionTom Gundersen
We used to have one global socket, use one per transaction instead. This has the side-effect of giving us a random UDP port per transaction, and hence increasing the entropy and making cache poisoining significantly harder to achieve. We still reuse the same port number for packets belonging to the same transaction (resent packets).
2015-07-14resolved: reference count the dns serversTom Gundersen
We want to reference the servers from their active transactions, so make sure they stay around as long as the transaction does.
2015-07-13resolved: move LLMNR related functions into separate fileDaniel Mack
2015-06-13sd-netlink: rename from sd-rtnlTom Gundersen
2015-06-11sd-rtnl: make joining broadcast groups implicitTom Gundersen
2015-06-10resolve: move dns routines into sharedNick Owens
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-05-18resolved: fix crash when shutting downLennart Poettering
Reported by Cristian Rodríguez http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-04-11shared: add random-util.[ch]Ronny Chevalier
2015-04-08resolved: maintain order when writing resolv.conf entriesLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-March/029850.html
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-12include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen
include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
2015-02-12Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"Lennart Poettering
This reverts commit d6d810fbf8071f8510450dbacd1d083f37603656. It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw sockets.
2015-02-10tree-wide: Always use recvmsg with MSG_CMSG_CLOEXECCristian Rodríguez
2015-01-26treewide: fix multiple typosTorstein Husebø
2015-01-23resolved: when rereading /etc/resolv.conf, always start using first DNS ↵Lennart Poettering
server again Previously we tried to stick to a DNS server as long as it is available. When /etc/resolv.conf changed, and the old DNS server we used was still in there we'd continue to use it, even if it was at the end of the list. With this change we'll now always start with the first DNS server in the list again. Rationale: certain network managing implementations (notably NetworkManager) when connected to a VPN place both the VPN DNS server as well as the local DNS server in /etc/resolv.conf. If we used the local one before we would thus continue to use the local one, making VPN names unresolvable. NetworkManager really should be fixed to only place the VPN DNS servers in the file, but with this commit things are at least similarly bad as they used to be...
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: a few more log_*_errno + return simplificationsMichal Schmidt
The one in tmpfiles.c:create_item() even looks like it fixes a bug.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-10-22resolved: simplify detection of packets from the loopback deviceLennart Poettering
We can simplify our code quite a bit if we explicitly check for the ifindex being 1 on Linux as a loopback check. Apparently, this is hardcoded on Linux on the kernel, and effectively exported to userspace via rtnl and such, hence we should be able to rely on it.
2014-10-13resolved: apply label to /run/systemd/resolve/resolv.confZbigniew Jędrzejewski-Szmek
Under an SELinux system, we want the file that is created to have a proper context, different from the default for files in /run. This is so that the policy can give access to almost everyone to this file.
2014-10-13resolved: split out writing of resolv.confZbigniew Jędrzejewski-Szmek
manager_write_resolv_conf() is quite long anyway.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-09-13resolved: fall back to hardcoded ifindex when checking if a link is the loopbackTom Gundersen
Reported by Philippe De Swert <philippedeswert@gmail.com>. Coverity CID#1237656
2014-08-22resolved: fix typo in log messageLennart Poettering
2014-08-22shared: add MAXSIZE() and use it in resolvedDavid Herrmann
The MAXSIZE() macro takes two types and returns the size of the larger one. It is much simpler to use than MAX(sizeof(A), sizeof(B)) and also avoids any compiler-extensions, unlike CONST_MAX() and MAX() (which are needed to avoid evaluating arguments more than once). This was suggested by Daniele Nicolodi <daniele@grinta.net>. Also make resolved use this macro instead of CONST_MAX(). This enhances readability quite a bit.
2014-08-20resolved: write resolv.conf search - switch argumentsTom Gundersen
Found by Lukáš Nykrýn.
2014-08-15resolve: fix compilation on LLVM+clangDavid Herrmann
LLVM+clang does not allow statement-expressions inside of type-declarations (file-scope). Use CONST_MAX() to avoid this.
2014-08-14resolved: pull in domain names from sd-networkTom Gundersen
2014-08-13resolved: skip IPv6 LLMNR if IPv6 is not availableLennart Poettering
2014-08-12resolved: unify logic how we flush out DNS servers we learntLennart Poettering
2014-08-12resolved: filter out duplicate DNS servers when writing resolv.confLennart Poettering
2014-08-11resolved: when picking a new hostname make sure two hosts pick different onesLennart Poettering
This way we can avoid always picking the same replacement hostnames when picking one.
2014-08-11resolved: verify all RRs when we come back from suspendLennart Poettering
2014-08-11resolved: implement full LLMNR conflict detection logicLennart Poettering
2014-08-04resolved: actually read the initial state data from networkd when we initializeLennart Poettering
2014-08-04resolved: fix order in which we destroy manager resourcesLennart Poettering
2014-08-04resolved: when there's already somebody listening on the LLMNR ports, simple ↵Lennart Poettering
disable LLMNR and warn, but continue This allows us to run resolved inside an nspawn container that shares the network namespace with the host, if there's already an instance running.
2014-08-03resolved: remove unused variablesThomas Hindoe Paaboel Andersen
2014-08-01resolved: flush cache each time we change to a different DNS serverLennart Poettering
2014-08-01resolved: read the system /etc/resolv.conf unless we wrote it ourselvesLennart Poettering
This way we integrate nicely with foreign network management stacks, such as NM.
2014-08-01resolved: rename resolved.h to resolved-manager.hLennart Poettering
After all it pretty much exlcusively containers definitions about the "Manager" object, hence let's call this the most obvious way.
2014-08-01resolved: beef up DNS server configuration logicLennart Poettering
We now maintain two lists of DNS servers: system servers and fallback servers. system servers are used in combination with any per-link servers. fallback servers are only used if there are no system servers or per-link servers configured. The system server list is supposed to be populated from a foreign tool's /etc/resolv.conf (not implemented yet). Also adds a configuration switch for LLMNR, that allows configuring whether LLMNR shall be used simply for resolving or also for responding.