Commit graph

719 commits

Author SHA1 Message Date
Lennart Poettering 3347dd5ea1 resolved: fix rcode formatting string length
Since we honour the edns rcode extension we need more than 4 bits to format it. To avoid further confusion, derive the
right length from the type.
2016-01-25 17:19:19 +01:00
Lennart Poettering 7405bb3ec0 resolve: fix wording in resolver statistics output
Now that we count both negative and positive validation results, we shouldn't claim we just counted RRsets.
2016-01-25 17:19:19 +01:00
Lennart Poettering 59c5b5974d resolved: log each time we increase the DNSSEC verdict counters
Also, don't consider RRs that aren't primary to the lookups we do as relevant to the lookups.
2016-01-25 17:19:19 +01:00
Lennart Poettering f6618dcd96 resolved: never store NSEC/NSEC3 RRs from the upper zone of a zone cut in cache
When using NSEC/NSEC3 RRs from the cache to derive existance of arbitrary RRs, we should not get confused by the fact
that NSEC/NSEC3 RRs exist twice at zone cuts: once in the parent zone, and once in the child zone. For most RR types we
should only consult the latter since that's where the beef is. However, for DS lookups we have to check the former.

This change makes sure we never cache NSEC/NSEC3 RRs from any parent zone of a zone-cut. It also makes sure that when
we look for a DS RR in the cache we never consider any cached NSEC RR, as those are now always from the child zone.
2016-01-25 17:19:19 +01:00
Lennart Poettering fcfaff1235 resolved: if we detect a message with incomplete DNSSEC data, consider this an invalid packet event 2016-01-25 17:19:19 +01:00
Lennart Poettering 7aa8ce9855 resolved: also collect statistics about negative DNSSEC proofs
We already maintain statistics about positive DNSSEC proofs, and count them up by 1 for each validated RRset. Now,
update the same counters each time we validated a negative query, so that the statistics are the combined result of all
validation checks, both positive and negative.
2016-01-25 17:19:19 +01:00
Lennart Poettering 352af30838 resolve: use different bitmap checking rules when we find an exact NSEC3 match, or just a covering enclosure
If we are looking for a DS RR we need to check the NSEC3 bitmap of the parent zone's NSEC3 RR, not the one from the
child. For any other RR we need to look at the child's however, hence enforce this with the bitmaps.

Note that not coverign checks only the lower zone's NSEC3 bitmaps matter, hence the existing check is fine.
2016-01-25 17:19:18 +01:00
Lennart Poettering 300a716dc4 resolve: minor strings improvements 2016-01-25 17:19:18 +01:00
Lennart Poettering b5eb973b39 resolve: rename "systemd-resolve-host" tool to simply "systemd-resolve"
The tool resolves way more than just hosts, hence give it a more generic name. This should be safe, as the tool is
currently undocumented. Before we add documentation for it, let's get the name right.

This also moves the C source into src/resolve/ (from src/resolve-host/), since the old name is a misnomer now. Also,
since it links directly to many of the C files of resolved it really belongs into resolved's directory anyway.
2016-01-25 16:00:28 +01:00
Lennart Poettering ce736ace37 resolved: get rid of unnecessary if check
DNS_ANSWER_FOREACH() can deal with NULL answers anyway, let's simplify our code here.
2016-01-25 15:59:40 +01:00
Lennart Poettering 839a4a20d8 resolved: split out RR synthesis logic into its own C file
Also, while we are at it, set the "authenticated" bit for everything we synthesize
2016-01-25 15:59:40 +01:00
Lennart Poettering d07b43a18e resolved: move dns_type_to_af() to dns-type.c 2016-01-25 15:59:40 +01:00
Lennart Poettering edbcc1fdd9 resolve: generate a nice clean error when clients try to resolve a name when the network is down 2016-01-25 15:59:40 +01:00
Lennart Poettering 6955a3ba9d resolved: when checking whether a link is relevant, check kernel operstate
This mimics what networkd is doing to detect a carrier.
2016-01-25 15:59:40 +01:00
Lennart Poettering 55abd6dadd resolved: fix typo
Noticed by @vcaputo
2016-01-25 15:59:39 +01:00
Lennart Poettering ebc8a1066a resolved: fix RR key reduction logic
Fixes #2380.
2016-01-25 15:59:39 +01:00
Lennart Poettering c69fa7e3c4 resolved: rework DNSSECSupported property
Not only report whether the server actually supports DNSSEC, but also first check whether DNSSEC is actually enabled
for it in our local configuration.

Also, export a per-link DNSSECSupported property in addition to the existing manager-wide property.
2016-01-19 21:56:54 +01:00
Lennart Poettering d2ec6608b9 resolved: add SetLinkXYZ() method counterparts on the Link object
So far, we exposed SetLinkXYZ() on the Manager interface, to set a couple of link properties. This adds similar calls
SetXYZ() on the Link interface, and makes sure the former is little more than a shortcut to the latter.

SetLinkXYZ() has the benefit of not requiring a GetLink() round trip for setting these properties, while the method
actually belongs to the Link objects, and this change corrects that.
2016-01-19 21:56:54 +01:00
Lennart Poettering 3abaabdab7 resolved: expose bus objects for each Link
The link objects expose as properties the current settings made with SetLinkDNS() and related calls, plus some more
information.
2016-01-19 21:56:54 +01:00
Lennart Poettering e40f0647b4 resolved: rename a few props to closer match ther counterparts in the various configuration files 2016-01-19 18:37:45 +01:00
Lennart Poettering 97e5d693c0 resolved: add bus API for configuring per-link DNS settings
This is useful for alternative network management solutions (such as NetworkManager) to push DNS configuration data
into resolved.

The calls will fail should networkd already have taken possesion of a link, so that the bus API is only available if
we don't get the data from networkd.
2016-01-19 18:37:45 +01:00
Lennart Poettering dfc1091b2f resolved: allocate DNS scope for links only if the interface is up
For mDNS and LLMNR we already created the scopes only if the specific interfaces where actually up and suitable for
Multicasting. Add a similar (but weaker) logic for unicast DNS as well.
2016-01-19 18:37:45 +01:00
Lennart Poettering 593f665cd5 resolve-host: show whether DNSSEC is supported or not in --statistics output
This should be generally useful information, hence show it.
2016-01-19 18:37:45 +01:00
Lennart Poettering d555eb990b Merge pull request #2369 from zonque/resolved
resolved: hide public mDNS configuration knobs for now
2016-01-19 15:11:10 +01:00
Lennart Poettering 5f0f8d749d Merge pull request #2357 from keszybz/warnings-2
Remove gcc warnings v2
2016-01-19 15:09:53 +01:00
Daniel Mack 60402bdc52 resolved: remove configuration knobs for mDNS until it's ready
These bits were intenionally left out while mDNS is under development.

Remove the exposed knobs and man page entries again until this is settled.
2016-01-19 14:11:05 +01:00
Daniel Mack b6c5d46b23 resolved: fix mDNS IPv6 multicast address
Fixes #2366
2016-01-19 14:11:05 +01:00
Lennart Poettering cc450722a0 resolved: don't forget about lost OPT and RRSIG when downgrading a feature level
Certain Belkin routers appear to implement a broken DNS cache for A RRs and some others, but implement a pass-thru for
AAAA RRs. This has the effect that we quickly recognize the broken logic of the router when we do an A lookup, but for
AAAA everything works fine until we actually try to validate the request. Given that the validation will necessarily
fail ultimately let's make sure we remember even when downgrading a feature level that OPT or RRSIG was missing.
2016-01-19 00:51:26 +01:00
Lennart Poettering f009fda92c update DNSSEC TODO 2016-01-18 23:31:29 +01:00
Lennart Poettering e09f605eec resolved: don't try to print error strings, where errno isn't set 2016-01-18 23:31:29 +01:00
Lennart Poettering 4dd15077f3 resolved: when restarting a transaction pick a new ID
When we restart a transaction because of an incompatible server, pick a new transaction ID.

This should increase compatibility with DNS servers that don't like if they get different requests with the same
transaction ID.
2016-01-18 23:31:29 +01:00
Lennart Poettering b214dc0f68 resolved: enforce maximum limit on DNS transactions
given that DNSSEC lookups may result in quite a number of auxiliary transactions, let's better be safe than sorry and
also enforce a limit on the number of total transactions, not just on the number of queries.
2016-01-18 23:31:29 +01:00
Lennart Poettering 8f4560c7b9 resolved: add DNAME test case to the complex DNSSEC test 2016-01-18 23:31:16 +01:00
Lennart Poettering 942eb2e71b resolved: fix how we detect whether auxiliary DNSSEC transactions are ready
Previously, when getting notified about a completed auxiliary DNSSEC transaction we'd immediately act on it, and
possibly abort the main transaction. This is problematic, as DNS transactions that already completed at the time we
started using them will never get the notification event, and hence never be acted on in the same way.

Hence, introduce a new call dns_transaction_dnssec_ready() that checks the state of auxiliary DNSSEC transactions, and
returns 1 when we are ready for the actual DNSSEC validation step. Then, make sure this is invoked when the auxiliary
transactions are first acquired (and thus possibly reused) as well when the notifications explained above take place.

This fixes problems particularly when doing combined A and AAAA lookups  where the auxiliary DNSSEC transactions get
reused between them, and where we got confused if we reused an auxiliary DNSSEC transaction from one when it already
got completed from the other.
2016-01-18 23:31:16 +01:00
Lennart Poettering 8ec76e6af5 resolved: end log messages in a full stop 2016-01-18 23:31:16 +01:00
Lennart Poettering 542e0c84d1 resolved: never consider following a CNAME/DNAME chain for a CNAME/DNAME lookup
Let's avoid thinking that a CNAME/DNAME chain traversal could be a good idea if QTYPE is already CNAME/DNAME.

(Also, let's bail out early when trying to see if some RR is a suitable CNAME/DNAME for some other RR).
2016-01-18 23:31:16 +01:00
Lennart Poettering 59a899908f resolved: when following a CNAME, turn off search domains
If the first step was done via a search domain, make sure the subsequent steps are not.
2016-01-18 23:31:16 +01:00
Lennart Poettering 7820b320ea resolved: properly reset old collected data when following a CNAME redirect 2016-01-18 23:31:16 +01:00
Lennart Poettering 12634bb4a9 resolved: beef up complex dnssec test to also use ResolveAddress() and do IDNA checks 2016-01-18 23:31:16 +01:00
Lennart Poettering 23b298bce7 resolved: rework IDNA logic
Move IDNA logic out of the normal domain name processing, and into the bus frontend calls. Previously whenever
comparing two domain names we'd implicitly do IDNA conversion so that "pöttering.de" and "xn--pttering-n4a.de" would be
considered equal. This is problematic not only for DNSSEC, but actually also against he IDNA specs.

Moreover it creates problems when encoding DNS-SD services in classic DNS. There, the specification suggests using
UTF8 encoding for the actual service name, but apply IDNA encoding to the domain suffix.

With this change IDNA conversion is done only:

- When the user passes a non-ASCII hostname when resolving a host name using ResolveHostname()
- When the user passes a non-ASCII domain suffix when resolving a service using ResolveService()

No IDNA encoding is done anymore:

- When the user does raw ResolveRecord() RR resolving
- On the service part of a DNS-SD service name

Previously, IDNA encoding was done when serializing names into packets, at a point where information whether something
is a label that needs IDNA encoding or not was not available, but at a point whether it was known whether to generate a
classic DNS packet (where IDNA applies), or an mDNS/LLMNR packet (where IDNA does not apply, and UTF8 is used instead
for all host names). With this change each DnsQuery object will now maintain two copies of the DnsQuestion to ask: one
encoded in IDNA for use with classic DNS, and one encoded in UTF8 for use with LLMNR and MulticastDNS.
2016-01-18 23:31:16 +01:00
Lennart Poettering b6800689e0 resolved: minor optimization for dns_question_is_equal()
If the poinetrs are equal, we don't have to do a deep comparison.

This is similar to a similar optimization we already have in place for RRs and keys.
2016-01-18 23:31:16 +01:00
Lennart Poettering 0f7091e624 resolved: be slightly stricter when validating DnsQuestion
Also verify whether the DNS RR types are actually suitable for a question.
2016-01-18 23:31:16 +01:00
Lennart Poettering 6a21960c0b resolved: make key argument of dns_question_contains() const 2016-01-18 23:31:16 +01:00
Zbigniew Jędrzejewski-Szmek 555f5cdc2d resolve: fix return value from dns_packet_append_rr() 2016-01-18 15:21:28 -05:00
Lennart Poettering bc7669cff9 resolved: fix logging about DNAME redirection 2016-01-17 21:53:16 +01:00
Lennart Poettering 43e6779ac2 resolved: when we find a DNAME RR, don't insist in a signed CNAME RR
If we have a signed DNAME RR response, there's no need to insist on a signature for a CNAME RR response, after all it
is unlikely to be signed, given the implicit synthethis of CNAME through DNAME RRs.
2016-01-17 21:50:10 +01:00
Lennart Poettering c15493f482 resolved: update DNSSEC TODO 2016-01-17 20:47:46 +01:00
Lennart Poettering f57e3cd5fa resolved: try to reduce number or DnsResourceKeys we keep around by merging them
Quite often we read the same RR key multiple times from the same message. Try to replace them by a single object when
we notice this. Do so again when we add things to the cache.

This should reduce memory consumption a tiny bit.
2016-01-17 20:47:46 +01:00
Lennart Poettering 2e1bab34bd resolved: when switching between DNSSEC modes, possibly flush caches
If the networkd configuration changes during runtime, make sure to flush all caches when we switch from a less trusted
to a more trusted mode.
2016-01-17 20:47:46 +01:00
Lennart Poettering c02cf2f41f resolved: when the server feature level changes between query and response restart transaction
In some cases we learn something about a server's feature level through its responses. If we notice that after doing
basic checking of a response, and after collecting all auxiliary DNSSEC info the feature level of the server is lower
than where we started, restart the whole transaction.

This is useful to deal with servers that response rubbish when talked to with too high feature levels.
2016-01-17 20:47:46 +01:00