Lennart Poettering [Wed, 9 Dec 2015 17:07:55 +0000 (18:07 +0100)]
resolved: fix sorting of RRsets
We actually maintain an array of pointers to RRs, not of RRs themselves,
fix the qsort() invocation accordingly.
Lennart Poettering [Wed, 9 Dec 2015 17:05:53 +0000 (18:05 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 17:04:03 +0000 (18:04 +0100)]
resolved: log when we chase a CNAME RR
Lennart Poettering [Wed, 9 Dec 2015 17:00:58 +0000 (18:00 +0100)]
resolved: reenable caching for LLMNR
This got borked in
547493c5ad5c82032e247609970f96be76c2d661.
Lennart Poettering [Wed, 9 Dec 2015 16:49:05 +0000 (17:49 +0100)]
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)
Lennart Poettering [Wed, 9 Dec 2015 16:45:00 +0000 (17:45 +0100)]
resolved: IXFR and AXFR cannot be the type of RRs, only of RR keys
Enforce this while parsing RRs.
Lennart Poettering [Wed, 9 Dec 2015 16:43:24 +0000 (17:43 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 16:41:33 +0000 (17:41 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 16:40:32 +0000 (17:40 +0100)]
resolved: fix libgcrypt error checking
libgcrypt encodes the error source in the error code, we need to mask
that away before comparing error codes.
Lennart Poettering [Wed, 9 Dec 2015 18:01:26 +0000 (19:01 +0100)]
build-sys: libgcrypt error messages make no sense without libgpg-error
Hence, pull in this library too, if we need libgcrypt.
Lennart Poettering [Wed, 9 Dec 2015 16:38:48 +0000 (17:38 +0100)]
resolved: split out logic to flush DnsAnswer objects
Let's simplify things, by making this a function call of its own.
Lennart Poettering [Wed, 9 Dec 2015 16:38:05 +0000 (17:38 +0100)]
resolved: honour RFC6761's ban on the invalid TLD
Lennart Poettering [Wed, 9 Dec 2015 16:34:55 +0000 (17:34 +0100)]
resolved: fix DNS_ANSWER_FOREACH_IFINDEX() to not collide with user defined ifindex variable
Lennart Poettering [Wed, 9 Dec 2015 16:32:47 +0000 (17:32 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 16:29:53 +0000 (17:29 +0100)]
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).
Lennart Poettering [Wed, 9 Dec 2015 16:28:50 +0000 (17:28 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 16:27:35 +0000 (17:27 +0100)]
resolved: fix parameter type of dns_type_is_pseudo()
DNS RR types are uint16_t after all, treat them as such.
Lennart Poettering [Thu, 10 Dec 2015 10:20:03 +0000 (11:20 +0100)]
Merge pull request #2056 from evverx/expose-soft-limits-on-the-bus
Expose soft limits on the bus
Lennart Poettering [Thu, 10 Dec 2015 10:10:30 +0000 (11:10 +0100)]
Merge pull request #2128 from zonque/resolved-mdns-2
resolved: more mDNS specific bits (2)
Daniel Mack [Wed, 9 Dec 2015 12:09:35 +0000 (13:09 +0100)]
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.
Daniel Mack [Wed, 9 Dec 2015 11:05:38 +0000 (12:05 +0100)]
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.
Daniel Mack [Wed, 9 Dec 2015 11:01:08 +0000 (12:01 +0100)]
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.
Daniel Mack [Wed, 9 Dec 2015 10:55:54 +0000 (11:55 +0100)]
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.
Lennart Poettering [Wed, 9 Dec 2015 19:48:40 +0000 (20:48 +0100)]
Merge pull request #2108 from evverx/fix-distcheck-for-disable-resolved
build-sys: move "dist" parts out of conditionals
Daniel Mack [Wed, 9 Dec 2015 09:24:27 +0000 (10:24 +0100)]
resolved: llmnr, mdns: simplify error handling
sd_event_add_io() returns the error directly and does not mess with errno.
Daniel Mack [Tue, 8 Dec 2015 17:29:52 +0000 (18:29 +0100)]
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.
Daniel Mack [Wed, 9 Dec 2015 13:18:37 +0000 (14:18 +0100)]
Merge pull request #2110 from keszybz/udev-indentation
Udev indentation
Evgeny Vereshchagin [Mon, 7 Dec 2015 04:31:34 +0000 (04:31 +0000)]
build-sys: move "dist" parts out of conditionals
This is a follow-up for commit
f47477332ff
Tom Gundersen [Tue, 8 Dec 2015 16:31:09 +0000 (17:31 +0100)]
Merge pull request #2115 from dvdhrm/rbtree
basic: add RB-Tree implementation
Tom Gundersen [Tue, 8 Dec 2015 16:24:09 +0000 (17:24 +0100)]
Merge pull request #2122 from zonque/resolved-mdns-1
resolved: more mDNS specific bits
Daniel Mack [Mon, 30 Nov 2015 23:53:42 +0000 (00:53 +0100)]
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.
Daniel Mack [Mon, 30 Nov 2015 11:47:11 +0000 (12:47 +0100)]
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.
Daniel Mack [Mon, 30 Nov 2015 21:35:51 +0000 (22:35 +0100)]
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.
Daniel Mack [Mon, 30 Nov 2015 18:06:36 +0000 (19:06 +0100)]
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.
Daniel Mack [Thu, 3 Sep 2015 10:09:11 +0000 (12:09 +0200)]
resolved: handle more mDNS protocol details
Daniel Mack [Thu, 3 Sep 2015 10:04:31 +0000 (12:04 +0200)]
resolved: fix debug message
Daniel Mack [Sat, 11 Jul 2015 00:44:59 +0000 (20:44 -0400)]
resolved: add mDNS packet dispatcher
Add the packet dispatching routine for mDNS.
It differs to what LLMNR and DNS dispatchers do in the way it matches
incoming packets. In mDNS, we actually handle all incoming packets,
regardless whether we asked for them earlier or not.
Daniel Mack [Tue, 1 Sep 2015 15:17:27 +0000 (17:17 +0200)]
resolved: allow name compression in NSEC records
Daniel Mack [Fri, 28 Aug 2015 14:48:37 +0000 (16:48 +0200)]
resolved: handle mDNS timeouts per transaction
mDNS packet timeouts need to be handled per transaction, not per link.
Re-use the n_attempts field for this purpose, as packets timeouts should be
determined by starting at 1 second, and doubling the value on each try.
Daniel Mack [Tue, 25 Aug 2015 15:57:58 +0000 (17:57 +0200)]
resolved: short-cut jitter callbacks for LLMNR and mDNS
When a jitter callback is issued instead of sending a DNS packet directly,
on_transaction_timeout() is invoked to 'retry' the transaction. However,
this function has side effects. For once, it increases the packet loss
counter on the scope, and it also unrefs/refs the server instances.
Fix this by tracking the jitter with two bool variables. One saying that
the initial jitter has been scheduled in the first place, and one that
tells us the delay packet has been sent.
Daniel Mack [Tue, 4 Aug 2015 12:12:46 +0000 (14:12 +0200)]
resolved: flush keys when DNS_RESOURCE_KEY_CACHE_FLUSH is set
In mDNS, DNS_RESOURCE_KEY_CACHE_FLUSH denotes whether other records with the
same key should be flushed from the cache.
Daniel Mack [Tue, 24 Nov 2015 14:45:15 +0000 (15:45 +0100)]
resolved: add cache flush flag to DnsResourceKey
MDNS has a 'key cache flush' flag for records which must be masked out for
the parsers to do our right thing. We will also use that flag later (in a
different patch) in order to alter the cache behavior.
Daniel Mack [Tue, 25 Aug 2015 12:08:29 +0000 (14:08 +0200)]
resolved: add mDNS initial jitter
The logic is to kick off mDNS packets in a delayed way is mostly identical
to what LLMNR needs, except that the constants are different.
Daniel Mack [Sat, 11 Jul 2015 17:17:51 +0000 (13:17 -0400)]
resolved: create dns scopes for mDNS
Follow what LLMNR does, and create per-link DnsScope objects.
Daniel Mack [Sat, 11 Jul 2015 18:33:58 +0000 (14:33 -0400)]
resolved: add code to join/leave mDNS multicast groups
Per link, join the mDNS multicast groups when the scope is created, and
leave it again when the scope goes away.
Daniel Mack [Sat, 11 Jul 2015 00:44:46 +0000 (20:44 -0400)]
resolved: add packet header details for mDNS
Validate mDNS queries and responses by looking at some header fields,
add mDNS flags.
Daniel Mack [Fri, 10 Jul 2015 19:48:13 +0000 (15:48 -0400)]
resolved: add infrastructure for mDNS related sockets
Just hook up mDNS listeners with an empty packet dispather function,
introduce a config directive, man page updates etc.
Zbigniew Jędrzejewski-Szmek [Tue, 8 Dec 2015 04:47:45 +0000 (23:47 -0500)]
Merge pull request #2104 from evverx/rlimit-util-test
tests: add test-rlimit-util
Zbigniew Jędrzejewski-Szmek [Tue, 8 Dec 2015 04:35:19 +0000 (23:35 -0500)]
Merge pull request #2117 from evverx/remove-dist-check-python
build-sys: remove dist-check-python
Evgeny Vereshchagin [Tue, 8 Dec 2015 02:33:52 +0000 (02:33 +0000)]
build-sys: remove dist-check-python
added:
279419b379
obsoleted:
2c8849add4
Filipe Brandenburger [Mon, 7 Dec 2015 21:53:02 +0000 (13:53 -0800)]
Merge pull request #2111 from evverx/remove-unnecessary-checking
build-sys: remove unnecessary check
David Herrmann [Mon, 7 Dec 2015 17:34:05 +0000 (18:34 +0100)]
basic: add RB-Tree implementation
This adds an self-standing RB-Tree implementation to src/basic/. This
will be needed for NSEC RR lookups, since we need "close lookups", which
hashmaps (not even ordered-hashmaps) can give us in reasonable time.
Martin Pitt [Mon, 7 Dec 2015 16:35:32 +0000 (17:35 +0100)]
Merge pull request #2109 from keszybz/udev-null-deref
Udev null deref
Evgeny Vereshchagin [Mon, 7 Dec 2015 09:43:43 +0000 (09:43 +0000)]
tests: disable hard errors
we don't use it
https://www.gnu.org/software/automake/manual/automake.html#Scripts_002dbased-Testsuites
Evgeny Vereshchagin [Sun, 6 Dec 2015 02:04:08 +0000 (02:04 +0000)]
tests: add test-rlimit-util
Evgeny Vereshchagin [Mon, 7 Dec 2015 07:02:37 +0000 (07:02 +0000)]
build-sys: remove unnecessary check
added:
65adc982d
obsoleted:
2c8849add
Zbigniew Jędrzejewski-Szmek [Mon, 7 Dec 2015 05:30:23 +0000 (00:30 -0500)]
udev/scsi_id: fix some strange indentation
Zbigniew Jędrzejewski-Szmek [Mon, 7 Dec 2015 05:29:53 +0000 (00:29 -0500)]
udev: add emacs header line
Otherwise emacs wants to use 2-space indentation and other
attrocities.
Zbigniew Jędrzejewski-Szmek [Mon, 7 Dec 2015 05:10:15 +0000 (00:10 -0500)]
udev: fix NULL deref when executing rules
We quite obviously check whether event->dev_db is nonnull, and
right after that call a function which asserts the same. Move
the call under the same if.
https://bugzilla.redhat.com/show_bug.cgi?id=1283971
Zbigniew Jędrzejewski-Szmek [Mon, 7 Dec 2015 05:09:12 +0000 (00:09 -0500)]
libudev: simplify udev_device_ensure_usec_initialized a bit
Lennart Poettering [Sun, 6 Dec 2015 19:58:11 +0000 (20:58 +0100)]
Merge pull request #2095 from evverx/fix-distcheck-for-disable-timesync
build-sys: move "dist" parts out of conditional
Lennart Poettering [Sun, 6 Dec 2015 19:57:33 +0000 (20:57 +0100)]
Merge pull request #2100 from msekletar/nologin-label
user-sessions: make sure /run/nologin has correct SELinux label
Lennart Poettering [Sun, 6 Dec 2015 19:49:12 +0000 (20:49 +0100)]
Merge pull request #2107 from phomes/misc
Misc cleanups
Lennart Poettering [Sun, 6 Dec 2015 19:48:02 +0000 (20:48 +0100)]
Merge pull request #2097 from kinvolk/alban/TasksMax
nspawn: set TasksMax in machined instead of nspawn
Thomas Hindoe Paaboel Andersen [Sun, 6 Dec 2015 11:31:18 +0000 (12:31 +0100)]
resolve: remove unused variable
Thomas Hindoe Paaboel Andersen [Thu, 3 Dec 2015 20:13:37 +0000 (21:13 +0100)]
shared: include what we use
The next step of a general cleanup of our includes. This one mostly
adds missing includes but there are a few removals as well.
Alban Crequy [Tue, 24 Nov 2015 17:14:01 +0000 (18:14 +0100)]
nspawn: set TasksMax in machined instead of nspawn
https://github.com/systemd/systemd/issues/2016
Michal Sekletar [Fri, 4 Dec 2015 21:29:38 +0000 (22:29 +0100)]
login: make sure /run/nologin has correct SELinux label
Michal Sekletar [Fri, 4 Dec 2015 20:33:42 +0000 (21:33 +0100)]
user-sessions: make sure /run/nologin has correct SELinux label
Tom Gundersen [Fri, 4 Dec 2015 13:22:29 +0000 (14:22 +0100)]
Merge pull request #2092 from poettering/dnssec2
Second DNSSEC patch set
Evgeny Vereshchagin [Fri, 4 Dec 2015 05:48:09 +0000 (05:48 +0000)]
build-sys: move "dist" parts out of conditional
Fixes:
$ ./autogen.sh
$ ./configure ... --disable-timesyncd
$ make distcheck
...
make[1]: *** No rule to make target 'src/timesync/timesyncd-gperf.gperf', needed by 'src/timesync/timesyncd-gperf.c'. Stop.
Zbigniew Jędrzejewski-Szmek [Fri, 4 Dec 2015 02:41:53 +0000 (21:41 -0500)]
Merge pull request #2093 from evverx/add-test-dnssec-to-gitignore
.gitignore: add test-dnssec
Evgeny Vereshchagin [Fri, 4 Dec 2015 01:32:15 +0000 (01:32 +0000)]
.gitignore: add test-dnssec
This is a follow-up for
2b442ac87838be7c326
Lennart Poettering [Thu, 3 Dec 2015 20:16:07 +0000 (21:16 +0100)]
resolved: update DNSSEC TODO list a bit
Lennart Poettering [Thu, 3 Dec 2015 20:04:52 +0000 (21:04 +0100)]
resolved: add a concept of "authenticated" responses
This adds a new SD_RESOLVED_AUTHENTICATED flag for responses we return
on the bus. When set, then the data has been authenticated. For now this
mostly reflects the DNSSEC AD bit, if DNSSEC=trust is set. As soon as
the client-side validation is complete it will be hooked up to this flag
too.
We also set this bit whenver we generated the data ourselves, for
example, because it originates in our local LLMNR zone, or from the
built-in trust anchor database.
The "systemd-resolve-host" tool has been updated to show the flag state
for the data it shows.
Lennart Poettering [Thu, 3 Dec 2015 20:03:00 +0000 (21:03 +0100)]
resolved: when synthesizing NODATA from cached NSEC bitmaps, honour CNAME/DNAME
When an RR type is not set in an NSEC, then the CNAME/DNAME types might
still be, hence check them too.
Otherwise we might end up refusing resolving of CNAME'd RRs if we cached
an NSEC before.
Lennart Poettering [Thu, 3 Dec 2015 18:53:13 +0000 (19:53 +0100)]
resolved: maintain a short TODO list for DNSSEC support in the dnssec C files for now
Lennart Poettering [Thu, 3 Dec 2015 18:51:04 +0000 (19:51 +0100)]
resolved: introduce a dnssec_mode setting per scope
The setting controls which kind of DNSSEC validation is done: none at
all, trusting the AD bit, or client-side validation.
For now, no validation is implemented, hence the setting doesn't do much
yet, except of toggling the CD bit in the generated messages if full
client-side validation is requested.
Lennart Poettering [Thu, 3 Dec 2015 18:03:21 +0000 (19:03 +0100)]
resolved: add a limit on the max DNSSEC RRSIG expiry skew we allow
Lennart Poettering [Thu, 3 Dec 2015 17:31:24 +0000 (18:31 +0100)]
resolved: add a simple trust anchor database as additional RR source
When doing DNSSEC lookups we need to know one or more DS or DNSKEY RRs
as trust anchors to validate lookups. With this change we add a
compiled-in trust anchor database, serving the root DS key as of today,
retrieved from:
https://data.iana.org/root-anchors/root-anchors.xml
The interface is kept generic, so that additional DS or DNSKEY RRs may
be served via the same interface, for example by provisioning them
locally in external files to support "islands" of security.
The trust anchor database becomes the fourth source of RRs we maintain,
besides, the network, the local cache, and the local zone.
Lennart Poettering [Thu, 3 Dec 2015 17:26:12 +0000 (18:26 +0100)]
resolved: rework how we allow allow queries to be dispatched to scopes
Previously, we'd never do any single-label or root domain lookups via
DNS, thus leaving single-label lookups to LLMNR and the search path
logic in order that single-label names don't leak too easily onto the
internet. With this change we open things up a bit, and only prohibit
A/AAAA lookups of single-label/root domains, but allow all other
lookups. This should provide similar protection, but allow us to resolve
DNSKEY+DS RRs for the top-level and root domains.
(This also simplifies handling of the search domain detection, and gets
rid of dns_scope_has_search_domains() in favour of
dns_scope_get_search_domains()).
Lennart Poettering [Thu, 3 Dec 2015 17:20:56 +0000 (18:20 +0100)]
resolved: don't bother with picking a search domain when searching is disabled
Lennart Poettering [Thu, 3 Dec 2015 16:27:13 +0000 (17:27 +0100)]
resolved: optionally, allocate DnsResourceKey objects on the stack
Sometimes when looking up entries in hashmaps indexed by a
DnsResourceKey it is helpful not having to allocate a full
DnsResourceKey dynamically just to use it as search key. Instead,
optionally allow allocation of a DnsResourceKey on the stack. Resource
keys allocated like that of course are subject to other lifetime cycles
than the usual Resource keys, hence initialize the reference counter to
to (unsigned) -1.
While we are at it, remove the prototype for
dns_resource_key_new_dname() which was never implemented.
Lennart Poettering [Thu, 3 Dec 2015 16:22:17 +0000 (17:22 +0100)]
resolved: make expiration error recognizable
Lennart Poettering [Thu, 3 Dec 2015 16:20:47 +0000 (17:20 +0100)]
resolved: refuse resolving of a number of domains listed in RFC6303
We already blacklisted a few domains, add more.
Tom Gundersen [Thu, 3 Dec 2015 17:22:06 +0000 (18:22 +0100)]
Merge pull request #1934 from martinpitt/master
tests: add networkd integration test
Tom Gundersen [Thu, 3 Dec 2015 17:12:10 +0000 (18:12 +0100)]
Merge pull request #2089 from keszybz/journal-fixes-2
Journal fixes
Zbigniew Jędrzejewski-Szmek [Thu, 3 Dec 2015 07:44:50 +0000 (02:44 -0500)]
journal: silently skip failing large messages if journald is missing
We treated -ENOENT errors with silent failure, for small messages.
Do the same for large messages.
Zbigniew Jędrzejewski-Szmek [Thu, 3 Dec 2015 07:20:39 +0000 (02:20 -0500)]
journal: unbreak sd_journal_sendv
Borked since
commit
3ee897d6c2401effbc82f5eef35fce405781d6c8
Author: Lennart Poettering <lennart@poettering.net>
Date: Wed Sep 23 01:00:04 2015 +0200
tree-wide: port more code to use send_one_fd() and receive_one_fd()
because here our fd is not connected and we need to specify
the address.
Zbigniew Jędrzejewski-Szmek [Thu, 3 Dec 2015 05:45:59 +0000 (00:45 -0500)]
test-journal-send: add tests for sendv
Also, check the return value of all calls.
They are documented to return 0, even if journald is not listening.
Zbigniew Jędrzejewski-Szmek [Thu, 3 Dec 2015 05:27:22 +0000 (00:27 -0500)]
journal: addition and multiplication do not commute
Zbigniew Jędrzejewski-Szmek [Thu, 3 Dec 2015 03:42:49 +0000 (22:42 -0500)]
test-journal-send: no need to set log level
We only use the public api here, so don't include
log.h.
Tom Gundersen [Thu, 3 Dec 2015 00:52:01 +0000 (01:52 +0100)]
Merge pull request #2087 from poettering/dnssec
Basic DNSSEC support, and unrelated fixes
Lennart Poettering [Wed, 2 Dec 2015 23:39:44 +0000 (00:39 +0100)]
resolved: support the RSASHA1_NSEC3_SHA1 pseudo-algorithm
RSASHA1_NSEC3_SHA1 is an alias for RSASHA1, used to do NSEC3 feature
negotiation. While verifying RRsets there's no difference, hence support
it here.
Lennart Poettering [Wed, 2 Dec 2015 22:59:19 +0000 (23:59 +0100)]
resolved: synthesize NODATA cache results when we find matching NSEC RRs
If we have a precisely matching NSEC RR for a name, we can use its type
bit field to synthesize NODATA cache lookup results for all types not
mentioned in there.
This is useful for mDNS where NSEC RRs are used to indicate missing RRs
for a specific type, but is beneficial in other cases too.
To test this, consider these two lines:
systemd-resolve-host -t NSEC nasa.gov
systemd-resolve-host -t SRV nasa.gov
The second line will not result in traffic as the first line already
cached the NSEC field.
Lennart Poettering [Wed, 2 Dec 2015 21:56:04 +0000 (22:56 +0100)]
resolved: move algorithm/digest definitions into resolved-dns-rr.h
After all, they are for flags and parameters of RRs and already relevant
when dealing with RRs outside of the serialization concept.
Lennart Poettering [Wed, 2 Dec 2015 21:47:28 +0000 (22:47 +0100)]
resolved: don't accept expired RRSIGs
Lennart Poettering [Wed, 2 Dec 2015 20:20:37 +0000 (21:20 +0100)]
resolved: add basic DNSSEC support
This adds most basic operation for doing DNSSEC validation on the
client side. However, it does not actually add the verification logic to
the resolver. Specifically, this patch only includes:
- Verifying DNSKEY RRs against a DS RRs
- Verifying RRSets against a combination of RRSIG and DNSKEY RRs
- Matching up RRSIG RRs and DNSKEY RRs
- Matching up RR keys and RRSIG RRs
- Calculating the DNSSEC key tag from a DNSKEY RR
All currently used DNSSEC combinations of SHA and RSA are implemented. Support
for MD5 hashing and DSA or EC cyphers are not. MD5 and DSA are probably
obsolete, and shouldn't be added. EC should probably be added
eventually, if it actually is deployed on the Internet.
Lennart Poettering [Wed, 2 Dec 2015 20:05:21 +0000 (21:05 +0100)]
resolved: port ResolveRecord() bus call implementation to dns_resource_record_to_wire_format()
Now that we have dns_resource_record_to_wire_format() we can generate
the RR serialization we return to bus clients in ResolveRecord() with
it. We pass the RR data along in the original form, not the DNSSEC
canonical form, since that would mean we'd lose RR name casing, which is
however important to keep for DNS-SD services and similar.
Lennart Poettering [Wed, 2 Dec 2015 19:58:51 +0000 (20:58 +0100)]
resolved: add code to generate the wire format for a single RR
This adds dns_resource_record_to_wire_format() that generates the raw
wire-format of a single DnsResourceRecord object, and caches it in the
object, optionally in DNSSEC canonical form. This call is used later to
generate the RR serialization of RRs to verify.
This adds four new fields to DnsResourceRecord objects:
- wire_format points to the buffer with the wire-format version of the
RR
- wire_format_size stores the size of that buffer
- wire_format_rdata_offset specifies the index into the buffer where the
RDATA of the RR begins (i.e. the size of the key part of the RR).
- wire_format_canonical is a boolean that stores whether the cached wire
format is in DNSSEC canonical form or not.
Note that this patch adds a mode where a DnsPacket is allocated on the
stack (instead of on the heap), so that it is cheaper to reuse the
DnsPacket object for generating this wire format. After all we reuse the
DnsPacket object for this, since it comes with all the dynamic memory
management, and serialization calls we need anyway.