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.
Lennart Poettering [Wed, 2 Dec 2015 19:56:55 +0000 (20:56 +0100)]
resolved: add code to map DNSSEC digest types to strings and back
Lennart Poettering [Wed, 2 Dec 2015 19:53:10 +0000 (20:53 +0100)]
resolved: store DNSKEY fields flags+protocol as-is
When verifying signatures we need to be able to verify the original
data we got for an RR set, and that means we cannot simply drop flags
bits or consider RRs invalid too eagerly. Hence, instead of parsing the
DNSKEY flags store them as-is. Similar, accept the protocol field as it
is, and don't consider it a parsing error if it is not 3.
Of course, this means that the DNSKEY handling code later on needs to
check explicit for protocol != 3.
Lennart Poettering [Wed, 2 Dec 2015 19:51:07 +0000 (20:51 +0100)]
resolved: add RFC 5702 defined DNSSEC algorithms to table
Lennart Poettering [Wed, 2 Dec 2015 19:47:11 +0000 (20:47 +0100)]
util-lib: update dns_name_to_wire_format() to optionally generate DNSSEC canonical names
We'll need this later when putting together RR serializations to
checksum.
Lennart Poettering [Wed, 2 Dec 2015 19:43:11 +0000 (20:43 +0100)]
resolved: make sure DNS_ANSWER_FOREACH() can be nested
Change the iterator counter so that a different varable is used for each
invocation of the macro, so that it may be nested.
Lennart Poettering [Wed, 2 Dec 2015 19:35:02 +0000 (20:35 +0100)]
resolved: simplify dns_packet_append_string()
It essentially does the same as dns_packet_append_raw_string(), hence
make it a wrapper around it.
Lennart Poettering [Wed, 2 Dec 2015 19:32:58 +0000 (20:32 +0100)]
hostnamed: SMBIOS 3.0 knows the "tablet" form factor, add support for it
Lennart Poettering [Wed, 2 Dec 2015 19:16:23 +0000 (20:16 +0100)]
Merge pull request #2073 from poettering/dns-label-fixes
Dns label fixes + unrelated selinux clean-up
Lennart Poettering [Wed, 2 Dec 2015 19:15:34 +0000 (20:15 +0100)]
Merge pull request #2084 from keszybz/ppc64-fixes-2
Test fixes to run in ppc64 mock
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:53:23 +0000 (22:53 -0500)]
lz4: fix size check which had no chance of working on big-endian
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 04:44:27 +0000 (23:44 -0500)]
tests: fix newlines in skip message
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:35:16 +0000 (22:35 -0500)]
tests: turn check if manager cannot be intialized into macro
We need to check the same thing in multiple tests. Use a shared
macro to make it easier to update the list of errnos.
Change the errno code for "unitialized cgroup fs" for ENOMEDIUM.
Exec format error looks like something more serious.
This fixes test-execute invocation in mock.
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:54:26 +0000 (22:54 -0500)]
basic/virt: add missing includes to compile on ppc64
Tom Gundersen [Tue, 1 Dec 2015 23:27:02 +0000 (00:27 +0100)]
Merge pull request #2082 from phomes/basic-sort-includes
basic: re-sort includes
Thomas Hindoe Paaboel Andersen [Tue, 1 Dec 2015 22:22:03 +0000 (23:22 +0100)]
basic: re-sort includes
My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order.
Tom Gundersen [Mon, 30 Nov 2015 23:25:47 +0000 (00:25 +0100)]
Merge pull request #2074 from keszybz/test-acl-util-fix
test-acl-util: fix two issues from review
Tom Gundersen [Mon, 30 Nov 2015 23:25:07 +0000 (00:25 +0100)]
Merge pull request #2075 from phomes/includes-cleanup-basic
basic: include only what we use
Thomas Hindoe Paaboel Andersen [Mon, 30 Nov 2015 20:43:37 +0000 (21:43 +0100)]
basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
Zbigniew Jędrzejewski-Szmek [Mon, 30 Nov 2015 20:45:39 +0000 (15:45 -0500)]
test-acl-util: fix two issues from review
https://github.com/systemd/systemd/pull/2063
Lennart Poettering [Mon, 30 Nov 2015 19:26:03 +0000 (20:26 +0100)]
core: simplify selinux AVC initialization
Let's merge access_init() and mac_selinux_access_init(), and only call
mac_selinux_use() once, inside the merged function, instead of multiple
times, including in the caller.
See comments on:
https://github.com/systemd/systemd/pull/2053
Lennart Poettering [Mon, 30 Nov 2015 18:40:20 +0000 (19:40 +0100)]
dns-domain: change error codes when dealing with too short buffers to ENOBUFS
Some calls used ENOBUFS to indicate too-short result buffers, others
used ENOSPC. Let's unify this on ENOBUFS.
Lennart Poettering [Mon, 30 Nov 2015 18:39:19 +0000 (19:39 +0100)]
dns-domain: check resulting domain name length in dns_name_to_wire_format()
Let's better be safe than sorry.
Lennart Poettering [Sun, 29 Nov 2015 13:29:31 +0000 (14:29 +0100)]
dns-domain: make sure dns_name_to_wire_format() may properly encode the root domain
The root domain consists of zero labels, and we should be able to encode
that.
Lennart Poettering [Sun, 29 Nov 2015 13:27:28 +0000 (14:27 +0100)]
dns-domain: don't accept overly long hostnames
Make sure dns_name_normalize(), dns_name_concat(), dns_name_is_valid()
do not accept/generate invalidly long hostnames, i.e. longer than 253
characters.
Lennart Poettering [Sun, 29 Nov 2015 13:12:05 +0000 (14:12 +0100)]
dns-domain: be more strict when encoding/decoding labels
Labels of zero length are not OK, refuse them early on. The concept of a
"zero-length label" doesn't exist, a zero-length full domain name
however does (representing the root domain). See RFC 2181, Section 11.
Lennart Poettering [Mon, 30 Nov 2015 18:32:19 +0000 (19:32 +0100)]
Merge pull request #2068 from grawity/cgls-error-v2
cgls: add a better error message for missing cgroupfs [v2]
David Herrmann [Mon, 30 Nov 2015 18:30:03 +0000 (19:30 +0100)]
Merge pull request #2053 from poettering/selinux-fix
Two unrelated fixes
Mantas Mikulėnas [Mon, 30 Nov 2015 06:48:29 +0000 (08:48 +0200)]
cgls: add a better error message for missing cgroupfs
Lennart Poettering [Mon, 30 Nov 2015 16:53:39 +0000 (17:53 +0100)]
Merge pull request #2063 from keszybz/issue-1977-2
journal: clean up permission setting and acl adjustements on user journals
Zbigniew Jędrzejewski-Szmek [Sun, 29 Nov 2015 23:48:40 +0000 (18:48 -0500)]
tmpfiles: set acls on system.journal explicitly
https://github.com/systemd/systemd/issues/1397
Zbigniew Jędrzejewski-Szmek [Sun, 29 Nov 2015 23:37:01 +0000 (18:37 -0500)]
tmpfiles: also set acls on /var/log/journal
This way, directories created later for containers or for
journald-remote, will be readable by adm & wheel groups by default,
similarly to /var/log/journal/%m itself.
https://github.com/systemd/systemd/issues/1971
Ronny Chevalier [Sun, 29 Nov 2015 14:43:02 +0000 (15:43 +0100)]
Merge pull request #2058 from phomes/unused-variable2
tree-wide: remove unused variables
Thomas Hindoe Paaboel Andersen [Sun, 29 Nov 2015 07:58:31 +0000 (08:58 +0100)]
tree-wide: remove unused variables
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 23:41:08 +0000 (18:41 -0500)]
acl-util: only set the mask if not present
When we have non-owner user or group entries, we need the mask
for the acl to be valid. But acl_calc_mask() calculates the mask
to include all permissions, even those that were masked before.
Apparently this happens when we inherit *:r-x permissions from
a parent directory — the kernel sets *:r-x, mask:r--, effectively
masking the executable bit. acl_calc_mask() would set the mask:r-x,
effectively enabling the bit. To avoid this, be more conservative when
to add the mask entry: first iterate over all entries, and do nothing
if a mask.
This returns the code closer to J.A.Steffens' original version
in v204-90-g23ad4dd884.
Should fix https://github.com/systemd/systemd/issues/1977.
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 05:04:40 +0000 (00:04 -0500)]
test-acl-util: add new test
For now, only add_acls_for_user is tested. When run under root, it
actually sets the acls. When run under non-root, it sets the acls for
the user, which does nothing, but at least calls the functions.
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 03:24:33 +0000 (22:24 -0500)]
journal: move the gist of server_fix_perms to acl-util.[hc]
Most of the function is moved to acl-util.c to make it possible to
add tests in subsequent commit.
Setting of the mode in server_fix_perms is removed:
- we either just created the file ourselves, and the permission be better right,
- or the file was already there, and we should not modify the permissions.
server_fix_perms is renamed to server_fix_acls to better reflect new
meaning, and made static because it is only used in one file.
Lennart Poettering [Fri, 27 Nov 2015 19:29:42 +0000 (20:29 +0100)]
libsystemd: make sure we prefix even the dirty secrets in our API with "_sd_"
This renames __useless_struct_to_allow_trailing_semicolon__ everywhere
to _sd_useless_struct_to_allow_trailing_semicolon_, to follow our usual
rule of prefixing stuff from public headers that should be considered
internal with "_sd_".
While we are at it, also to be safe: when the struct is used in the C++
protector macros make sure to use two different names depending on
whether it appears in the C++ or C side of things. After all, there
might be compilers that don't consider C++ and C structs the same.
See https://github.com/systemd/systemd/pull/2052#discussion_r46067059
Lennart Poettering [Fri, 27 Nov 2015 19:22:56 +0000 (20:22 +0100)]
selinux: split up mac_selinux_have() from mac_selinux_use()
Let's distuingish the cases where our code takes an active role in
selinux management, or just passively reports whatever selinux
properties are set.
mac_selinux_have() now checks whether selinux is around for the passive
stuff, and mac_selinux_use() for the active stuff. The latter checks the
former, plus also checks UID == 0, under the assumption that only when
we run priviliged selinux management really makes sense.
Fixes: #1941
David Herrmann [Fri, 27 Nov 2015 19:26:33 +0000 (20:26 +0100)]
Merge pull request #2052 from poettering/export-cleanup
Make gcc cleanup helper calls public in most of our sd-xyz APIs
Lennart Poettering [Fri, 27 Nov 2015 18:29:04 +0000 (19:29 +0100)]
Merge pull request #2043 from teg/resolved-edns0-5
resolved: add edns0 support
Lennart Poettering [Fri, 27 Nov 2015 18:22:35 +0000 (19:22 +0100)]
resolved: add one more comment with a link to the matching RFC
Lennart Poettering [Fri, 27 Nov 2015 18:21:15 +0000 (19:21 +0100)]
util-lib: move nss-util.h from shared/ to basic/
The header file defines some helpers for GLIBC NSS and doesn't include
anything else but glibc headers, hence there's little reason to keep it
in shared/.
See: #2008
Lennart Poettering [Fri, 27 Nov 2015 18:13:45 +0000 (19:13 +0100)]
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.
With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.
The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).
This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.
Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:
#define _cleanup_(function) __attribute__((cleanup(function)))
Or similar, to make the gcc feature easier to use.
Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.
See #2008.
Daniel Mack [Fri, 27 Nov 2015 14:26:21 +0000 (15:26 +0100)]
Merge pull request #2049 from evverx/journal-test-dont-run-on-incomplete-setup
tests: don't run test on incomplete setup; use sync
Evgeny Vereshchagin [Fri, 27 Nov 2015 13:55:23 +0000 (13:55 +0000)]
tests: use sync instead of flush
flush doesn't sync a journal -> tests sometimes fail
Daniel Mack [Fri, 27 Nov 2015 13:35:56 +0000 (14:35 +0100)]
Merge pull request #2048 from poettering/fork-errno
core:execute: fix fork() fail handling in exec_spawn()
Evgeny Vereshchagin [Fri, 27 Nov 2015 13:29:51 +0000 (13:29 +0000)]
tests: don't run test on incomplete setup
This is a follow-up commit for
https://github.com/systemd/systemd/pull/1937
See https://github.com/systemd/systemd/pull/2030
lc85446 [Thu, 26 Nov 2015 03:46:40 +0000 (11:46 +0800)]
core:execute: fix fork() fail handling in exec_spawn()
If pid < 0 after fork(), 0 is always returned because r =
exec_context_load_environment() has exited successfully.
This will make the caller of exec_spawn() not able to handle
the fork() error case and make systemd abort assert() possibly.
Lennart Poettering [Fri, 27 Nov 2015 13:06:36 +0000 (14:06 +0100)]
Merge pull request #1833 from utezduyar/drop-warning-on-preset
drop warning if setting preset worked anyways
Lennart Poettering [Fri, 27 Nov 2015 13:03:49 +0000 (14:03 +0100)]
Merge pull request #1937 from evverx/fix-stdout-parsing
Fix stdout stream parsing
Lennart Poettering [Fri, 27 Nov 2015 13:02:25 +0000 (14:02 +0100)]
Merge pull request #2017 from haraldh/nobinddevice2
core: Do not bind a mount unit to a device, if it was from mountinfo
Lennart Poettering [Fri, 27 Nov 2015 13:00:57 +0000 (14:00 +0100)]
Merge pull request #1828 from fbuihuu/set-property-on-inactive-unit
core: allow 'SetUnitProperties()' to run on inactive units too
Lennart Poettering [Fri, 27 Nov 2015 12:52:43 +0000 (13:52 +0100)]
Merge pull request #1989 from keszybz/filetriggers-v2
Return of the file triggers
Lennart Poettering [Fri, 27 Nov 2015 12:48:12 +0000 (13:48 +0100)]
Merge pull request #2040 from keszybz/randomized-delay
core: rename Random* to RandomizedDelay*
Daniel Mack [Fri, 27 Nov 2015 11:45:04 +0000 (12:45 +0100)]
Merge pull request #2046 from evverx/rlimit-parsing
Fix rlimit parsing
Evgeny Vereshchagin [Fri, 27 Nov 2015 09:13:35 +0000 (09:13 +0000)]
core: dump rlim_cur too
Evgeny Vereshchagin [Fri, 27 Nov 2015 08:54:42 +0000 (08:54 +0000)]
core: fix rlimit parsing
* refuse limits if soft > hard
* print an actual value instead of (null)
see https://github.com/systemd/systemd/pull/1994#issuecomment-
159999123
Daniel Mack [Fri, 27 Nov 2015 11:22:12 +0000 (12:22 +0100)]
Merge pull request #2030 from evverx/dont-run-tests-on-incomplete-setup
tests: don't run tests on incomplete setup
David Herrmann [Fri, 27 Nov 2015 09:35:34 +0000 (10:35 +0100)]
Merge pull request #2044 from grawity/patch-1
resolved: fix typo in in_addr_is_localhost()
Martin Pitt [Fri, 27 Nov 2015 09:20:18 +0000 (10:20 +0100)]
Merge pull request #2029 from teg/network-fixes
Network fixes
Mantas Mikulėnas [Fri, 27 Nov 2015 06:36:37 +0000 (08:36 +0200)]
resolved: fix typo in in_addr_is_localhost()
Zbigniew Jędrzejewski-Szmek [Fri, 27 Nov 2015 02:24:08 +0000 (21:24 -0500)]
Merge commit 'pr/2036^^'
Tom Gundersen [Mon, 6 Jul 2015 14:48:24 +0000 (16:48 +0200)]
resolved: announce support for large UDP packets
This is often needed for proper DNSSEC support, and even to handle AAAA records
without falling back to TCP.
If the path between the client and server is fully compliant, this should always
work, however, that is not the case, and overlarge packets will get mysteriously
lost in some cases.
For that reason, we use a similar fallback mechanism as we do for palin EDNS0,
EDNS0+DO, etc.:
The large UDP size feature is different from the other supported feature, as we
cannot simply verify that it works based on receiving a reply (as the server
will usually send us much smaller packets than what we claim to support, so
simply receiving a reply does not mean much).
For that reason, we keep track of the largest UDP packet we ever received, as this
is the smallest known good size (defaulting to the standard 512 bytes). If
announcing the default large size of 4096 fails (in the same way as the other
features), we fall back to the known good size. The same logic of retrying after a
grace-period applies.
Tom Gundersen [Wed, 24 Jun 2015 13:08:40 +0000 (15:08 +0200)]
resolved: set the DNSSEC OK (DO) flag
This indicates that we can handle DNSSEC records (per RFC3225), even if
all we do is silently drop them. This feature requires EDNS0 support.
As we do not yet support larger UDP packets, this feature increases the
risk of getting truncated packets.
Similarly to how we fall back to plain UDP if EDNS0 fails, we will fall
back to plain EDNS0 if EDNS0+DO fails (with the same logic of remembering
success and retrying after a grace period after failure).
Tom Gundersen [Tue, 23 Jun 2015 21:06:09 +0000 (23:06 +0200)]
resolved: implement minimal EDNS0 support
This is a minimal implementation of RFC6891. Only default values
are used, so in reality this will be a noop.
EDNS0 support is dependent on the current server's feature level,
so appending the OPT pseudo RR is done when the packet is emitted,
rather than when it is assembled. To handle different feature
levels on retransmission, we strip off the OPT RR again after
sending the packet.
Similarly, to how we fall back to TCP if UDP fails, we fall back
to plain UDP if EDNS0 fails (but if EDNS0 ever succeeded we never
fall back again, and after a timeout we will retry EDNS0).
Tom Gundersen [Sun, 12 Jul 2015 23:51:03 +0000 (01:51 +0200)]
resolved: rr - add OPT pseudo-rr support
Needed for EDNS0.
Tom Gundersen [Thu, 16 Jul 2015 12:39:55 +0000 (14:39 +0200)]
resolved: degrade the feature level on explicit failure
Previously, we would only degrade on packet loss, but when adding EDNS0 support,
we also have to handle the case where the server replies with an explicit error.
Tom Gundersen [Mon, 6 Jul 2015 06:15:25 +0000 (08:15 +0200)]
resolved: fallback to TCP if UDP fails
This is inspired by the logic in BIND [0], follow-up patches
will implement the reset of that scheme.
If we get a server error back, or if after several attempts we don't
get a reply at all, we switch from UDP to TCP for the given
server for the current and all subsequent requests. However, if
we ever successfully received a reply over UDP, we never fall
back to TCP, and once a grace-period has passed, we try to upgrade
again to using UDP. The grace-period starts off at five minutes
after the current feature level was verified and then grows
exponentially to six hours. This is to mitigate problems due
to temporary lack of network connectivity, but at the same time
avoid flooding the network with retries when the feature attempted
feature level genuinely does not work.
Note that UDP is likely much more commonly supported than TCP,
but depending on the path between the client and the server, we
may have more luck with TCP in case something is wrong. We really
do prefer UDP though, as that is much more lightweight, that is
why TCP is only the last resort.
[0]: <https://kb.isc.org/article/AA-01219/0/Refinements-to-EDNS-fallback-behavior-can-cause-different-outcomes-in-Recursive-Servers.html>
Tom Gundersen [Fri, 27 Nov 2015 00:18:38 +0000 (01:18 +0100)]
Merge pull request #2042 from poettering/resolved-various-3
resolved: Flush caches more agressively, fixes #2038
Lennart Poettering [Thu, 26 Nov 2015 23:46:21 +0000 (00:46 +0100)]
update TODO
Lennart Poettering [Thu, 26 Nov 2015 23:41:32 +0000 (00:41 +0100)]
resolved: never cache RRs originating from localhost
After all, this is likely a local DNS forwarder that caches anyway,
hence there's no point in caching twice.
Fixes #2038.
Lennart Poettering [Thu, 26 Nov 2015 23:23:32 +0000 (00:23 +0100)]
resolved: flush the global DNS cache if /etc/resolv.conf is touched
After all /etc/resolv.conf is usually done when the network
configuration changes, which is a good reason to flush the global cache.
See: #2038
Lennart Poettering [Thu, 26 Nov 2015 23:15:28 +0000 (00:15 +0100)]
resolved: don't clear the server list too eagerly
If /etc/resolv.conf is missing, this should not result in the server
list to be cleared, after all the native data from resolved.conf
shouldn't be flushed out then. Hence flush out the data only if
/etc/resolv.conf exists, but we cannot read it for some reason.
Tom Gundersen [Thu, 26 Nov 2015 23:42:56 +0000 (00:42 +0100)]
Merge pull request #2041 from poettering/resolved-various-2
various smaller fixes, plus one that makes the build succeed again
Lennart Poettering [Thu, 26 Nov 2015 23:10:29 +0000 (00:10 +0100)]
resolved: fix build
Lennart Poettering [Thu, 26 Nov 2015 23:06:19 +0000 (00:06 +0100)]
resolved: don't follow the global search list on local scopes
It probably doesn't make sense to mix local and global configuration.
Applying global search lists to local DNS servers appears unnecessary
and creates problems because we'll traverse the search domains
non-simultaneously on multiple scopes.
Also see:
https://github.com/systemd/systemd/pull/2031
Lennart Poettering [Thu, 26 Nov 2015 22:51:59 +0000 (23:51 +0100)]
resolved: handle properly if there are multiple transactions for the same key per scope
When the zone probing code looks for a transaction to reuse it will
refuse to look at transactions that have been answered from cache or the
zone itself, but insist on the network. This has the effect that there
might be multiple transactions around for the same key on the same
scope. Previously we'd track all transactions in a hashmap, indexed by
the key, which implied that there would be only one transaction per key,
per scope. With this change the hashmap will only store the most recent
transaction per key, and a linked list will be used to track all
transactions per scope, allowing multiple per-key per-scope.
Note that the linked list fields for this actually already existed in
the DnsTransaction structure, but were previously unused.
Lennart Poettering [Thu, 26 Nov 2015 22:33:55 +0000 (23:33 +0100)]
resolved: for a transaction, keep track where the answer data came from
Let's track where the data came from: from the network, the cache or the
local zone. This is not only useful for debugging purposes, but is also
useful when the zone probing wants to ensure it's not reusing
transactions that were answered from the cache or the zone itself.
Lennart Poettering [Thu, 26 Nov 2015 21:51:35 +0000 (22:51 +0100)]
resolved: store just the DnsAnswer instead of a DnsPacket as answer in DnsTransaction objects
Previously we'd only store the DnsPacket in the DnsTransaction, and the
DnsQuery would then take the DnsPacket's DnsAnswer and return it. With
this change we already pull the DnsAnswer out inside the transaction.
We still store the DnsPacket in the transaction, if we have it, since we
still need to determine from which peer a response originates, to
implement caching properly. However, the DnsQuery logic doesn't care
anymore for the packet, it now only looks at answers and rcodes from the
successfuly candidate.
This also has the benefit of unifying how we propagate incoming packets,
data from the local zone or the local cache.
Lennart Poettering [Thu, 26 Nov 2015 21:45:42 +0000 (22:45 +0100)]
resolved: change query flag definitions
Let's use a more useful way to write the flags. Also, leave some space
in the middle for the mDNS flags. After all, these flags are exposed on
the bus, and we should really make sure to expose flags that are going
to be stable, hence allow some room here...
(Not that the room really mattered, except to be nice to one's OCD)
Tom Gundersen [Thu, 26 Nov 2015 22:58:45 +0000 (23:58 +0100)]
Merge pull request #2031 from poettering/resolved-search-domains
resolved. Fully implement search domains for single-label names
Zbigniew Jędrzejewski-Szmek [Thu, 26 Nov 2015 21:44:59 +0000 (16:44 -0500)]
man: remove repeated words in description of RandomizedDelay
Zbigniew Jędrzejewski-Szmek [Thu, 26 Nov 2015 21:32:41 +0000 (16:32 -0500)]
core: rename Random* to RandomizedDelay*
The name RandomSec is too generic: "Sec" just specifies the default
unit type, and "Random" by itself is not enough. Rename to something
that should give the user general idea what the setting does without
looking at documentation.
Lennart Poettering [Thu, 26 Nov 2015 12:17:25 +0000 (13:17 +0100)]
Merge pull request #1994 from karelzak/rlimits
core: support <soft:hard> ranges for RLIMIT options
Lennart Poettering [Thu, 26 Nov 2015 12:09:56 +0000 (13:09 +0100)]
Merge pull request #2022 from alkino/master
man: Add a not that mount unit cannot be templated
Daniel Mack [Thu, 26 Nov 2015 09:56:42 +0000 (10:56 +0100)]
Merge pull request #2034 from teg/resolved-fix
minor resolved fixes
Daniel Mack [Thu, 26 Nov 2015 09:55:29 +0000 (10:55 +0100)]
Merge pull request #2035 from evverx/man-fix-io-revents
man: fix function name
Evgeny Vereshchagin [Thu, 26 Nov 2015 07:54:08 +0000 (07:54 +0000)]
man: fix function name