platform/upstream/systemd.git
6 years agoMerge pull request #7625 from thom311/th/const-strlen
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 08:41:09 +0000 (09:41 +0100)]
Merge pull request #7625 from thom311/th/const-strlen

Don't use strlen() to declare variable-length arrays

6 years agonetworkd: RouteTable option in [IPv6AcceptRA] is now properly processed (#7633)
Saran Tunyasuvunakool [Thu, 14 Dec 2017 05:11:03 +0000 (05:11 +0000)]
networkd: RouteTable option in [IPv6AcceptRA] is now properly processed (#7633)

Fixes: #7632

6 years agoresolved: fix "in-between" logic when boundaries are equal (#7590)
Lennart Poettering [Thu, 14 Dec 2017 05:08:21 +0000 (06:08 +0100)]
resolved: fix "in-between" logic when boundaries are equal (#7590)

This changes dns_name_between() to deal properly with checking whether B
is between A and C if A and C are equal. Previously we simply returned
-EINVAL in this case, refusing checking. With this change we correct
behaviour: if A and C are equal, then B is "between" both if it is
different from them. That's logical, since we do < and > comparisons, not
<= and >=, and that means that anything "right of A" and "left of C"
lies in between with wrap-around at the ends. And if A and C are equal
that means everything lies between, except for A itself.

This fixes handling of domains using NSEC3 "white lies", for example the
.it TLD.

Fixes: #7421

6 years agoMerge pull request #7618 from tiagosh/sysctl_use_read_line
Yu Watanabe [Thu, 14 Dec 2017 04:58:53 +0000 (13:58 +0900)]
Merge pull request #7618 from tiagosh/sysctl_use_read_line

Make systemd-sysctl use read_line() and LONG_LINE_MAX

6 years agoman: systemd.unit: move note about clearing lists (#7621)
Daniel Black [Thu, 14 Dec 2017 04:51:23 +0000 (15:51 +1100)]
man: systemd.unit: move note about clearing lists (#7621)

This is mainly for drop-in files.

6 years agoMerge pull request #7627 from poettering/lowercase-systemd
Yu Watanabe [Thu, 14 Dec 2017 04:44:35 +0000 (13:44 +0900)]
Merge pull request #7627 from poettering/lowercase-systemd

always spell out "systemd" in lowercase letters

6 years agosysctl: disable buffer while writing to /proc
Tiago Salem Herrmann [Tue, 12 Dec 2017 15:52:45 +0000 (13:52 -0200)]
sysctl: disable buffer while writing to /proc

fputs() writes only first 2048 bytes and fails
to write to /proc when values are larger than that.
This patch adds a new flag to WriteStringFileFlags
that make it possible to disable the buffer under
specific cases.

6 years agoUse read_line() and LONG_LINE_MAX to read values configuration files.
Tiago Salem Herrmann [Tue, 12 Dec 2017 15:43:17 +0000 (13:43 -0200)]
Use read_line() and LONG_LINE_MAX to read values configuration files.

6 years agonetworkd/dhcp: shorten overlong hostname (#7616)
Luca Bruno [Wed, 13 Dec 2017 17:00:46 +0000 (17:00 +0000)]
networkd/dhcp: shorten overlong hostname (#7616)

This commit updates networkd behavior to check if the hostname option
received via DHCP is too long for Linux limit, and in case shorten it.
An overlong hostname will be truncated to the first dot or to
`HOST_MAX_LEN`, whatever comes earlier.

6 years agocatalog: don't say "systemd" when we mean "system"
Lennart Poettering [Wed, 13 Dec 2017 16:43:03 +0000 (17:43 +0100)]
catalog: don't say "systemd" when we mean "system"

Yeah, it's hard to type "system", if all you ever type is "systemd", but
it's still a typo in this case.

6 years agoman: "systemd" is to be written in all lower-case, even at beginnings of sentences
Lennart Poettering [Wed, 13 Dec 2017 16:42:04 +0000 (17:42 +0100)]
man: "systemd" is to be written in all lower-case, even at beginnings of sentences

This very important commit is very important.

6 years agoMerge pull request #7619 from msekletar/cryptsetup-image-name
Lennart Poettering [Wed, 13 Dec 2017 15:46:57 +0000 (16:46 +0100)]
Merge pull request #7619 from msekletar/cryptsetup-image-name

cryptsetup: when unlocking always put path to the object into Id

6 years agotree-wide: use STRLEN() to allocate buffer of constant size
Thomas Haller [Wed, 13 Dec 2017 07:41:11 +0000 (08:41 +0100)]
tree-wide: use STRLEN() to allocate buffer of constant size

Using strlen() to declare a buffer results in a variable-length array,
even if the compiler likely optimizes it to be a compile time constant.

When building with -Wvla, certain versions of gcc complain about such
buffers. Compiling with -Wvla has the advantage of preventing variably
length array, which defeat static asserts that are implemented by
declaring an array of negative length.

6 years agobasic/macros: add STRLEN() to get length of string literal as constant expression
Thomas Haller [Wed, 13 Dec 2017 07:17:07 +0000 (08:17 +0100)]
basic/macros: add STRLEN() to get length of string literal as constant expression

While the compiler likely optimizes strlen(x) for string literals,
it is not a constant expression.

Hence,

  char buffer[strlen("OPTION_000") + 1];

declares a variable-length array. STRLEN() can be used instead
when a constant espression is needed.

It's not entirely identical to strlen(), as STRLEN("a\0") counts 2.
Also, it only works with string literals and the macro enforces
that the argument is a literal.

6 years agonetworkd: don't try to configure IPv6 proxy NDP if IPv6 is not available (#7613)
Lennart Poettering [Wed, 13 Dec 2017 04:47:10 +0000 (05:47 +0100)]
networkd: don't try to configure IPv6 proxy NDP if IPv6 is not available (#7613)

Fixes: #7612

6 years agoMerge pull request #7588 from poettering/resolve-route-tweak
Yu Watanabe [Wed, 13 Dec 2017 04:43:55 +0000 (13:43 +0900)]
Merge pull request #7588 from poettering/resolve-route-tweak

resolved domain routing tweaks and /etc/resolv.conf handling improvements

6 years agoMerge pull request #7569 from keszybz/doc-reverse-settings
Yu Watanabe [Wed, 13 Dec 2017 04:42:19 +0000 (13:42 +0900)]
Merge pull request #7569 from keszybz/doc-reverse-settings

Document reverse settings

6 years agoMerge pull request #7591 from poettering/retry-on-servfail
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 21:22:06 +0000 (22:22 +0100)]
Merge pull request #7591 from poettering/retry-on-servfail

resolved: retry with a different server on SERVFAIL

6 years agoMerge pull request #7611 from poettering/bootspec-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 21:16:34 +0000 (22:16 +0100)]
Merge pull request #7611 from poettering/bootspec-fixes

minor fixes to bootctl.c/bootspec.c to make sure the tool works cleanly on my system

6 years agoMerge pull request #7608 from poettering/more-news-v236
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 20:11:31 +0000 (21:11 +0100)]
Merge pull request #7608 from poettering/more-news-v236

6 years agocryptsetup: use more descriptive name for the variable and drop redundant function
Michal Sekletar [Tue, 12 Dec 2017 19:00:31 +0000 (20:00 +0100)]
cryptsetup: use more descriptive name for the variable and drop redundant function

Let's rename escaped_name to disk_path since this is an actual content
that pointer refers to. It is either path to encrypted block device
or path to encrypted image file.

Also drop redundant function disk_major_minor(). src is always set, and
it always points to either encrypted block device path (or symlink to
such device) or to encrypted image. In case it is set to device path
there is no need to reset it to /dev/block/major:minor symlink since
those paths are equivalent.

6 years agomeson: link NSS modules with -z nodelete (#7607)
Lennart Poettering [Tue, 12 Dec 2017 19:13:16 +0000 (20:13 +0100)]
meson: link NSS modules with -z nodelete (#7607)

We might end up allocating mempools, and when we are unloaded we might
orphan them, thus leaking them. Hence, let's just stick around for good,
so the mempools remain referenced continously and for good, and thus no
memory is leaked (though the memory isn't cleaned up either).

Fixes: #7596

6 years agocryptsetup: when unlocking always put path to the object into Id
Michal Sekletar [Tue, 12 Dec 2017 16:49:14 +0000 (17:49 +0100)]
cryptsetup: when unlocking always put path to the object into Id

Some ask-password agents (e.g. clevis-luks-askpass) use Id option from
/run/systemd/ask-password/ask* file in order to obtain the password for
the device.

Id option should be in the following format,
e.g. Id=subsystem:data. Where data part is supposed to identify object
that ask-password query is done for. Since
e51b9486d1b59e72c293028fed1384f4e4ef09aa this field has format
Id=cryptsetup:/dev/block/major:minor when systemd-cryptsetup is
unlocking encrypted block device. However, crypttab also supports
encrypted image files in which case we usually set data part of Id to
"vol on mountpoint". This is unexpected and actually breaks network
based device encryption as implemented by clevis.

Example:
$ cat /etc/crypttab
clevis-unlocked /clevis-test-disk-image none luks,_netdev
$ systemctl start 'systemd-cryptsetup@clevis\x2dunlocked.service'
$ grep Id /run/systemd/ask-password/ask*

Before:
$ Id=cryptsetup:clevis-unlocked on /clevis-test-disk-image-mnt

After:
$ Id=cryptsetup:/clevis-test-disk-image

6 years agoresolve: add support for RFC 8080 (#7600)
ott [Tue, 12 Dec 2017 15:30:12 +0000 (16:30 +0100)]
resolve: add support for RFC 8080 (#7600)

RFC 8080 describes how to use EdDSA keys and signatures in DNSSEC. It
uses the curves Ed25519 and Ed448. Libgcrypt 1.8.1 does not support
Ed448, so only the Ed25519 is supported at the moment. Once Libgcrypt
supports Ed448, support for it can be trivially added to resolve.

6 years agonetworkd: Fix race condition in [RoutingPolicyRule] handling (#7615)
Saran Tunyasuvunakool [Tue, 12 Dec 2017 15:25:36 +0000 (15:25 +0000)]
networkd: Fix race condition in [RoutingPolicyRule] handling (#7615)

The routing policy rule setup logic is moved to the routes setup phase (rather than the addresses setup phase as it is now). Additionally, a call to `link_check_ready` is added to the routing policy rules setup handler. This prevents a race condition with the routes setup handler.

Also give each async handler its own message counter to prevent race conditions when logging successes.

Fixes: #7614

6 years agoresolved: try a different server if server is too dumb to do DNSSEC
Lennart Poettering [Fri, 8 Dec 2017 19:11:36 +0000 (20:11 +0100)]
resolved: try a different server if server is too dumb to do DNSSEC

If we are in strict DNSSEC mode it's worthy to try a different DNS
server before accepting that DNSSEC is not actually supported.

Fixes: #7040

6 years agoresolved: cast dns_scope_get_dns_server() to NULL when we ignore it
Lennart Poettering [Fri, 8 Dec 2017 18:50:51 +0000 (19:50 +0100)]
resolved: cast dns_scope_get_dns_server() to NULL when we ignore it

6 years agoresolved: when a server consistently returns SERVFAIL, try another one
Lennart Poettering [Fri, 8 Dec 2017 18:48:15 +0000 (19:48 +0100)]
resolved: when a server consistently returns SERVFAIL, try another one

Currently, we accept SERVFAIL after downgrading fully, cache it and move
on. Let's extend this a bit: after downgrading fully, if the SERVFAIL
logic continues to be an issue, then use a different DNS server if there
are any.

Fixes: #7147

6 years agoverbs: add a new VERB_MUSTBEROOT flag
Lennart Poettering [Mon, 11 Dec 2017 22:10:11 +0000 (23:10 +0100)]
verbs: add a new VERB_MUSTBEROOT flag

Given that we regularly have verbs that require privileges, let's just
make this a flag of the verb.

6 years agotree-wide: unify logging of "Must be root" message
Lennart Poettering [Mon, 11 Dec 2017 22:00:57 +0000 (23:00 +0100)]
tree-wide: unify logging of "Must be root" message

Let's unify this in one call, generalizing must_be_root() from
bootctl.c.

6 years agobootspec: sprinkle some argument assert()s all over the place
Lennart Poettering [Mon, 11 Dec 2017 21:22:04 +0000 (22:22 +0100)]
bootspec: sprinkle some argument assert()s all over the place

The previous commit fixed a NULL parameter issue, let's check for such,
to make it easier to find issues like this.

6 years agobootctl: don't trip up in "bootctl status" when we can't find the ESP because of...
Lennart Poettering [Mon, 11 Dec 2017 21:15:03 +0000 (22:15 +0100)]
bootctl: don't trip up in "bootctl status" when we can't find the ESP because of lack of privilges

On my system the boot and EFI partitions are protected, hence "bootctl
status" can't find the ESP, and then the tool continues with arg_path ==
NULL, which it really should not. Handle these cases, and simply
suppress all output that needs arg_path.

6 years agoefi: rework find_esp() error propagation/logging a bit
Lennart Poettering [Mon, 11 Dec 2017 21:04:46 +0000 (22:04 +0100)]
efi: rework find_esp() error propagation/logging a bit

This renames find_esp() to find_esp_and_warn() and tries to normalize its
behaviour:

1. Change the error that is returned when we can't find the ESP to
   ENOKEY (from ENOENT). This way the error code can only mean one
   thing: that our search loop didn't find a good candidate.
2. Really log about all errors, except for ENOKEY and EACCES, and
   document the letter cases.
3. Normalize parameters to the call: separate out the path parameter in
   two: an input path and an output path. That way the memory management
   is clear: we will access the input parameter only for reading, and
   only write out the output parameter, using malloc() memory.
   Before the calling convention were quire surprising for internal API
   code, as the path parameter had to be malloc() memory and might and
   might not have changed.
4. Rename bootctl's find_esp_warn() to acquire_esp(), and make it a
   simple wrapper around find_esp_warn(), that basically just adds the
   friendly logging for the ENOKEY case. This rework removes double
   logging in a number of error cases, as we no longer log here in
   anything but ENOKEY, and leave that entirely to find_esp_warn().
5. find_esp_and_warn() now takes a bool flag parameter
   "unprivileged_mode", which disables logging in the EACCES case, and
   skips privileged validation of the path. This makes the function less
   magic, and doesn't hide this internal silencing automatism from the
   caller anymore.

With all that in place "bootctl list" and "bootctl status" work properly
(or as good as they can) when I invoke the tools whithout privileges on
my system where /boot is not world-readable

6 years agoNEWS: more updates for v236
Lennart Poettering [Fri, 8 Dec 2017 21:25:49 +0000 (22:25 +0100)]
NEWS: more updates for v236

6 years agomailmap: add more names from the v236 cycle
Lennart Poettering [Mon, 11 Dec 2017 12:30:19 +0000 (13:30 +0100)]
mailmap: add more names from the v236 cycle

Let's clean up after github's "squash" feature…

6 years agotree-wide: drop a few == NULL and != NULL comparison
Lennart Poettering [Fri, 8 Dec 2017 19:52:38 +0000 (20:52 +0100)]
tree-wide: drop a few == NULL and != NULL comparison

Our CODING_STYLE suggests not comparing with NULL, but relying on C's
downgrade-to-bool feature for that. Fix up some code to match these
guidelines. (This is not comprehensive, the coccinelle output for this
is unfortunately kinda borked)

6 years agoresolved: fix wrong error code (#7601)
Yu Watanabe [Sun, 10 Dec 2017 15:27:19 +0000 (00:27 +0900)]
resolved: fix wrong error code (#7601)

6 years agocore: fix undefined behaviour due to uninitialized string buffer (#7597)
Alan Jenkins [Sun, 10 Dec 2017 10:58:01 +0000 (10:58 +0000)]
core: fix undefined behaviour due to uninitialized string buffer (#7597)

Failure of systemd to respond on the bus interface was bisected to af6b0ecc
"core: make "taint" string logic a bit more generic and output it at boot".

Failure was presumably caused by trying to append strings to an
unintialized buffer, leading to writing outside the unterminated buffer
and hence undefined behaviour.

6 years agoMerge pull request #7352 from eddiejames/master
Lennart Poettering [Fri, 8 Dec 2017 21:22:02 +0000 (22:22 +0100)]
Merge pull request #7352 from eddiejames/master

Add path configuration for hardware watchdog device

6 years agovirt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581)
Olaf Hering [Fri, 8 Dec 2017 21:21:42 +0000 (22:21 +0100)]
virt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581)

The detection of ConditionVirtualisation= relies on the presence of
/proc/xen/capabilities. If the file exists and contains the string
"control_d", the running system is a dom0 and VIRTUALIZATION_NONE should
be set. In case /proc/xen exists, or some sysfs files indicate "xen",
VIRTUALIZATION_XEN should be set to indicate the system is a domU.

With an (old) xenlinux based kernel, /proc/xen/capabilities is always
available and the detection described above works always. But with a
pvops based kernel, xenfs must be mounted on /proc/xen to get
"capabilities". This is done by a proc-xen.mount unit, which is part of
xen.git. Since the mounting happens "late", other units may be scheduled
before "proc-xen.mount". If these other units make use of
"ConditionVirtualisation=", the virtualization detection returns
incorect results. detect_vm() will set VIRTUALIZATION_XEN because "xen"
is found in sysfs. This value will be cached. Once xenfs is mounted, the
next process that runs detect_vm() will get VIRTUALIZATION_NONE.

This misdetection can be fixed by using
/sys/hypervisor/properties/features, which exports the value returned by
the "XENVER_get_features" hypercall. If the bit XENFEAT_dom0 is set, the
domain is the "hardware domain". It is supposed to have permissions to
access all hardware. The used sysfs file is available since v2.6.31.

The commonly used term "dom0" refers to the control domain which runs
the toolstack and has access to all hardware. But the virtualization
host may be configured such that one dedicated domain becomes the
"hardware domain", and another one the "toolstack domain".

6 years agoMerge pull request #6993 from rojkov/dnssd
Lennart Poettering [Fri, 8 Dec 2017 21:21:01 +0000 (22:21 +0100)]
Merge pull request #6993 from rojkov/dnssd

Add support for server-side DNS-SD in mDNS zones.

6 years agodocumentation: add description for watchdog device path
Edward A. James [Fri, 8 Dec 2017 17:27:01 +0000 (11:27 -0600)]
documentation: add description for watchdog device path

Document the command line parameter and the system configuration file
setting.

6 years agocore: Add WatchdogDevice config option and implement it
Edward A. James [Fri, 8 Dec 2017 17:26:44 +0000 (11:26 -0600)]
core: Add WatchdogDevice config option and implement it

This option allows a device path to be specified for the systemd
watchdog (both runtime and shutdown).

If a system requires a watchdog other than /dev/watchdog (pointing to
/dev/watchdog0) to be used to reboot the system, this setting should be
changed to the relevant watchdog device path (e.g. /dev/watchdog1).

6 years agowatchdog: allow a device path to be specified
Edward A. James [Fri, 8 Dec 2017 17:26:30 +0000 (11:26 -0600)]
watchdog: allow a device path to be specified

Currently systemd hardcodes the use of /dev/watchdog. This is a legacy
chardev that points to watchdog0 in the system.

Modify the watchdog API to allow a different device path to be passed
and stored. Opening the watchdog defaults to /dev/watchdog, maintaining
existing behavior.

6 years agoshared: use _cleanup_ in specifier_printf (#7586)
Zbigniew Jędrzejewski-Szmek [Fri, 8 Dec 2017 16:28:02 +0000 (17:28 +0100)]
shared: use _cleanup_ in specifier_printf (#7586)

Follow-up for e62d316561.

6 years agoresolved: tweak domain routing logic a bit
Lennart Poettering [Fri, 8 Dec 2017 16:21:42 +0000 (17:21 +0100)]
resolved: tweak domain routing logic a bit

This makes sure that a classic DNS scope that has no DNS servers
assigned is never considered for routing requests to even if it has
matching search/routing domains associated.

This is inspired by #7544, where lookup requests are refused since a
scope with no DNS server is configured. This change does not deliver
what the reporter intended, but is generally useful in general, as it
makes us mor robust to misconfiguration.

6 years agoresolved: synchronize introduction blurbs in all three resolv.conf files we provide
Lennart Poettering [Fri, 8 Dec 2017 16:19:27 +0000 (17:19 +0100)]
resolved: synchronize introduction blurbs in all three resolv.conf files we provide

Let's use the same wording and same contents in all three versions.

6 years agoresolved: beef up logic to detect our own configuration files
Lennart Poettering [Fri, 8 Dec 2017 16:01:47 +0000 (17:01 +0100)]
resolved: beef up logic to detect our own configuration files

Let's also check for the static resolv.conf, so that we filter all three
of our own files out.

6 years agoresolved: don't make defines needlessly public
Lennart Poettering [Fri, 8 Dec 2017 15:55:00 +0000 (16:55 +0100)]
resolved: don't make defines needlessly public

6 years agoresolved: store the mtime of the file we read
Lennart Poettering [Fri, 8 Dec 2017 15:53:36 +0000 (16:53 +0100)]
resolved: store the mtime of the file we read

Let's make sure we use the mtime of the current fstat() data, rather
than the mtime of the old stat(), fixing a theoretical race.

6 years agoresolved: fix a minimal race, when reading /etc/resolv.conf
Lennart Poettering [Fri, 8 Dec 2017 15:51:46 +0000 (16:51 +0100)]
resolved: fix a minimal race, when reading /etc/resolv.conf

The user might replace a foreign /etc/resolv.conf with a symlink to one
of ours between the time we did stat() and open the file. Hence, let's
check the fstat() data right after opening the file, a second time.

6 years agoman: normalize indentation in systemd.unit.xml
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 08:48:59 +0000 (09:48 +0100)]
man: normalize indentation in systemd.unit.xml

6 years agoman: add a table of setting inverses
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 08:47:34 +0000 (09:47 +0100)]
man: add a table of setting inverses

It would be nicer to use <footnote> to place the notes directly in the table,
but docbook renders this improperly.

v2:
- also add "RequiredBy=" to the notes section
- remove duplicated paragraph
v3:
- clarify the description
- drop References/ReferenceBy which are only shown in systemd-analyze dump

6 years agoacl: fix typo in comment (#7580)
Yu Watanabe [Fri, 8 Dec 2017 12:34:25 +0000 (21:34 +0900)]
acl: fix typo in comment (#7580)

6 years agonetworkd: Ignore DNS information when uplink is not managed (#7571)
Patrik Flykt [Fri, 8 Dec 2017 12:33:40 +0000 (14:33 +0200)]
networkd: Ignore DNS information when uplink is not managed (#7571)

When another networking daemon or configuration is handling the
uplink connection, systemd-networkd won't have a network configuration
associated with the link, and therefore link->network will be NULL.
An assert will be triggered later on in the code when link->network is
NULL.

6 years agoresolved: support multiple TXT RRs per DNS-SD service
Dmitry Rozhkov [Wed, 29 Nov 2017 09:03:44 +0000 (11:03 +0200)]
resolved: support multiple TXT RRs per DNS-SD service

Section 6.8 of RFC 6763 allows having service instances with
multiple TXT resource records.

6 years agoresolved: consult Polkit for privileges when manipulating DNS-SD
Dmitry Rozhkov [Wed, 22 Nov 2017 14:49:23 +0000 (16:49 +0200)]
resolved: consult Polkit for privileges when manipulating DNS-SD

6 years agoresolved: resolve possible conflicts for DNS-SD RRs
Dmitry Rozhkov [Tue, 31 Oct 2017 07:47:37 +0000 (09:47 +0200)]
resolved: resolve possible conflicts for DNS-SD RRs

It might happen that a DNS-SD service doesn't include local host's
name in its RR keys and still conflicts with a remote service.

In this case try to resolve the conflict by changing name for
this particular service.

6 years agoresolved: don't check conflicts for DNS-SD enumeration RRs
Dmitry Rozhkov [Fri, 27 Oct 2017 09:16:54 +0000 (12:16 +0300)]
resolved: don't check conflicts for DNS-SD enumeration RRs

6 years agoresolved: add man page for systemd.dnssd
Dmitry Rozhkov [Wed, 4 Oct 2017 12:56:19 +0000 (15:56 +0300)]
resolved: add man page for systemd.dnssd

6 years agoresolved: implement D-Bus API for DNS-SD
Dmitry Rozhkov [Mon, 23 Oct 2017 11:46:13 +0000 (14:46 +0300)]
resolved: implement D-Bus API for DNS-SD

6 years agoresolved: detect and handle mDNS race condition upon probing
Dmitry Rozhkov [Tue, 17 Oct 2017 08:35:06 +0000 (11:35 +0300)]
resolved: detect and handle mDNS race condition upon probing

As discussed in RFC 6762, Section 8.2 a race condition may
happen when two hosts are probing for the same name simultaniously.

Detect and handle such race conditions.

6 years agoresolved: add authority section to mDNS probing queries
Dmitry Rozhkov [Mon, 16 Oct 2017 14:25:17 +0000 (17:25 +0300)]
resolved: add authority section to mDNS probing queries

According to RFC 6762 Section 8.2 "Simultaneous Probe Tiebreaking"
probing queries' Authority Section is populated with proposed
resource records in order to resolve possible race conditions.

6 years agoresolved: set cache-flush bit on mDNS responses
Dmitry Rozhkov [Tue, 31 Oct 2017 08:34:58 +0000 (10:34 +0200)]
resolved: set cache-flush bit on mDNS responses

From RFC 6762, Section 10.2
"They (the rules about when to set the cache-flush bit) apply to
startup announcements as described in Section 8.3, "Announcing",
and to responses generated as a result of receiving query messages."

So, set the cache-flush bit for mDNS answers except for DNS-SD
service enumerattion PTRs described in RFC 6763, Section 4.1.

6 years agoresolved: make rfc4795-specific code run for LLMNR only
Dmitry Rozhkov [Fri, 13 Oct 2017 09:19:21 +0000 (12:19 +0300)]
resolved: make rfc4795-specific code run for LLMNR only

RFC6762 specifies different procedure for conflict resolution and
the code is not applicable for the mDNS case.

6 years agoresolved: announce DNS-SD records in mDNS scopes
Dmitry Rozhkov [Wed, 4 Oct 2017 07:07:44 +0000 (10:07 +0300)]
resolved: announce DNS-SD records in mDNS scopes

6 years agoresolved: put DNS-SD records to mDNS-enabled zones.
Dmitry Rozhkov [Wed, 4 Oct 2017 08:34:39 +0000 (11:34 +0300)]
resolved: put DNS-SD records to mDNS-enabled zones.

6 years agoresolved: add enablers for DNS-SD
Dmitry Rozhkov [Wed, 4 Oct 2017 08:19:16 +0000 (11:19 +0300)]
resolved: add enablers for DNS-SD

Introduce network services loaded from .dnssd files that
can be used for server-side DNS-SD implementation in systemd-resolved.

6 years agoresolved: inroduce dns_txt_item_new_empty() function
Dmitry Rozhkov [Fri, 24 Nov 2017 13:24:57 +0000 (15:24 +0200)]
resolved: inroduce dns_txt_item_new_empty() function

6 years agoshared: introduce dnssd_srv_type_is_valid() function
Dmitry Rozhkov [Tue, 10 Oct 2017 12:58:45 +0000 (15:58 +0300)]
shared: introduce dnssd_srv_type_is_valid() function

6 years agoresolved: answer all mDNS questions found in packet
Dmitry Rozhkov [Fri, 29 Sep 2017 11:13:47 +0000 (14:13 +0300)]
resolved: answer all mDNS questions found in packet

According to p5.3 of RFC6762 (Multicast DNS) one mDNS query message
can contain more than one question sections.

Generate answers for all found questions and put them to a reply
message.

6 years agoMerge pull request #7570 from keszybz/sulogin-shell-reload-manager
Lennart Poettering [Fri, 8 Dec 2017 12:09:45 +0000 (13:09 +0100)]
Merge pull request #7570 from keszybz/sulogin-shell-reload-manager

Reload manager before exit from sulogin shell

6 years agoman: missing whitespace (#7579)
Clinton Roy [Fri, 8 Dec 2017 02:44:20 +0000 (15:44 +1300)]
man: missing whitespace (#7579)

6 years agovirt: propagate errors in detect_vm_xen_dom0 (#7553)
Olaf Hering [Thu, 7 Dec 2017 20:09:32 +0000 (21:09 +0100)]
virt: propagate errors in detect_vm_xen_dom0 (#7553)

Update detect_vm_xen_dom0 to propagate errors in case reading
/proc/xen/capabilites fails. This does not fix any bugs, it just makes
it consistent with other functions called by detect_vm.

6 years agoboot/efi: fixup TPM V2 measuring and logging (#7568)
Harald Hoyer [Thu, 7 Dec 2017 20:07:53 +0000 (21:07 +0100)]
boot/efi: fixup TPM V2 measuring and logging (#7568)

Honor the log format and use packed event structures.

Fixes https://github.com/systemd/systemd/issues/7118

6 years agoMerge pull request #7572 from poettering/taint-manager
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 20:06:28 +0000 (21:06 +0100)]
Merge pull request #7572 from poettering/taint-manager

"taint" logic improvements and other minor fixes

6 years agoMerge pull request #7573 from poettering/empty-to-null
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 20:04:53 +0000 (21:04 +0100)]
Merge pull request #7573 from poettering/empty-to-null

use empty_to_null() where we can

6 years agoNEWS: mention systemd-tmpfiles --user (#7574)
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 20:03:32 +0000 (21:03 +0100)]
NEWS: mention systemd-tmpfiles --user (#7574)

6 years agoMerge pull request #7562 from poettering/fix-manager-test-mkdir
Lennart Poettering [Thu, 7 Dec 2017 16:31:34 +0000 (17:31 +0100)]
Merge pull request #7562 from poettering/fix-manager-test-mkdir

fix --test mode

6 years agosulogin-shell: replace "^D" by "exit"
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 11:42:06 +0000 (12:42 +0100)]
sulogin-shell: replace "^D" by "exit"

^D is a bit cryptic, and advanced users will know that they can use ^D instead
of typing exit anyway.

6 years agoupdate TODO
Lennart Poettering [Thu, 7 Dec 2017 10:58:58 +0000 (11:58 +0100)]
update TODO

6 years agonspawn: turn on watchdog logic for nspawn too
Lennart Poettering [Thu, 7 Dec 2017 10:58:25 +0000 (11:58 +0100)]
nspawn: turn on watchdog logic for nspawn too

It's a long-running daemon, and it's easy to enable, hence do it.

6 years agomanager: taint the manager if the overflowuid/overflowgid aren't set to 65534
Lennart Poettering [Thu, 7 Dec 2017 10:35:02 +0000 (11:35 +0100)]
manager: taint the manager if the overflowuid/overflowgid aren't set to 65534

6 years agosulogin-shell: do daemon-reload before starting default target
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 09:33:11 +0000 (10:33 +0100)]
sulogin-shell: do daemon-reload before starting default target

If the user modifies configuration, e.g. /etc/fstab, they might forget to tell
systemd about the changes. Let's do a reload for them.

Note that doing a reload should be safe, because emergency and rescue modes are
"single threaded" and nothing should be doing changes at the point where we are
exiting from the sushell. Also, daemon-reload can be implicitly called at
various moments, so we can ignore the case where the user did some incompatible
changes on disk and is counting on systemd never reloading and picking them up.

C.f. #7565.

6 years agosulogin-shell: simplify returns from a function
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 09:51:03 +0000 (10:51 +0100)]
sulogin-shell: simplify returns from a function

This is actually slightly safer because it allows gcc to make sure that all code
paths either call return or are noreturn. But the real motivation is just to
follow the usual style and make it a bit shorter.

6 years agomeson: place systemd-sulogin-shell in build/
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 09:44:43 +0000 (10:44 +0100)]
meson: place systemd-sulogin-shell in build/

We do that will all executables so that it's easy to call them.

6 years agocore: use empty_to_null() where we can
Lennart Poettering [Thu, 7 Dec 2017 11:13:00 +0000 (12:13 +0100)]
core: use empty_to_null() where we can

6 years agococcinelle: improve run-coccinelle.sh to take list of scripts to run
Lennart Poettering [Thu, 7 Dec 2017 11:11:13 +0000 (12:11 +0100)]
coccinelle: improve run-coccinelle.sh to take list of scripts to run

Let's tweak run-coccinelle.sh to optionally take a list of scripts to
run. If not specified, run all scripts, as before.

6 years agocore: add console error message if manager_startup() fails
Lennart Poettering [Thu, 7 Dec 2017 10:28:00 +0000 (11:28 +0100)]
core: add console error message if manager_startup() fails

6 years agocore: make "taint" string logic a bit more generic and output it at boot
Lennart Poettering [Thu, 7 Dec 2017 10:27:07 +0000 (11:27 +0100)]
core: make "taint" string logic a bit more generic and output it at boot

The tainting logic existed for a long time, but was hidden inside the
bus interfaces. Let's give it a small bit more coverage, by logging its
value early at boot during initialization.

6 years agomanager: don't check /usr state of initrd to determine "taint-usr" taint
Lennart Poettering [Thu, 7 Dec 2017 10:09:09 +0000 (11:09 +0100)]
manager: don't check /usr state of initrd to determine "taint-usr" taint

6 years agomanager: don't bother with creating /run/systemd/units/ in test mode
Lennart Poettering [Wed, 6 Dec 2017 22:24:29 +0000 (23:24 +0100)]
manager: don't bother with creating /run/systemd/units/ in test mode

This makes sure running "systemd --test" works again on systems running
older systemd versions where the dir doesn't exist yet.

6 years agoMerge pull request #7567 from yuwata/fix-nobody
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 10:07:02 +0000 (11:07 +0100)]
Merge pull request #7567 from yuwata/fix-nobody

nobody related fixes

6 years agomanager: split out code that sets up run_queue event source into function of its own
Lennart Poettering [Wed, 6 Dec 2017 22:24:00 +0000 (23:24 +0100)]
manager: split out code that sets up run_queue event source into function of its own

Let's shorten manager_new() a bit.

6 years agoman: mention BoundsBy=, ConsistsOf=, RequisiteOf=
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 08:14:19 +0000 (09:14 +0100)]
man: mention BoundsBy=, ConsistsOf=, RequisiteOf=

Fixes #7043.

6 years agomeson: warn if nobody-user and nobody-group are set to different name
Yu Watanabe [Thu, 7 Dec 2017 08:19:11 +0000 (17:19 +0900)]
meson: warn if nobody-user and nobody-group are set to different name

It may work, but is very strange. So, let's warn about that.

v2:
Debian uses nobody and nogroup. Do not warn such case.

6 years agosysusers: use NOBODY_USER_NAME
Yu Watanabe [Thu, 7 Dec 2017 06:49:16 +0000 (15:49 +0900)]
sysusers: use NOBODY_USER_NAME

6 years agotest: use NOBODY_USER_NAME instead of hard-coded string "noody"
Yu Watanabe [Thu, 7 Dec 2017 06:48:44 +0000 (15:48 +0900)]
test: use NOBODY_USER_NAME instead of hard-coded string "noody"

6 years agoMerge pull request #7554 from keszybz/autodetect-build
Lennart Poettering [Thu, 7 Dec 2017 08:07:40 +0000 (09:07 +0100)]
Merge pull request #7554 from keszybz/autodetect-build

Autodetect build directory ignoring mkosi artefacts

6 years agoMerge pull request #7560 from poettering/refactor-main
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 07:51:04 +0000 (08:51 +0100)]
Merge pull request #7560 from poettering/refactor-main

reduce main() size a bit