summaryrefslogtreecommitdiff
path: root/src/resolve
AgeCommit message (Collapse)Author
2017-03-21resolved: detect and warn other running LLMNR stackYu Watanabe
Previously, `SO_REUSEADDR` is set before `bind`-ing socket, Thus, even if another LLMNR stack is running, `bind` always success and we cannot detect the other stack. By this commit, we first try to `bind` without `SO_REUSEADDR`, and if it fails, show warning and retry with `SO_REUSEADDR`.
2017-03-21resolved: add global config option to control mDNS stackYu Watanabe
2017-03-21resolved: detect and warn other running mDNS stackYu Watanabe
Previously, `SO_REUSEADDR` is set before `bind`-ing socket, Thus, even if another mDNS stack (e.g. avahi) is running, `bind` always success and we cannot detect the other stack. By this commit, we first try to `bind` without `SO_REUSEADDR`, and if it fails, show warning and retry with `SO_REUSEADDR`.
2017-03-21resolved: do not start LLMNR or mDNS stack when no network enables themYu Watanabe
When no network enables LLMNR or mDNS, it is not necessary to create LLMNR or mDNS related sockets. So, let's create them only when LLMNR- or mDNS-enabled network becomes active or at least one network enables `LLMNR=` or `MulticastDNS=` options.
2017-03-12resolve: add missing space in output message (#5574)Yu Watanabe
2017-02-28resolved: add the new KSK to the built-in resolved trust anchor (#5486)Lennart Poettering
Fixes: #5482
2017-02-24Fix missing space in comments (#5439)AsciiWolf
2017-02-20tree-wide: add man: to manpage references (#5402)Lucas Werkmeister
Found with: git grep '"[^"]*[a-z0-9]([0-9]\+p\?)' src/ | grep -vF man:
2017-02-17Merge pull request #5347 from poettering/local-ntaZbigniew Jędrzejewski-Szmek
more resolved fixes
2017-02-17resolved: try to authenticate SOA on negative repliesLennart Poettering
For caching negative replies we need the SOA TTL information. Hence, let's authenticate all auxiliary SOA RRs through DS requests on all negative requests.
2017-02-17resolved: extend various timeoutsLennart Poettering
Let's increase a number of timeouts as they apparently are too short for some real-world lookups. See: https://github.com/systemd/systemd/issues/4003#issuecomment-279842616 In particular we change the following timeouts: 1) The first UDP retry we increase 500ms → 750ms. This is a good idea, since some servers need relatively long responses for trivial lookups, and giving up our first attempt also has the effect of trying a different server for the next attempt which has the side effect that we'll run two down-grade iterations in parallel, on both servers. Hence, let's give servers a bit more time in the first iteration. 2) Permit 24 retries instead of just 16 per transactions. If we end up downgrading all the way down to UDP for a lookup we already need 5 iterations for that. If we want permit a couple of lost packages for each (let's say 4), then we already need 20 iterations. 3) Increase the overall query timeout on the service side to 60s (from 45s), simply because very long and slow DNSSEC + CNAME chains (such as us.ynuf.alipay.com) hit this boundary too easily. The client side timeout for the bus method call is increased to 90s, in order to have room for the dbus reply to go through
2017-02-17resolved: initialize all return values on successful exit of dns_cache_lookup()Lennart Poettering
Following our coding style on success we should initialize all return parameters of a function. We missed to cases for dns_cache_lookup() (but covered all others), fix them too.
2017-02-17resolved: show rcode in debug output for incoming repliesLennart Poettering
This is the most important piece of information of replies, hence show this in the first log message about it. (Wireshark shows it too in the short summary, hence this definitely makes sense...)
2017-02-17resolved: don't downgrade feature level if we get RCODE on UDP levelLennart Poettering
Retrying a transaction via TCP is a good approach for mitigating packet loss. However, it's not a good away way to fix a bad RCODE if we already downgraded to UDP level for it. Hence, don't do this. This is a small tweak only, but shortens the time we spend on downgrading when a specific domain continously returns a bad rcode.
2017-02-17resolved: cache SERVFAIL responses for 30sLennart Poettering
Some domains (such as us.ynuf.alipay.com) almost appear as if they actively want to sabotage our DNSSEC work. Specifically, they unconditionally return SERVFAIL on SOA lookups and always only after a 1s delay (at least). This is pretty bad for our validation logic, as we use SOA lookups to distuingish zones from non-terminal names. Moreover, SERVFAIL is an error that is typically returned if we send requests a server doesn't grok, and thus is reason for us to downgrade our protocol and try again. In case of these zones this means we'll accept the SERVFAIL response only after a full iterative downgrade to our lowest feature level: TCP. In combination with the 1s delays this has the effect of making us hit our transaction timeout way to easily. As first attempt to improve the situation: let's start caching SERVFAIL responses in our cache, after the full downgrade for a short period of time. Conceptually this is exposed as "weird rcode" caching, but for now we only consider SERVFAIL a "weird rcode" worthy of caching. Later on we might want to add more.
2017-02-17resolved: lengthen timeout for TCP transactionsLennart Poettering
When we are doing a TCP transaction the kernel will automatically resend all packets for us, there's no need to do that ourselves. Hence: increase the timeout for TCP transactions substantially, to give the kernel enough time to connect to the peer, without interrupting it when we become impatient.
2017-02-17resolved: when DNSSEC mode is disabled, don't go beyond EDNS0 feature levelLennart Poettering
There's no point in talking to a server in DNSSEC mode when we don't actually want to verify anything. See: #5352
2017-02-17resolved: when accepted a query candidate as final answer, propagate ↵Lennart Poettering
authentication bool even on failure Let's make sure that if we accept a query candidate, then let's also propagate the authenticated flag for it, so that we can properly report back to the clients whether lookups failed due to non-existance that can be proven.
2017-02-17resolved: propagate AD bit for NXDOMAIN into stub repliesLennart Poettering
When we managed to prove non-existance of a name, then we should properly propagate this to clients by setting the AD bit on NXDOMAIN. See: #4621
2017-02-17resolved: automatically downgrade reply bits on sendLennart Poettering
Doesn't really change anything, but makes things a bit simpler to read.
2017-02-17resolved: when the dns server feature level grace period elapses, flush cachesLennart Poettering
The cache might contain all kinds of unauthenticated data that we really shouldn't be using if we upgrade our feature level and suddenly are able to get authenticated data again. Might fix: #4866
2017-02-17resolved: fix NSEC proofs for missing TLDsLennart Poettering
For the wildcard NSEC check we need to generate an "asterisk" domain, by prepend the common ancestor with "*.". So far we did that with a simple strappenda() which is fine for most domains, but doesn't work if the common ancestor is the root domain as we usually write that as "." in normalized form, and "*." joined with "." is "*.." and not "*." as it should be. Hence, use the clean way out, let's just use dns_name_concat() which only exists precisely for this reason, to properly concatenate labels. There's a good chance this actually fixes #5029, as this NSEC proof is triggered by lookups in the TLD "example", which doesn't exist in the Internet.
2017-02-17resolved: make sure configured NTAs affect subdomains tooLennart Poettering
This ensures that configured NTAs exclude not only the listed domain but also all domains below it from DNSSEC validation -- except if a positive trust anchor is defined below (as suggested by RFC7647, section 1.1) Fixes: #5048
2017-02-17resolved: default to the compile-time fallback hostnameLennart Poettering
This changes resolved to use the compile-time fallback hostname the configured one is not set. Note that if the local hostname is set to "localhost" then we'll instead default to "linux" here, as for mDNS/LLMNR exposing "localhost" is actively dangerous.
2017-02-16test: drop TEST_DATA_DIR, fold into get_testdata_dir()Martin Pitt
Drop the TEST_DATA_DIR macro as this was using alloca() within a function call which is allegedly unsafe. So add a "suffix" argument to get_testdata_dir() instead and call that directly.
2017-02-15tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_IDZbigniew Jędrzejewski-Szmek
Embedding sd_id128_t's in constant strings was rather cumbersome. We had SD_ID128_CONST_STR which returned a const char[], but it had two problems: - it wasn't possible to statically concatanate this array with a normal string - gcc wasn't really able to optimize this, and generated code to perform the "conversion" at runtime. Because of this, even our own code in coredumpctl wasn't using SD_ID128_CONST_STR. Add a new macro to generate a constant string: SD_ID128_MAKE_STR. It is not as elegant as SD_ID128_CONST_STR, because it requires a repetition of the numbers, but in practice it is more convenient to use, and allows gcc to generate smarter code: $ size .libs/systemd{,-logind,-journald}{.old,} text data bss dec hex filename 1265204 149564 4808 1419576 15a938 .libs/systemd.old 1260268 149564 4808 1414640 1595f0 .libs/systemd 246805 13852 209 260866 3fb02 .libs/systemd-logind.old 240973 13852 209 255034 3e43a .libs/systemd-logind 146839 4984 34 151857 25131 .libs/systemd-journald.old 146391 4984 34 151409 24f71 .libs/systemd-journald It is also much easier to check if a certain binary uses a certain MESSAGE_ID: $ strings .libs/systemd.old|grep MESSAGE_ID MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x $ strings .libs/systemd|grep MESSAGE_ID MESSAGE_ID=c7a787079b354eaaa9e77b371893cd27 MESSAGE_ID=b07a249cd024414a82dd00cd181378ff MESSAGE_ID=641257651c1b4ec9a8624d7a40a9e1e7 MESSAGE_ID=de5b426a63be47a7b6ac3eaac82e2f6f MESSAGE_ID=d34d037fff1847e6ae669a370e694725 MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5 MESSAGE_ID=1dee0369c7fc4736b7099b38ecb46ee7 MESSAGE_ID=39f53479d3a045ac8e11786248231fbf MESSAGE_ID=be02cf6855d2428ba40df7e9d022f03d MESSAGE_ID=7b05ebc668384222baa8881179cfda54 MESSAGE_ID=9d1aaa27d60140bd96365438aad20286
2017-02-14Merge pull request #5335 from poettering/resolved-some-fixesLennart Poettering
some post-mdns fixes for resolved
2017-02-14resolved: restore ANY reply behaviour for mDNSLennart Poettering
This restores behaviour of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2: for mDNS (and mDNS only) we'll match replies to transactions honouring ANY matches.
2017-02-14resolved: size the mdns announce answer array properlyLennart Poettering
The array doesn't grow dynamically, hence pick the right size at the moment of allocation. Let's simply multiply the number of addresses of this link by 2, as that's how many RRs we maintain for it.
2017-02-13test: make unit tests relocatableMartin Pitt
It is useful to package test-* binaries and run them as root under autopkgtest or manually on particular machines. They currently have a built-in hardcoded absolute path to their test data, which does not work when running the test programs from any other path than the original build directory. By default, make the tests look for their data in <test_exe_directory>/testdata/ so that they can be called from any directory (provided that the corresponding test data is installed correctly). As we don't have a fixed static path in the build tree (as build and source tree are independent), set $TEST_DIR with "make check" to point to <srcdir>/test/, as we previously did with an automake variable.
2017-02-13test: move resolved test data into test/Martin Pitt
Moe test-resolve's test data from src/resolve/test-data to test/test-resolve/ to be consistent with test/test-{execute,path}/. This will make it easier to make the tests relocatable.
2017-02-13resolved: name announce timer event sourceLennart Poettering
2017-02-13resolved: let's propagate errors from dns_scope_announce() and elsewhereLennart Poettering
We don't actually make use of the return value for now, but it matches our coding style elsewhere, and it actually shortens our code quite a bit. Also, add a missing OOM check after dns_answer_new().
2017-02-13resolved: count the number of addresses per linkLennart Poettering
This becomes handy later on. Moreover, we keep track of similar counters for other objects like this too, hence adding this here too is obvious.
2017-02-13resolved: don't return ANY transactions when looking for transactionsLennart Poettering
This reverts a part of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2: On classic DNS and LLMNR ANY requests may be replied to with any kind of RR, and the reply does not have to be comprehensive: these protocols simply define that if there's an RRset that can answer the question, then at least one should be sent as reply, but not necessarily all. This means it's not safe to "merge" transactions for arbitrary RR types into ANY requests, as the reply might not answer the specific question. As the merging is primarily an optimization, let's undo this for now. This logic may be readded later, in a way that only applies to mDNS. Also, there's an OOM problem with this chunk: dns_resource_key_new() might fail due to OOM and this is not handled. (This is easily removed though, by using DNS_RESOURCE_KEY_CONST()).
2017-02-12Merge pull request #4832 from rojkov/mdnsZbigniew Jędrzejewski-Szmek
2017-02-09resolved: if strict DNSSEC mode is selected never downgrade below DNSSEC ↵Lennart Poettering
server feature level due to packet loss Fixes: #4315
2017-02-09resolved: also synthesize records for the full local hostnameLennart Poettering
Previously, we'd only synthesize RRs for the LLMNR and mDNS versions of the hostnames (i.e. the first label of the kernel hostname, as well as the first label of the kernel hostname suffixed with .local). With this change, we also synthesize an RR for the full hostname, which is relevant in case it has more than one label. Fixes: #5041
2017-02-09resolved: when a server response with REFUSED, try a different oneLennart Poettering
Fixes: #4264
2017-02-09resolved: when following a CNAME initialize authenticated bit by the weakest ↵Lennart Poettering
answer When following a CNAME chain, don't set the authenticated bit, unless all lookups in the chain could be authenticated.
2017-02-09resolved: follow CNAMES for DNS stub repliesLennart Poettering
Clients expect us to follow CNAMEs for them, hence do so. On the first iteration start putting together a packet, and then keep adding data we acquire through CNAMEs to it, until we finally send it off. Fixes: #3826
2017-02-09tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering
And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
2017-02-05resolved: downgrade "processing query..." message to debug (#5233)Felipe Sateler
It doesn't really add much value in normal operation and just spams the log.
2017-02-02fs-util: unify code we use to check if dirent's d_name is "." or ".."Lennart Poettering
We use different idioms at different places. Let's replace this is the one true new idiom, that is even a bit faster...
2017-01-24resolve: fix strv memleakZbigniew Jędrzejewski-Szmek
sd_bus_message_read_strv() returns a normal strv...
2017-01-19resolve: Add support for mDNS to systemd-resolve utilityDmitry Rozhkov
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2017-01-19resolved: actually enable mDNS supportDmitry Rozhkov
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2017-01-19resolved: implement sending goodbye mDNS packetDmitry Rozhkov
resolved: remove unneeded braces Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2017-01-19resolved: add cache-flush bit to answers in mDNS announcementsDmitry Rozhkov
See the section 10.2 of RFC6762 for details. Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2017-01-19resolved: implement mDNS probing and announcementDmitry Rozhkov
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>