Commit Graph

34139 Commits

Author SHA1 Message Date
Lennart Poettering c086ce8c2e NEWS: announce DNS-over-TLS too 2018-06-13 14:39:53 +09:00
Yu Watanabe 87cbe069e6 man: drop unnecessary '=' after nta 2018-06-13 14:34:26 +09:00
Yu Watanabe 92936883d5 resolvectl: fix indentation 2018-06-13 14:30:51 +09:00
Yu Watanabe ba0c011eee timesync: add more log messages in manager_network_read_link_servers() 2018-06-13 14:05:26 +09:00
Yu Watanabe dcb37458cb timesync: check validity of NTP server name or address 2018-06-13 13:51:17 +09:00
Yu Watanabe 8e7b5bd047 conf-parser: simplify conf_parse_path()
Follow-up for 97651797e83d0548aef9f808657d3518d89e5aee.
2018-06-13 13:50:35 +09:00
Yu Watanabe daab72ea44 resolve: do not complete stream transaction when it is under retrying 2018-06-13 13:43:36 +09:00
Yu Watanabe 3da3cdd592 resolve: drop unused argument of dns_server_packet_lost() 2018-06-13 13:20:23 +09:00
Yu Watanabe eab39da1fa resolve: correctly count TCP transaction failures
Fixes #9281.
2018-06-13 13:13:40 +09:00
Yu Watanabe 3c0dcbcf4f resolve: fix log message 2018-06-13 12:21:54 +09:00
Yu Watanabe 1a363edad1 bash-completion/resolvectl: support privatedns command 2018-06-13 11:16:26 +09:00
Yu Watanabe ddf1a95301 resolve: reject PrivateDNS=yes 2018-06-13 11:00:52 +09:00
Yu Watanabe 8adbd86586 resolve: make manager_get_private_dns_mode() always return valid setting 2018-06-13 11:00:28 +09:00
Yu Watanabe b761a10797 resolve: add missing bus property and method
Follow-up for #8849.
2018-06-13 10:50:34 +09:00
Matthias-Christian Ott dbc4661a2c resolve: do not derive query timeout from RTT
DNS queries need timeout values to detect whether a DNS server is
unresponsive or, if the query is sent over UDP, whether a DNS message
was lost and has to be resent. The total time that it takes to answer a
query to arrive is t + RTT, where t is the maximum time that the DNS
server that is being queried needs to answer the query.

An authoritative server stores a copy of the zone that it serves in main
memory or secondary storage, so t is very small and therefore the time
that it takes to answer a query is almost entirely determined by the
RTT. Modern authoritative server software keeps its zones in main memory
and, for example, Knot DNS and NSD are able to answer in less than
100 µs [1]. So iterative resolvers continuously measure the RTT to
optimize their query timeouts and to resend queries more quickly if they
are lost.

systemd-resolved is a stub resolver: it forwards DNS queries to an
upstream resolver and waits for an answer. So the time that it takes for
systemd-resolved to answer a query is determined by the RTT and the time
that it takes the upstream resolver to answer the query.

It seems common for iterative resolver software to set a total timeout
for the query. Such total timeout subsumes the timeout of all queries
that the iterative has to make to answer a query. For example, BIND
seems to use a default timeout of 10 s.

At the moment systemd-resolved derives its query timeout entirely from
the RTT and does not consider the query timeout of the upstream
resolver. Therefore it often mistakenly degrades the feature set of its
upstream resolvers if it takes them longer than usual to answer a query.
It has been reported to be a considerable problem in practice, in
particular if DNSSEC=yes. So the query timeout systemd-resolved should
be derived from the timeout of the upstream resolved and the RTT to the
upstream resolver.

At the moment systemd-resolved measures the RTT as the time that it
takes the upstream resolver to answer a query. This clearly leads to
incorrect measurements. In order to correctly measure the RTT
systemd-resolved would have to measure RTT separately and continuously,
for example with a query with an empty question section or a query for
the SOA RR of the root zone so that the upstream resolver would be able
to answer to query without querying another server. However, this
requires significant changes to systemd-resolved. So it seems best to
postpone them until other issues have been addressed and to set the
resend timeout to a fixed value for now.

As mentioned, BIND seems to use a timeout of 10 s, so perhaps 12 s is a
reasonable value that also accounts for common RTT values. If we assume
that the we are going to retry, it could be less. So it should be enough
to set the resend timeout to DNS_TIMEOUT_MAX_USEC as
DNS_SERVER_FEATURE_RETRY_ATTEMPTS * DNS_TIMEOUT_MAX_USEC = 15 s.
However, this will not solve the incorrect feature set degradation and
should be seen as a temporary change until systemd-resolved does
probe the feature set of an upstream resolver independently from the
actual queries.

[1] https://www.knot-dns.cz/benchmark/
2018-06-12 23:21:18 +02:00
Lennart Poettering 17ae278097 core: when applying io/blkio per-device rules, don't remove them if they fail
These devices might show up later, hence leave the rules as they are.
Applying the limits should not alter configuration.
2018-06-12 22:52:36 +02:00
Lennart Poettering ef31828d06 tree-wide: unify how we define bit mak enums
Let's always write "1 << 0", "1 << 1" and so on, except where we need
more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force
64bit values.
2018-06-12 21:44:00 +02:00
Lennart Poettering 401e860cb8
Merge pull request #8849 from irtimmer/feature/dns-over-tls
resolve: Support for DNS-over-TLS
2018-06-12 20:45:39 +02:00
Iwan Timmer 30e59c84d7 man: document DNS-over-TLS options 2018-06-12 18:50:30 +02:00
Michael Biebl 1b2ad5d9a5 doc: more spelling fixes 2018-06-12 16:31:30 +02:00
Lennart Poettering c49a7cbd63 update NEWS with new PrivateMounts= blurb 2018-06-12 16:27:37 +02:00
Lennart Poettering b2e8ae7380 units: switch udev service to use PrivateMounts=yes
Given that PrivateMounts=yes is the "successor" to MountFlags=slave in
unit files, let's make use of it for udevd.
2018-06-12 16:27:37 +02:00
Lennart Poettering 2f2e14b251 man: document the new PrivateMounts= setting
Also, extend the documentation on MountFlags= substantially, hopefully
addressing all the questions of #4393

Fixes: #4393
2018-06-12 16:27:37 +02:00
Lennart Poettering 228af36fff core: add new PrivateMounts= unit setting
This new setting is supposed to be useful in most cases where
"MountFlags=slave" is currently used, i.e. as an explicit way to run a
service in its own mount namespace and decouple propagation from all
mounts of the new mount namespace towards the host.

The effect of MountFlags=slave and PrivateMounts=yes is mostly the same,
as both cause a CLONE_NEWNS namespace to be opened, and both will result
in all mounts within it to be mounted MS_SLAVE. The difference is mostly
on the conceptual/philosophical level: configuring the propagation mode
is nothing people should have to think about, in particular as the
matter is not precisely easyto grok. Moreover, MountFlags= allows configuration
of "private" and "slave" modes which don't really make much sense to use
in real-life and are quite confusing. In particular PrivateMounts=private means
mounts made on the host stay pinned for good by the service which is
particularly nasty for removable media mount. And PrivateMounts=shared
is in most ways a NOP when used a alone...

The main technical difference between setting only MountFlags=slave or
only PrivateMounts=yes in a unit file is that the former remounts all
mounts to MS_SLAVE and leaves them there, while that latter remounts
them to MS_SHARED again right after. The latter is generally a nicer
approach, since it disables propagation, while MS_SHARED is afterwards
in effect, which is really nice as that means further namespacing down
the tree will get MS_SHARED logic by default and we unify how
applications see our mounts as we always pass them as MS_SHARED
regardless whether any mount namespacing is used or not.

The effect of PrivateMounts=yes was implied already by all the other
mount namespacing options. With this new option we add an explicit knob
for it, to request it without any other option used as well.

See: #4393
2018-06-12 16:12:10 +02:00
Lennart Poettering f4ea7552c1
Merge pull request #9270 from mbiebl/typo-fixes
NEWS: typo fixes
2018-06-12 16:00:37 +02:00
Michael Biebl e59886007e doc: typo fixes, mostly duplicated words 2018-06-12 15:49:37 +02:00
Michael Biebl bc99dac545 NEWS: typo fixes 2018-06-12 15:41:38 +02:00
Lennart Poettering ceb9d454fe
Merge pull request #9268 from keszybz/news
NEWS followup and a small man addition
2018-06-12 14:58:13 +02:00
Zbigniew Jędrzejewski-Szmek c7f93e282c NEWS: mention "bad-setting" load state and other small additions 2018-06-12 14:06:47 +02:00
Zbigniew Jędrzejewski-Szmek 5cadf58eb8 NEWS, CODE_QUALITY: wording fixes
No additions, just moving stuff around and wording cleanups.
2018-06-12 14:06:13 +02:00
Zbigniew Jędrzejewski-Szmek 74712c9ed9 man: mention that /var/lib/systemd/timesync/clock might have the compilation timestamp
https://bugs.freedesktop.org/show_bug.cgi?id=90085
2018-06-12 13:06:11 +02:00
Lennart Poettering f86fae61ec tree-wide: drop trailing whitespace 2018-06-12 13:05:38 +02:00
Lennart Poettering 8b9e4b2136 doc: extend CODE_QUALITY.md with two more items 2018-06-12 13:05:38 +02:00
Lennart Poettering 41a4c3ec09 prepare an initial NEWS file for v239 2018-06-12 13:05:38 +02:00
Zbigniew Jędrzejewski-Szmek 24d169e092
Merge pull request #9255 from poettering/block-dev-fixes
some block device handling fixes
2018-06-12 12:53:37 +02:00
Iwan Timmer d050561ac3 resolve: make PrivateDNS configurable per link
Like with DNSSec, make PrivateDNS configurable per link, so you can have trusted and untrusted links.
2018-06-11 21:35:58 +02:00
Iwan Timmer 5d67a7ae74 resolved: support for DNS-over-TLS
Add support for DNS-over-TLS using GnuTLS. To reduce latency also TLS False Start and TLS session resumption is supported.
2018-06-11 21:35:58 +02:00
Iwan Timmer 91ccab1e40 resolved: TCP fast open connections
Add suport for TCP fast open connection to reduce latency for successive DNS request over TCP
2018-06-11 21:35:58 +02:00
Michal Sekletar bb3ff70a86 journal: forward messages from /dev/log unmodified to syslog.socket 2018-06-11 21:26:22 +02:00
Iwan Timmer 98767d75d7 resolved: longlived TCP connections
Keep DNS over TCP connection open until it's closed by the server or after a timeout.
2018-06-11 20:17:51 +02:00
Emil Velikov 4ed141166c zsh-completion: systemctl: list template units only as needed
Currently the completion adds template units for commands such as
is-active, is-failed, is-enabled, status, show and others.

At the same time systemctl barfs at us, since an instanced template unit
is needed. Follow the example list from bash-completion as to which
commands should not list template units.

Note: The above is observed regardless of DefaultInstance.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 19:02:36 +01:00
Emil Velikov 9b536b1af2 shell-completion: systemctl: do not list template units in {re,}start
Template units lacking DefaultInstance cannot be enabled/disabled or
started/restarted.

By adding DefaultInstance the unit can be enabled/disabled but it
still cannot be started/restarted.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:15:12 +01:00
Zbigniew Jędrzejewski-Szmek 65be7e0652 pid1: do not reset subtree_control on already-existing units with delegation
Fixes #8364.

Reproducer:
$ sudo systemd-run -t -p Delegate=yes bash
# mkdir /sys/fs/cgroup/system.slice/run-u6958.service/supervisor
# echo $$ > /sys/fs/cgroup/system.slice/run-u6958.service/supervisor/cgroup.procs
# echo +memory > /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
# cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
memory
# systemctl daemon-reload
# cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
(empty)

With patch, the last command shows 'memory'.
2018-06-11 18:12:30 +02:00
Emil Velikov 98476dc8b2 shell-completion: systemctl: pass current word to all list_unit*
Earlier patch added the current word to the performance critical paths.
Here we add it to every place, for consistency sake.

Suggested-by: Yu Watanabe (yuwata)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2018-06-11 17:09:58 +01:00
Emil Velikov 8a6236e51a zsh-completion: systemctl: tweak --state list for startable units
This effectively ports over b1bdb6496c
from the bash completion to zsh.

Modulo the new function, since it's unrelated perf. improvement.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:56 +01:00
Emil Velikov ff728637cc zsh-completion: systemctl: pass only $PREFIX* to list-unit*
Using a leading * and $SUFFIX produces misleading results. Let's imagine
that one mistypes nect instead of netc, they will get a rather
misleading completion like:  sys-fs-fuse-connections.mount

Not to mention that the execution time is up by ~1/3.
time systemctl list-unit-files netctl* -> ~12ms
time systemctl list-unit-files *netctl* -> ~17ms

Furthermore more units are matched, leading to greater execution time
of `systemctl show' in _filter_units_by_property

Use only $PREFIX*, removing the leading * and trailing $SUFFIX*.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:56 +01:00
Emil Velikov c839b729c5 bash-completion: systemctl: pass current partial unit to list-unit*
Pass the partial name of the unit file to list-unit-files and
list-units. This allows for faster completion, since systemctl does
not need to list all the unit files.

For reference:
 - time systemctl list-unit-files -> ~200ms
 - time systemctl list-unit-files netctl* -> ~15ms
 - time systemctl list-units -> ~5ms
 - time systemctl list-units netctl* -> ~5ms

While the list-units time itself is unaffected, now a shorter list is
produced. Thus as we pass it to `systemctl show' (via
__filter_units_by_properties) the execution time will be decreased even
further.

v2: Update list-units hunk in commit message, add quotes around $2*
v3: Remove funky indentation, quote all $cur instances

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:55 +01:00
Emil Velikov aedd48160f bash-completion: systemctl: use systemctl --no-pager
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:53 +01:00
Lennart Poettering bae47ba7d2 tree-wide: use PATH_STARTSWITH_SET() at two more places 2018-06-11 18:01:06 +02:00
Lennart Poettering 57e84e7535 core: rework how we validate DeviceAllow= settings
Let's make sure we don't validate "char-*" and "block-*" expressions as
paths.
2018-06-11 18:01:06 +02:00