Commit Graph

23887 Commits

Author SHA1 Message Date
Lennart Poettering b43d75c378 importd: drop dkr support
The current code is not compatible with current dkr protocols anyway,
and dkr has a different focus ("microservices") than nspawn anyway
("whole machine containers"), hence drop support for it, we cannot
reasonably keep this up to date, and it creates the impression we'd
actually care for the microservices usecase.
2015-12-10 16:54:41 +01:00
Lennart Poettering 4d3f0f66e6 Merge pull request #2135 from zonque/resolved-mdns-3
resolved: more mDNS specific bits (3)
2015-12-10 16:49:31 +01:00
Daniel Mack fe2dfc8b49 resolved: make sure the packet's transaction ID is always 0 for mDNS
RFC6762, 18.1:

   In multicast query messages, the Query Identifier SHOULD be set to
   zero on transmission.
2015-12-10 16:32:03 +01:00
Daniel Mack 40fa4728eb resolved: discard any reply packet that contains a bogus name
Only .in-addr.arpa and .local are considered local in mDNS, so discard the
packet if anything else is thrown at us.
2015-12-10 16:32:02 +01:00
Tom Gundersen 553947b77c Merge pull request #2129 from poettering/dnssec3
Third DNSSEC patch series
2015-12-10 15:22:18 +01:00
Lennart Poettering 312501458d Merge pull request #2086 from evverx/fix-journal-upload-installation
build: fix systemd-journal-upload installation
2015-12-10 12:05:26 +01:00
Lennart Poettering ada64a0cff README: Recommend kinvolk regarding engineering services
They are our friends, do systemd development, hence add them.
2015-12-10 11:57:08 +01:00
Lennart Poettering e93af635c7 Merge pull request #2076 from keszybz/downgrade-masked-unit-message
core: do not warn about Wants depencencies on masked units
2015-12-10 11:40:23 +01:00
Lennart Poettering c842ff2488 resolved: rename dns_transaction_prepare_next_attempt()
Let's simply call it dns_transaction_prepare(), so that we have the nice
cycle for prepare() → go() → emit() → process().

After all it's pretty clear that what we prepare there, and we dont call
the others go_next_attempt(), emit_next_attempt() or
process_next_attempt().
2015-12-10 11:35:52 +01:00
Lennart Poettering f649045c10 journal: make mmap_cache_unref() a NOP when NULL is passed, like all other destructors 2015-12-10 11:35:52 +01:00
Lennart Poettering 9eae2bf318 resolved: don't accept doing queries for invalid RR types 2015-12-10 11:35:52 +01:00
Lennart Poettering 547973dea7 resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.

With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:

1) Because a user asked for something to be resolved, i.e. requested by
   a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
   validation of its own response.

DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.

To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.

A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.

This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.

Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.

The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-10 11:35:52 +01:00
Lennart Poettering aa89931749 resolved: when matching up DNSKEY and DS RRs, it's fine if we don't support the DNSKEY's algorithm
As long as we support the digest we are good.
2015-12-10 11:35:52 +01:00
Lennart Poettering 15accc2765 resolved: when matching up RRSIG and DNSKEY RRs, use the RRSIG's signer name, not the owner name
When the DNSKEY is in higher zone, then that's OK, and we need to check
the RRSIG's signer name against the DNSKEY hence.
2015-12-10 11:35:52 +01:00
Lennart Poettering 6c5e8fbf4e resolved: fix sorting of RRsets
We actually maintain an array of pointers to RRs, not of RRs themselves,
fix the qsort() invocation accordingly.
2015-12-10 11:35:52 +01:00
Lennart Poettering 2f763887b8 resolved: grow DnsAnswer exponentially
When increasing the DnsAnswer array, don't operate piecemeal, grow the
array exponentially.

This way, the default logic for DnsAnswer allocations matches the
behaviour for GREEDY_REALLOC and suchlike, and we can reduce the number
of necessary allocations.
2015-12-10 11:35:52 +01:00
Lennart Poettering 48d5616b92 resolved: log when we chase a CNAME RR 2015-12-10 11:35:52 +01:00
Lennart Poettering b5efcf29d2 resolved: reenable caching for LLMNR
This got borked in 547493c5ad.
2015-12-10 11:35:52 +01:00
Lennart Poettering 8af5b88322 resolved: split out check whether reply matches our question
It's complicated enough, it deserves its own call.

(Also contains some unrelated whitespace, comment and assertion changes)
2015-12-10 11:35:52 +01:00
Lennart Poettering 8b5b564947 resolved: IXFR and AXFR cannot be the type of RRs, only of RR keys
Enforce this while parsing RRs.
2015-12-10 11:35:52 +01:00
Lennart Poettering d75acfb059 resolved: when parsing DNS packets, handle OPT RR specially
As soon as we encounter the OPT RR while parsing, store it in a special
field in the DnsPacket structure. That way, we won't be confused if we
iterate through RRs, and can check that there's really only one of these
RRs around.
2015-12-10 11:35:52 +01:00
Lennart Poettering c296dd2eea resolved: refuse modifying DnsAnswer objects that have more than one reference
DnsAnswer objects should be considered immutable after having passed to
more than one user, i.e. with a reference counter > 1. Enforce that in
code, so that we can track down misuses easier.
2015-12-10 11:28:02 +01:00
Lennart Poettering d12bf2bdff resolved: fix libgcrypt error checking
libgcrypt encodes the error source in the error code, we need to mask
that away before comparing error codes.
2015-12-10 11:28:02 +01:00
Lennart Poettering d28ac939c1 build-sys: libgcrypt error messages make no sense without libgpg-error
Hence, pull in this library too, if we need libgcrypt.
2015-12-10 11:28:02 +01:00
Lennart Poettering d42800f18e resolved: split out logic to flush DnsAnswer objects
Let's simplify things, by making this a function call of its own.
2015-12-10 11:28:02 +01:00
Lennart Poettering 7bcffc2efa resolved: honour RFC6761's ban on the invalid TLD 2015-12-10 11:28:02 +01:00
Lennart Poettering aa44ee274c resolved: fix DNS_ANSWER_FOREACH_IFINDEX() to not collide with user defined ifindex variable 2015-12-10 11:28:02 +01:00
Lennart Poettering 0bb4749d1f resolved: partially revert 5eefe54
Quoting @teg:

"Contrary to what the comment said, we always verify redirect chains in
full, and cache all the CNAME records. There is therefore no need to
do extra negative caching along a CNAME chain."

This simply steals @teg's commit since we'll touch the SOA matching case
in a later patch, and rather want this bit gone, so that we don't have
to "fix" it, only to remove it later on.
2015-12-10 11:28:01 +01:00
Lennart Poettering c52a97b896 resolved: when outputting RRs in text form, append a trailing dot to owner names
After all, that's how this is done in DNS, and is particularly important
if we look a DS/DNSKEY RRs for the root zone itself, where the owner
name would otherwise be shown as completely empty (i.e. missing).
2015-12-10 11:28:01 +01:00
Lennart Poettering 4d247a6cd3 resolved: shortcut RR comparisons if pointers match
When iterating through RR lists we frequently end up comparing RRs and
RR keys with themselves, hence att a minor optimization to check ptr
values first, before doing a deep comparison.
2015-12-10 11:28:01 +01:00
Lennart Poettering c84e853934 resolved: fix parameter type of dns_type_is_pseudo()
DNS RR types are uint16_t after all, treat them as such.
2015-12-10 11:28:01 +01:00
Lennart Poettering e4b0e86225 Merge pull request #2056 from evverx/expose-soft-limits-on-the-bus
Expose soft limits on the bus
2015-12-10 11:20:03 +01:00
Lennart Poettering 59c74f2175 Merge pull request #2128 from zonque/resolved-mdns-2
resolved: more mDNS specific bits (2)
2015-12-10 11:10:30 +01:00
Daniel Mack 261f3673c1 resolved: add more linked packets for overlong known answers
For mDNS, if we're unable to stuff all known answers into the given packet,
allocate a new one, push the RR into that one and link it to the current
one.
2015-12-10 10:21:50 +01:00
Daniel Mack 80a62095dc resolved: handle linked packet in dns_scope_emit()
In dns_scope_emit(), walk the list of additional packets and emit all of
them. Set the TC bit in all but the last of them.

This is specific to mDNS, so an assertion is triggered if used with other
protocols.
2015-12-10 10:20:55 +01:00
Daniel Mack 9c49156383 resolved: add support for linked packets
For mDNS, we need to support the TC bit in case the list of known answers
exceed the maximum packet size.

For this, add a 'more' pointer to DnsPacket for an additional packet.

When a packet is unref'ed, the ->more packet is also unrefed, so it
sufficient to only keep track of the 1st packet in a chain.
2015-12-10 10:20:54 +01:00
Daniel Mack dbfbb6e776 resolved: add dns_packet_set_flags()
We need to support the TC bit in queries in case known answers exceed the
maximum packet size. Factor out the flags compilation to
dns_packet_set_flags() and make it externally available.
2015-12-10 10:20:23 +01:00
Lennart Poettering 2b48c44bc4 Merge pull request #2108 from evverx/fix-distcheck-for-disable-resolved
build-sys: move "dist" parts out of conditionals
2015-12-09 20:48:40 +01:00
Daniel Mack ee8d930568 resolved: llmnr, mdns: simplify error handling
sd_event_add_io() returns the error directly and does not mess with errno.
2015-12-09 18:49:15 +01:00
Daniel Mack b43d96b076 resolved: don't send .local requests to DNS servers
DNS names ending with .local are specific to mDNS, so don't use them
on DNS scopes.
2015-12-09 18:49:14 +01:00
Daniel Mack 0896271419 Merge pull request #2110 from keszybz/udev-indentation
Udev indentation
2015-12-09 14:18:37 +01:00
Evgeny Vereshchagin e400d4b3f5 build: fix systemd-journal-upload installation
Fixes:

$ ./configure ... --disable-microhttpd --enable-libcurl
--enable-sysusers
$ make && make install DESTDIR=$(pwd)/INST
$ ls INST/usr/lib/sysusers.d/
basic.conf  systemd.conf

There is no a file with `systemd-journald-upload`
2015-12-09 03:48:56 +00:00
Evgeny Vereshchagin 955c5010c1 build-sys: move "dist" parts out of conditionals
This is a follow-up for commit f47477332f
2015-12-08 21:39:42 +00:00
Tom Gundersen 319c29920c Merge pull request #2115 from dvdhrm/rbtree
basic: add RB-Tree implementation
2015-12-08 17:31:09 +01:00
Tom Gundersen 73f72c6108 Merge pull request #2122 from zonque/resolved-mdns-1
resolved: more mDNS specific bits
2015-12-08 17:24:09 +01:00
Daniel Mack 7778dffff3 resolved: add dns_cache_export_to_packet()
This new functions exports cached records of type PTR, SRV and TXT into
an existing DnsPacket. This is used in order to fill in known records
to mDNS queries, for known answer supression.
2015-12-08 16:51:41 +01:00
Daniel Mack 0afa57e2e7 resolved: implement query coalescing
Implement dns_transaction_make_packet_mdns(), a special version of
dns_transaction_make_packet() for mDNS which differs in many ways:

a) We coalesce queries of currently active transaction on the scope.
   This is possible because mDNS actually allows many questions in a
   to be sent in a single packet and it takes some burden from the
   network.

b) Both A and AAAA query keys are broadcast on both IPv4 and IPv6
   scopes, because other hosts might only respond on one of their
   addresses but resolve both types.

c) We discard previously sent packages (t->sent) so we can start over
   and coalesce pending transactions again.
2015-12-08 16:51:41 +01:00
Daniel Mack a9da14e1e9 resolved: add 'next_attempt_after' field to DnsTransaction
For each transaction, record when the earliest point in time when the
query packet may hit the wire. This is the same time stamp for which
the timer is scheduled in retries, except for the initial query packets
which are delayed by a random jitter. In this case, we denote that the
packet may actually be sent at the nominal time, without the jitter.

Transactions that share the same timestamp will also have identical
values in this field. It is used to coalesce pending queries in a later
patch.
2015-12-08 16:51:41 +01:00
Daniel Mack 1effe96568 resolved: split dns_transaction_go()
Split some code out of dns_transaction_go() so we can re-use it later from
different context. The new function dns_transaction_prepare_next_attempt()
takes care of preparing everything so that a new packet can conditionally
be formulated for a transaction.

This patch shouldn't cause any functional change.
2015-12-08 16:51:41 +01:00
Daniel Mack 547493c5ad resolved: handle more mDNS protocol details 2015-12-08 16:51:41 +01:00