summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-manager.c
AgeCommit message (Collapse)Author
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.
2014-07-31hostnamed: watch system hostname changes and update LLMNR RRs accordinglyLennart Poettering
2014-07-31resolved: implement LLMNR uniqueness verificationLennart Poettering
2014-07-31Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek
$ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
2014-07-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
2014-07-29resolved: add more debug loggingLennart Poettering
2014-07-29resolved: set LLMNR TCP and UDP TTLs to the values suggested by the RFCLennart Poettering
2014-07-29resolve: add llmnr responder side for UDP and TCPLennart Poettering
Name defending is still missing.
2014-07-23resolved: don't read DHCP leasesTom Gundersen
networkd will expose both statically configured DNS servers and servers receieved over DHCP in sd_network_get_dns(), so no need to keep the distinction in resolved.
2014-07-23resolved: rework logic so that we can share transactions between queries of ↵Lennart Poettering
different clients
2014-07-18change type for address family to "int"Lennart Poettering
Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
2014-07-18resolved: add LLMNR support for looking up namesLennart Poettering
2014-07-17resolved: properly handle MTU logicLennart Poettering
2014-07-17sd-network: fix parameter order for sd_network_monitor_new()Lennart Poettering
Constructors should return the object they created as first parameter, except when they are generated as a child/member object of some other object in which case that should be first.
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-16resolved: support for TCP DNS queriesLennart Poettering
2014-07-16dns-domain: introduce macros for accessing all DNS header fieldsLennart Poettering