Susant Sahani [Fri, 25 Dec 2015 05:12:43 +0000 (10:42 +0530)]
lldp: improve logging
Lennart Poettering [Wed, 23 Dec 2015 23:46:19 +0000 (00:46 +0100)]
Merge pull request #2216 from zonque/nameownerchanged
core: re-sync bus name list after deserializing during daemon-reload
Daniel Mack [Tue, 22 Dec 2015 10:37:09 +0000 (11:37 +0100)]
core: re-sync bus name list after deserializing during daemon-reload
When the daemon reloads, it doesn not actually give up its DBus connection,
as wrongly stated in an earlier commit. However, even though the bus
connection stays open, the daemon flushes out all its internal state.
Hence, if there is a NameOwnerChanged signal after the flush and before the
deserialization, it cannot be matched against any pending unit.
To fix this, rename bus_list_names() to manager_sync_bus_names() and call
it explicitly at the end of the daemon reload operation.
Lennart Poettering [Wed, 23 Dec 2015 20:31:07 +0000 (21:31 +0100)]
Merge pull request #2158 from keszybz/journal-decompression
Journal decompression fixes
Lennart Poettering [Wed, 23 Dec 2015 20:07:07 +0000 (21:07 +0100)]
Merge pull request #2214 from zonque/leak
Core: plug a memory leak in socket.c, and some related cleanups
Daniel Mack [Tue, 22 Dec 2015 10:32:25 +0000 (11:32 +0100)]
socket: nullify pointers after free
A socket shouldn't be used after socket_done() returns, but follow the
general guideline here and avoid dangling pointers anyway.
Daniel Mack [Tue, 22 Dec 2015 10:03:53 +0000 (11:03 +0100)]
socket: free fdname member
Plug a small memory leak.
Lennart Poettering [Mon, 21 Dec 2015 13:24:29 +0000 (14:24 +0100)]
Merge pull request #2202 from zonque/nameownerchanged
core: fix bus name synchronization after daemon-reload
Lennart Poettering [Mon, 21 Dec 2015 13:21:29 +0000 (14:21 +0100)]
Merge pull request #2204 from zonque/sd-event-debug
sd-event: improve debugging of event source errors
Daniel Mack [Mon, 21 Dec 2015 12:03:24 +0000 (13:03 +0100)]
sd-event: improve debugging of event source errors
Printing the pointer variable really doesn't help, so drop that.
Instead, add a string lookup table for the EventSourceType enum, and print
the type of event source in case of errors.
Daniel Mack [Mon, 21 Dec 2015 11:09:46 +0000 (12:09 +0100)]
Merge pull request #2203 from mbiebl/man-typo-fix
man: fix typo in systemctl(1)
Michael Biebl [Mon, 21 Dec 2015 10:54:41 +0000 (11:54 +0100)]
man: fix typo in systemctl(1)
Daniel Mack [Fri, 18 Dec 2015 16:28:15 +0000 (17:28 +0100)]
core: fix bus name synchronization after daemon-reload
During daemon-reload, PID1 temporarly loses its DBus connection, so there's
a small window in which all signals sent by dbus-daemon are lost.
This is a problem, since we rely on the NameOwnerChanged signals in order to
consider a service with Type=dbus fully started or terminated, respectively.
In order to fix this, a rewrite of bus_list_names() is necessary. We used
to walk the current list of names on the bus, and blindly triggered the
bus_name_owner_change() callback on each service, providing the actual name
as current owner. This implementation has a number of problems:
* We cannot detect if the the name was moved from one owner to the other
while we were reloading
* We don't notify services which missed the name loss signal
* Providing the actual name as current owner is a hack, as the comment also
admits.
To fix this, this patch carries the following changes:
* Track the name of the current bus name owner, and (de-)serialize it
during reload. This way, we can detect changes.
* In bus_list_names(), walk the list of bus names we're interested in
first, and then see if the name is active on the bus. If it is,
check it it's still the same as it used to be, and synthesize
NameOwnerChanged signals for the name add and/or loss.
This should fully synchronize the current name list with the internal
state of all services.
Daniel Mack [Sun, 20 Dec 2015 18:46:19 +0000 (19:46 +0100)]
Merge pull request #2199 from phomes/resolve-indentation
resolve: fix indentation
Thomas Hindoe Paaboel Andersen [Sun, 20 Dec 2015 15:58:44 +0000 (16:58 +0100)]
resolve: fix indentation
Tom Gundersen [Sun, 20 Dec 2015 01:35:44 +0000 (01:35 +0000)]
Merge pull request #2190 from poettering/dnssec6
Add DNSSEC proof of unsignedness and NSEC3 proof
Daniel Mack [Sat, 19 Dec 2015 23:58:19 +0000 (00:58 +0100)]
Merge pull request #2193 from ToostInc/logindbus-typo-fix
Fix typo on logind-dbus.c
Joost Bremmer [Sat, 19 Dec 2015 11:46:09 +0000 (12:46 +0100)]
Fix typo on logind-dbus.c
method_schedule_shutdown referenced org.freedesktop.login1.poweroff*
which is never registered in polkit.
Now refers to org.freedesktop.login1.power-off*
Signed-off-by: Joost Bremmer <toost.b@gmail.com>
Lennart Poettering [Fri, 18 Dec 2015 19:21:14 +0000 (20:21 +0100)]
resolved: propagate DNSSEC validation status from auxiliary transactions
Let's make sure we propagate the DNSSEC validation status from an
auxiliary DNSSEC transaction back to the originating transaction, to
improve the error messages we generate.
Lennart Poettering [Fri, 18 Dec 2015 19:09:30 +0000 (20:09 +0100)]
resolved: propagate the DNSSEC result from the transaction to the query and the the bus client
It's useful to generate useful errors, so let's do that.
Lennart Poettering [Fri, 18 Dec 2015 18:49:25 +0000 (19:49 +0100)]
resolved: rename DNS_TRANSACTION_FAILURE → DNS_TRANSACTION_RCODE_FAILURE
We have many types of failure for a transaction, and
DNS_TRANSACTION_FAILURE was just one specific one of them, if the server
responded with a non-zero RCODE. Hence let's rename this, to indicate
which kind of failure this actually refers to.
Lennart Poettering [Fri, 18 Dec 2015 18:46:27 +0000 (19:46 +0100)]
resolved: merge two comments
Lennart Poettering [Fri, 18 Dec 2015 18:44:15 +0000 (19:44 +0100)]
resolved: rename dns_cache_item_remove_and_free() → _unlink_and_free()
In most of the other call, we called similar functions that remove the
data structure link-ups to other objects "unlink", hence we should here,
too.
Lennart Poettering [Fri, 18 Dec 2015 18:43:10 +0000 (19:43 +0100)]
resolved: rename dns_cache_remove() → dns_cache_remove_by_key()
Given that we already have dns_cache_remove_by_rr() this makes clearer
what the operation actually does.
Lennart Poettering [Fri, 18 Dec 2015 18:42:02 +0000 (19:42 +0100)]
resolved: add a call that dumps the contents of a DnsAnswer structure
This is not used anywhere, but it's extremely useful when debugging.
Lennart Poettering [Fri, 18 Dec 2015 18:32:46 +0000 (19:32 +0100)]
resolved: rework mDNS cache-flush bit handling
This adds a new DnsAnswer item flag "DNS_ANSWER_SHARED_OWNER" which is
set for mDNS RRs that lack the cache-flush bit. The cache-flush bit is
removed from the DnsResourceRecord object in favour of this.
This also splits out the code that removes previous entries when adding
new positive ones into a new separate call dns_cache_remove_previous().
Lennart Poettering [Fri, 18 Dec 2015 18:31:21 +0000 (19:31 +0100)]
resolved: properly determine size of DnsAnswer object
After all we want to allow NULL DnsAnswer objects as equivalent to empty
ones, hence we should use the right checks everywhere.
Lennart Poettering [Fri, 18 Dec 2015 18:29:47 +0000 (19:29 +0100)]
resolved: pass out precise authenticated bit we got passed in
Make sure the cache never altes the authenticated bit of RRs stored in
it, and drops it for RRs when passing it out again.
Lennart Poettering [Fri, 18 Dec 2015 18:27:16 +0000 (19:27 +0100)]
resolved: don't honour mDNS cache-flush bit for OPT RRs
OPT RRs after all use the class field for other purposes than actually
encoding a class, hence the cache flush bit doesn't apply really.
Lennart Poettering [Fri, 18 Dec 2015 18:25:04 +0000 (19:25 +0100)]
resolve: optimize dns_cache_flush() a bit
Let's use dns_cache_remove() rather than
dns_cache_item_remove_and_free() to destroy the cache, since the former
requires far fewer hash table lookups.
Lennart Poettering [Fri, 18 Dec 2015 18:22:26 +0000 (19:22 +0100)]
resolved: when receiving a TTL=0 RR, only flush that specific RR
When we receieve a TTL=0 RR, then let's only flush that specific RR and
not the whole RRset.
On mDNS with RRsets that a shared-owner this is how specific RRs are
removed from the set, hence support this. And on non-mDNS the whole
RRset will already be removed much earlier in dns_cache_put() hence
there's no reason remove it again.
Lennart Poettering [Fri, 18 Dec 2015 18:19:56 +0000 (19:19 +0100)]
resolved: optimize dns_cache_remove() a bit
Lennart Poettering [Fri, 18 Dec 2015 18:15:34 +0000 (19:15 +0100)]
resolved: use dns_name_parent() where appropriate
Lennart Poettering [Fri, 18 Dec 2015 18:12:48 +0000 (19:12 +0100)]
resolved: check SOA authentication state when negative caching
We should never use the TTL of an unauthenticated SOA to cache an
authenticated RR.
Lennart Poettering [Fri, 18 Dec 2015 18:09:27 +0000 (19:09 +0100)]
resolved: don't call dns_cache_remove() from dns_cache_put_negative()
We call it anyway as one of the first calls in dns_cache_put(), hence
there's no reason to do this multiple times.
Lennart Poettering [Fri, 18 Dec 2015 18:07:31 +0000 (19:07 +0100)]
resolved: bump cache size a bit
Let's keep entries for longer and more of them. After all, due to the
DNSSEC hookup the amount of RRs we need to store is much higher now.
Lennart Poettering [Fri, 18 Dec 2015 18:06:23 +0000 (19:06 +0100)]
resolved: make use of dns_{class|type}_is_{pseudo|valid_rr}() everywhere
Lennart Poettering [Fri, 18 Dec 2015 17:57:08 +0000 (18:57 +0100)]
resolved: refuse accepting EDNS0 OPT RRs with a non-root domain
Lennart Poettering [Fri, 18 Dec 2015 17:53:11 +0000 (18:53 +0100)]
resolved: move DNS class utilities to dns-type.c and add more helpers
Let's make DNS class helpers more like DNS type helpers, let's move them
from resolved-dns-rr.[ch] into dns-type.[ch].
This also adds two new calls dns_class_is_pseudo() and
dns_class_is_valid_rr() which operate similar to dns_type_is_pseudo()
and dns_type_is_valid_rr() but for classes instead of types.
This should hopefully make handling of DNS classes and DNS types more
alike.
Lennart Poettering [Fri, 18 Dec 2015 13:48:24 +0000 (14:48 +0100)]
resolved: update TODO
Lennart Poettering [Fri, 18 Dec 2015 13:37:06 +0000 (14:37 +0100)]
resolved: add support NSEC3 proofs, as well as proofs for domains that are OK to be unsigned
This large patch adds a couple of mechanisms to ensure we get NSEC3 and
proof-of-unsigned support into place. Specifically:
- Each item in an DnsAnswer gets two bit flags now:
DNS_ANSWER_AUTHENTICATED and DNS_ANSWER_CACHEABLE. The former is
necessary since DNS responses might contain signed as well as unsigned
RRsets in one, and we need to remember which ones are signed and which
ones aren't. The latter is necessary, since not we need to keep track
which RRsets may be cached and which ones may not be, even while
manipulating DnsAnswer objects.
- The .n_answer_cachable of DnsTransaction is dropped now (it used to
store how many of the first DnsAnswer entries are cachable), and
replaced by the DNS_ANSWER_CACHABLE flag instead.
- NSEC3 proofs are implemented now (lacking support for the wildcard
part, to be added in a later commit).
- Support for the "AD" bit has been dropped. It's unsafe, and now that
we have end-to-end authentication we don't need it anymore.
- An auxiliary DnsTransaction of a DnsTransactions is now kept around as
least as long as the latter stays around. We no longer remove the
auxiliary DnsTransaction as soon as it completed. THis is necessary,
as we now are interested not only in the RRsets it acquired but also
in its authentication status.
Lennart Poettering [Fri, 18 Dec 2015 13:33:59 +0000 (14:33 +0100)]
resolved: refuse to add auxiliary transactions loops
Let's be safe and explicitly avoid that we add an auxiliary transaction
dependency on ourselves.
Lennart Poettering [Fri, 18 Dec 2015 13:29:32 +0000 (14:29 +0100)]
resolved: don't check for NULL DnsAnswer object explicitly where unnecessary
The DNS_ANSWER_FOREACH macros do this internally anyway, no need to
duplicate this.
Lennart Poettering [Fri, 18 Dec 2015 13:26:48 +0000 (14:26 +0100)]
resolved: stop timeout timer when validating transactions
We need no separate timeout anymore as soon as we received a reply, as
the auxiliary transactions have their own timeouts.
Lennart Poettering [Fri, 18 Dec 2015 13:26:02 +0000 (14:26 +0100)]
resolved: when destroying a scope, only abort live transactions
Lennart Poettering [Fri, 18 Dec 2015 13:23:48 +0000 (14:23 +0100)]
resolved: make sure we don't get confused when notifying transactions while they are destroyed
A failing transaction might cause other transactions to fail too, and
thus the set of transactions to notify for a transaction might change
while we are notifying them. Protect against that.
Lennart Poettering [Fri, 18 Dec 2015 13:22:46 +0000 (14:22 +0100)]
resolved: merge two bools into a bitfield
Lennart Poettering [Fri, 18 Dec 2015 13:22:14 +0000 (14:22 +0100)]
resolved: use right format specifier to print transaction ID
Lennart Poettering [Fri, 18 Dec 2015 13:20:03 +0000 (14:20 +0100)]
resolved: cache stringified transaction key once per transaction
We end up needing the stringified transaction key in many log messages,
hence let's simplify the logic and cache it inside of the transaction:
generate it the first time we need it, and reuse it afterwards. Free it
when the transaction goes away.
This also updated a couple of log messages to make use of this.
Lennart Poettering [Fri, 18 Dec 2015 13:16:48 +0000 (14:16 +0100)]
resolved: don't complain if networkd doesn't know an interface we care about
Lennart Poettering [Fri, 18 Dec 2015 13:16:03 +0000 (14:16 +0100)]
shared: add dns_name_parent() call to determine parent domain of a domain
Daniel Mack [Wed, 16 Dec 2015 19:14:36 +0000 (20:14 +0100)]
Merge pull request #2180 from phomes/resolve-misc
Resolve: misc cleanups
Thomas Hindoe Paaboel Andersen [Wed, 16 Dec 2015 18:33:20 +0000 (19:33 +0100)]
resolve: remove unused variable
Thomas Hindoe Paaboel Andersen [Wed, 16 Dec 2015 18:26:16 +0000 (19:26 +0100)]
resolve: fix indendation
Daniel Mack [Tue, 15 Dec 2015 14:57:19 +0000 (15:57 +0100)]
Merge pull request #2157 from keszybz/manager-status
Manager status
Daniel Mack [Tue, 15 Dec 2015 14:56:19 +0000 (15:56 +0100)]
Merge pull request #2174 from yuwata/journal-remote-man
man: fix typo in journal-remote.conf(5)
Yu Watanabe [Tue, 15 Dec 2015 14:24:28 +0000 (23:24 +0900)]
man: fix typo in journal-remote.conf(5)
Tom Gundersen [Tue, 15 Dec 2015 12:25:22 +0000 (12:25 +0000)]
Merge pull request #2168 from poettering/dnssec5
Fifth batch of DNSSEC support patches
Daniel Mack [Tue, 15 Dec 2015 10:33:57 +0000 (11:33 +0100)]
Merge pull request #2169 from yuwata/journal-remote-unit-doc
journal-remote: add documents in the unit files
Daniel Mack [Tue, 15 Dec 2015 09:33:38 +0000 (10:33 +0100)]
Merge pull request #2172 from evverx/fix-enable-hashmap
basic: ENABLE_DEBUG_HASHMAP needs <pthread.h>
Henrik Kaare Poulsen [Sun, 13 Dec 2015 18:31:05 +0000 (19:31 +0100)]
basic: ENABLE_DEBUG_HASHMAP needs <pthread.h>
this is a follow-up for commit
11c3a36649e5e5e77db499c92f3
Yu Watanabe [Tue, 15 Dec 2015 01:51:12 +0000 (10:51 +0900)]
journal-remote: add documents in the unit files
Lennart Poettering [Mon, 14 Dec 2015 20:32:17 +0000 (21:32 +0100)]
resolved: update DNSSEC TODO
Lennart Poettering [Mon, 14 Dec 2015 20:26:42 +0000 (21:26 +0100)]
resolved: add basic proof of non-existance support for NSEC+NSEC3
Note that this is not complete yet, as we don't handle wildcard domains
correctly, nor handle domains correctly that use empty non-terminals.
Lennart Poettering [Mon, 14 Dec 2015 20:26:15 +0000 (21:26 +0100)]
resolved: when serializing NSEC3 windows, don't write more windows than necessary
Lennart Poettering [Mon, 14 Dec 2015 20:23:54 +0000 (21:23 +0100)]
resolved: constify a parameter
Lennart Poettering [Mon, 14 Dec 2015 20:22:40 +0000 (21:22 +0100)]
resolved: always consider NSEC/NSEC3 RRs as "primary"
It's not OK to drop these for our proof of non-existance checks.
Lennart Poettering [Mon, 14 Dec 2015 20:21:59 +0000 (21:21 +0100)]
resolved: don't choke on NULL DNS transactions when determining query candidate state
Lennart Poettering [Mon, 14 Dec 2015 20:21:16 +0000 (21:21 +0100)]
resolved: initialize libgcrypt before using it
Lennart Poettering [Mon, 14 Dec 2015 20:20:05 +0000 (21:20 +0100)]
resolved: rework how we get the gcrypt digest algorithm ID from DNSSEC digest ids
Let's move this into a function digest_to_gcrypt() that we can reuse
later on when implementing NSEC3 validation.
Lennart Poettering [Fri, 11 Dec 2015 19:19:05 +0000 (20:19 +0100)]
resolved: apparently not all names are used in canonical form for DNSSEC validation
Specifically, it appears as if the NSEC next domain name should be in
the original casing rather than canonical form, when validating.
Daniel Mack [Mon, 14 Dec 2015 15:31:25 +0000 (16:31 +0100)]
Merge pull request #2165 from torstehu/fix-typo2
treewide: fix typos and indentation
Torstein Husebø [Fri, 4 Dec 2015 07:03:59 +0000 (08:03 +0100)]
treewide: fix typos and indentation
Zbigniew Jędrzejewski-Szmek [Sun, 13 Dec 2015 19:33:17 +0000 (14:33 -0500)]
journal: add the "repeating sequence" test case
This was the case that caused various problems that were fixed in
preceding patches, so it is good to add a test that uses it directly.
In "may_fail" test cases try again with a bigger buffer.
Instead of allocating various buffers on the stack, malloc them.
This is more reliable in case of big buffers, and allows tools like
valgrind and address sanitizer to find overflows more easily.
Zbigniew Jędrzejewski-Szmek [Sun, 13 Dec 2015 19:24:55 +0000 (14:24 -0500)]
journal: add "xfail" test for partial lz4 decompression
Add a test that LZ4_decompress_safe_partial does (not) work as
expected, so that if it starts to work at some point, we'll catch
this and adjust our code.
Zbigniew Jędrzejewski-Szmek [Sun, 13 Dec 2015 19:20:21 +0000 (14:20 -0500)]
journal: fix reporting of output size in compres_stream_lz4
The header is 7 bytes, and this size was not accounted for in
total_out. This means that we could create a file that was 7 bytes
longer than requested, and the debug output was also inconsistent.
Zbigniew Jędrzejewski-Szmek [Sun, 13 Dec 2015 18:39:12 +0000 (13:39 -0500)]
journal: add dst_allocated_size parameter for compress_blob
compress_blob took src, src_size, dst and *dst_size, but dst_size
wasn't used as an input parameter with the size of dst, but only as an
output parameter. dst was implicitly assumed to be at least src_size-1.
This code wasn't *wrong*, because the only real caller in
journal-file.c got it right. But it was misleading, and the tests in
test-compress.c got it wrong, and worked only because the output
buffer happened to be the same size as input buffer. So add a seperate
dst_allocated_size parameter to make it explicit what the size of the
buffer is, and to allow test to proceed with different output buffer
sizes.
Zbigniew Jędrzejewski-Szmek [Fri, 11 Dec 2015 14:10:33 +0000 (09:10 -0500)]
journal: in some cases we have to decompress the full lz4 field
lz4 has to decompress a whole "sequence" at a time. When the compressed
data is composed of a repeating pattern, the whole set of repeats has
do be docompressed, and the output buffer has to be big enough.
This is unfortunate, because potentially the slowdown is very big. We
are only interested in the field name, but we might have to decompress
the whole thing. But the full cost will be borne out only when the
full entry is a repeating pattern. In practice this shouldn't happen
(apart from tests and the like). Hopefully lz4 will be fixed to avoid
this problem, or it will grow a new function which we can use [1], so
this fix should be remporary.
[1] https://groups.google.com/d/msg/lz4c/_3kkz5N6n00/oTahzqErCgAJ
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2015 14:38:50 +0000 (09:38 -0500)]
journal: decompress_startswith can return an error
The return value was used directly in an if, so an error was treated
as success; we need to bail out instead. An error should not happen,
unless we have a compression/decompression mismatch, so output a debug
line.
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2015 02:35:49 +0000 (21:35 -0500)]
journal: properly handle an unexpectedly missing field
parse_field() checks if the field has the expected format, and returns
0 if it doesn't. In that case, value and size are not
set. Nevertheless, we would try to continue, and hit an assert in
safe_atou64. This case shouldn't happen, unless sd_j_get_data is borked,
so cleanly assert that we got the expected field.
Also, oom is the only way that parse_field can fail, which we log
already. Instead of outputting a debug statement and carrying on,
treat oom as fatal.
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2015 02:29:38 +0000 (21:29 -0500)]
manager: log log level changes uniformly
Output the same message when a request to change the log level is
received over dbus and through a signal. From the user point of view
those two operations are very similar and it's easy to think that the
dbus operation didn't work when the expected message is not emitted.
Also "downgrade" the message level to info, since this is a normal
user initiated action.
Zbigniew Jędrzejewski-Szmek [Tue, 8 Dec 2015 23:23:39 +0000 (18:23 -0500)]
manager: move status output change debug messages to set function
This way we can only print the debug message when the status actually
changes. We also means we don't print anything when running in --user
mode, where status output is always disabled.
Daniel Mack [Sun, 13 Dec 2015 16:22:48 +0000 (17:22 +0100)]
Merge pull request #2152 from evverx/respect-disable-tests
build-sys: fix --disable-tests
Evgeny Vereshchagin [Sun, 13 Dec 2015 06:51:33 +0000 (06:51 +0000)]
build-sys: fix --disable-tests
Fixes:
$ ./configure ... --disable-tests
$ make
$ sudo make check
FAIL: test/udev-test.pl
PASS: test/rule-syntax-check.py
PASS: test/sysv-generator-test.py
...
Daniel Mack [Sat, 12 Dec 2015 13:03:52 +0000 (14:03 +0100)]
Merge pull request #2148 from evverx/fix-enable-smack
build-sys: fix ./configure --enable-smack
Evgeny Vereshchagin [Sat, 12 Dec 2015 06:08:25 +0000 (06:08 +0000)]
build-sys: refactor `have_smack` detection
Evgeny Vereshchagin [Sat, 12 Dec 2015 03:43:45 +0000 (03:43 +0000)]
build-sys: fix ./configure --enable-smack
Fixes:
$ ./configure ... --enable-smack
$ make src/core/load-fragment-gperf.c
$ grep -i smack src/core/load-fragment-gperf.c
{"Swap.SmackProcessLabel", config_parse_warn_compat, DISABLED_CONFIGURATION, 0},
...
should be
{"Swap.SmackProcessLabel", config_parse_exec_smack_process_label, 0, offsetof(Swap, exec_context)},
...
Tom Gundersen [Fri, 11 Dec 2015 17:38:14 +0000 (18:38 +0100)]
Merge pull request #2143 from poettering/dnssec4
Another batch of DNSSEC fixes
Lennart Poettering [Fri, 11 Dec 2015 14:10:56 +0000 (15:10 +0100)]
resolved: don't eat up errors
dns_resource_key_match_soa() and dns_resource_key_match_cname_or_dname()
may return errors as negative return values. Make sure to propagate
those.
Lennart Poettering [Fri, 11 Dec 2015 13:00:08 +0000 (14:00 +0100)]
resolved: refactor DNSSEC answer validation
This changes answer validation to be more accepting to unordered RRs in
responses. The agorithm we now implement goes something like this:
1. populate validated keys list for this transaction from DS RRs
2. as long as the following changes the unvalidated answer list:
2a. try to validate the first RRset we find in unvalidated answer
list
2b. if that worked: add to validated answer; if DNSKEY also add to
validated keys list; remove from unvalidated answer.
2c. continue at 2a, with the next RRset, or restart from the
beginning when we hit the end
3. as long as the following changes the unvalidated answer list:
3a. try to validate the first RRset again. This will necessarily
fail, but we learn the precise error
3b. If this was a "primary" response to the question, fail the
entire transaction. "Primary" in this context means that it is
directly a response to the query, or a CNAME/DNAME for it.
3c. Otherwise, remove the RRset from the unvalidated answer list.
Note that we the too loops in 2 + 3 are actually coded as a single one,
but the dnskeys_finalized bool indicates which loop we are currently
processing.
Note that loop 2 does not drop any invalidated RRsets yet, that's
something only loop 3 does. This is because loop 2 might still encounter
additional DNSKEYS which might validate more stuff, and if we'd already
have dropped those RRsets we couldn't validate those anymore. The first
loop is hence a "constructive" loop, the second loop a "destructive"
one: the first one validates whatever is possible, the second one then
deletes whatever still isn't.
Lennart Poettering [Fri, 11 Dec 2015 12:55:26 +0000 (13:55 +0100)]
resolved: rework dnssec validation results
This adds a new validation result DNSSEC_UNSUPPORTED_ALGORITHM which is
returned when we encounter an unsupported crypto algorithm when trying
to validate RRSIG/DNSKEY combinations. Previously we'd return ENOTSUPP
in this case, but it's better to consider this a non-error DNSSEC
validation result, since our reaction to this case needs to be more like
in cases such as expired or missing keys: we need to keep continue
validation looking for another RRSIG/DNSKEY combination that works
better for us.
This also reworks how dnssec_validate_rrsig_search() propagates errors
from dnssec_validate_rrsig(). Previously, errors such as unsupported
algorithms or expired signatures would not be propagated, but simply be
returned as "missing-key".
Lennart Poettering [Fri, 11 Dec 2015 12:36:25 +0000 (13:36 +0100)]
resolved: rework how and when the number of answer RRs to cache is determined
Instead of figuring out how many RRs to cache right before we do so,
determine this at the time we install the answer RRs, so that we can
still alter this as we manipulate the answer during validation.
The primary purpose of this is to pave the way so that we can drop
unsigned RRsets from the answer and invalidate the number of RRs to
cache at the same time.
Lennart Poettering [Thu, 10 Dec 2015 14:01:04 +0000 (15:01 +0100)]
resolved: generalize DNS RR type validity checks
Check the validity of RR types as we parse or receive data from IPC
clients, and use the same code for all of them.
Lennart Poettering [Thu, 10 Dec 2015 12:46:53 +0000 (13:46 +0100)]
resolved: refuse OPT RRs in incoming packets that are not in the additional section
We later rely that the DnsAnswer object contains all RRs from the
original packet, at least when it comes to the answer and authorization
sections, hence we better make sure we don#t silently end up removing an
OPT RR from these two sections.
Lennart Poettering [Thu, 10 Dec 2015 12:46:05 +0000 (13:46 +0100)]
resolved: refuse to cache ANY kind of pseudo-RR-type
Lennart Poettering [Thu, 10 Dec 2015 12:28:33 +0000 (13:28 +0100)]
resolved: no need to check for NULL explicitly before invoking dns_packet_unref()
Lennart Poettering [Thu, 10 Dec 2015 12:27:58 +0000 (13:27 +0100)]
resolved: extend list of pseudo RR types
Also, explain the situation with a longer comment.
Daniel Mack [Thu, 10 Dec 2015 19:48:42 +0000 (20:48 +0100)]
Merge pull request #2096 from teg/resolved-cache
Misc resolved cache fixes
Tom Gundersen [Thu, 10 Dec 2015 19:17:49 +0000 (20:17 +0100)]
resolved: cache - only stringify RR keys when in debug mode
This is in the fast path, so let's not do all this work unneccessarily.
Tom Gundersen [Thu, 10 Dec 2015 18:57:41 +0000 (19:57 +0100)]
resolved: cache - don't flush the cache of mDNS records unneccesarily
When the DNS_RESOURCE_KEY_CACHE_FLUSH flag is not set for an mDNS packet, we should not flush
the cache for RRs with matching keys. However, we were unconditionally flushing the cache
also for these packets.
Now mark all packets as cache_flush by default, except for these mDNS packets, and respect
that flag in the cache handling.
This fixes
90325e8c2e559a21ef0bc2f26b844c140faf8020.