platform/upstream/systemd.git
5 years agoDrop empty lines in proc-cmdline.c
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 06:45:25 +0000 (08:45 +0200)]
Drop empty lines in proc-cmdline.c

5 years agoshared/bootspec: remember the full path to boot entry and use it in logging
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 06:35:12 +0000 (08:35 +0200)]
shared/bootspec: remember the full path to boot entry and use it in logging

It's much easier to understand what is going on when the full path is
logged.

5 years agoMove logic to find default sd-boot entry from systemctl to shared
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 05:45:56 +0000 (07:45 +0200)]
Move logic to find default sd-boot entry from systemctl to shared

In preparation for use in other places. No functional change.

5 years agohib-res-generator: add "noresume"
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 05:31:10 +0000 (07:31 +0200)]
hib-res-generator: add "noresume"

This is an override parameter, to totally skip dehiberanation.

5 years agohib-res-generator: open logging before emitting the first message
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 05:23:03 +0000 (07:23 +0200)]
hib-res-generator: open logging before emitting the first message

Also add a debug message when we are not in initrd, because it can be
confusing why nothing is happenning.

5 years agoAdd $SYSTEMD_IN_INITRD=yes|no override for debugging
Zbigniew Jędrzejewski-Szmek [Wed, 26 Sep 2018 05:15:55 +0000 (07:15 +0200)]
Add $SYSTEMD_IN_INITRD=yes|no override for debugging

5 years agobootspec: rename "filename" field to "id"
Lennart Poettering [Fri, 22 Jun 2018 10:18:43 +0000 (12:18 +0200)]
bootspec: rename "filename" field to "id"

This follows the renaming done a few commits earlier too systemd-boot
itself.

Also, let's show the ID, since it's useful.

5 years agobootspec: fix include lines
Lennart Poettering [Fri, 22 Jun 2018 09:38:43 +0000 (11:38 +0200)]
bootspec: fix include lines

List all files we use definitions from.

5 years agouft8: add comment, requested by @keszybz
Lennart Poettering [Thu, 27 Sep 2018 15:13:53 +0000 (17:13 +0200)]
uft8: add comment, requested by @keszybz

5 years agoupdate TODO
Lennart Poettering [Thu, 27 Sep 2018 15:11:01 +0000 (17:11 +0200)]
update TODO

5 years agoMerge pull request #10173 from poettering/sd-boot-utf
Zbigniew Jędrzejewski-Szmek [Thu, 27 Sep 2018 06:21:20 +0000 (08:21 +0200)]
Merge pull request #10173 from poettering/sd-boot-utf

the utf8.c changes from PR #9437 (i.e. the boot counting PR)

5 years agonspawn: when --quiet is passed, simply downgrade log messages to LOG_DEBUG (#10181)
Lennart Poettering [Wed, 26 Sep 2018 21:40:39 +0000 (23:40 +0200)]
nspawn: when --quiet is passed, simply downgrade log messages to LOG_DEBUG (#10181)

With this change almost all log messages that are suppressed through
--quiet are not actually suppressed anymore, but simply downgraded to
LOG_DEBUG. Previously we did it this way for some log messages and fully
suppressed them for others. With this it's pretty much systematic.

Inspired by #10122.

5 years agoudev/net: add support for the equivalent of "ethtool advertise" to .link files
Susant Sahani [Sat, 16 Sep 2017 18:36:56 +0000 (00:06 +0530)]
udev/net: add support for the equivalent of "ethtool advertise" to .link files

This work adds support for the equivalent of "ethtool advertise" to .link files?
http://lists.freedesktop.org/archives/systemd-devel/2015-April/030112.html

5 years agoemergency: make sure console password agents don't interfere with the emergency shell
Franck Bui [Tue, 25 Sep 2018 13:25:08 +0000 (15:25 +0200)]
emergency: make sure console password agents don't interfere with the emergency shell

If for any reason local-fs.target fails at startup while a password is
requested by systemd-cryptsetup@.service, we end up with the emergency shell
competing with systemd-ask-password-console.service for the console.

This patch makes sure that:

 - systemd-ask-password-console.service is stopped before entering in emergency
   mode so it won't make any access to the console while the emergency shell is
   running.

 - systemd-ask-password-console.path is also stopped so any attempts to restart
   systemd-cryptsetup in the emergency shell won't restart
   systemd-ask-password-console.service and kill the emergency shell.

 - systemd-ask-password-wall.path is stopped so
   systemd-ask-password-wall.service won't be started as this service pulls
   the default dependencies in.

Fixes: #10131

5 years agonspawn: chown() the legacy hierarchy when it's used in a container
Evgeny Vereshchagin [Mon, 17 Sep 2018 07:12:38 +0000 (07:12 +0000)]
nspawn: chown() the legacy hierarchy when it's used in a container

This is a follow-up to 720f0a2f3c928cc9379501a52146be9fbb4d9be2.

Closes https://github.com/systemd/systemd/issues/10026
Closes https://github.com/systemd/systemd/issues/9563

5 years agoMake Watchdog Signal Configurable
Anita Zhang [Wed, 19 Sep 2018 19:03:01 +0000 (12:03 -0700)]
Make Watchdog Signal Configurable

Allows configuring the watchdog signal (with a default of SIGABRT).
This allows an alternative to SIGABRT when coredumps are not desirable.

Appropriate references to SIGABRT or aborting were renamed to reflect
more liberal watchdog signals.

Closes #8658

5 years agoMerge pull request #10158 from keszybz/seccomp-log-tightening
Lennart Poettering [Wed, 26 Sep 2018 13:56:32 +0000 (15:56 +0200)]
Merge pull request #10158 from keszybz/seccomp-log-tightening

Seccomp log tightening

5 years agoMerge pull request #10168 from keszybz/coverity-fixes
Lennart Poettering [Wed, 26 Sep 2018 13:37:22 +0000 (15:37 +0200)]
Merge pull request #10168 from keszybz/coverity-fixes

Coverity fixes

5 years agonetworkd-dhcp6: Set initial value of route to NULL
Patrik Flykt [Wed, 26 Sep 2018 00:09:17 +0000 (18:09 -0600)]
networkd-dhcp6: Set initial value of route to NULL

Start with route set to NULL should there be no route created. Remove
the explicit route_free as the _cleanup_ will take care of that after
the continue;.

5 years agolibsystemd: add missing 'global' specifier in libsystemd.sym
Yu Watanabe [Tue, 25 Sep 2018 11:58:24 +0000 (20:58 +0900)]
libsystemd: add missing 'global' specifier in libsystemd.sym

5 years agoRFC tmpfiles: Allow configuration to ignore execution errors
William Douglas [Mon, 10 Sep 2018 19:07:29 +0000 (12:07 -0700)]
RFC tmpfiles: Allow configuration to ignore execution errors

This is an implementation that covers making errors encountered when writing
file content optionally fatal. If this is something that folks would want I'll
add handling of this for all the other directives. I'd appreciate suggestions
on how this might better be structured as well (use of a goto fail or such) as
I'm not super happy with the approach.

5 years agoMerge pull request #10169 from poettering/putenv-error-handling
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 17:50:49 +0000 (19:50 +0200)]
Merge pull request #10169 from poettering/putenv-error-handling

add missing putenv() error handling

5 years agoutf8: add utf8_to_utf16() helper
Lennart Poettering [Mon, 25 Jun 2018 17:17:42 +0000 (19:17 +0200)]
utf8: add utf8_to_utf16() helper

5 years agoutf8: let's update utf16_to_utf8() a bit
Lennart Poettering [Mon, 25 Jun 2018 17:16:43 +0000 (19:16 +0200)]
utf8: let's update utf16_to_utf8() a bit

Let's change utf16_to_utf8() prototype to refer to utf16 chars with char16_t rather than void

Let's not cast away a "const" needlessly.

Let's add a few comments.

Let's fix the calculations of the buffer size to allocate, and how long
to run the loop in case of uneven byte numbers

5 years agoutf8: change return type of utf8_encoded_expected_len() to size_t
Lennart Poettering [Wed, 18 Jul 2018 10:30:00 +0000 (12:30 +0200)]
utf8: change return type of utf8_encoded_expected_len() to size_t

After all it returns a lengths of a string in chars, and hence should
return size_t, exactly like strlen().

5 years agoutf8: modernize utf16 inline calls a bit
Lennart Poettering [Wed, 18 Jul 2018 10:23:31 +0000 (12:23 +0200)]
utf8: modernize utf16 inline calls a bit

Let's fix an indentation issue.

Let's avoid yoda comparisons.

Let's drop unnecessary ().

Let's make sure we convert 16bit values to 32bit before shifting them by
10bit to the left, to avoid overflows.

Let's avoid comparisons between signed literals and unsigned variables,
in particular if the literals are outside of the minimum range C
requires for "int".

5 years agoutf8: update utf8_is_valid() a bit
Lennart Poettering [Wed, 18 Jul 2018 10:21:39 +0000 (12:21 +0200)]
utf8: update utf8_is_valid() a bit

Let's avoid a few casts in the function. Also, let's drop the "const"
when returning the string, for similar reasons as strchr() and friends
drop it: so that we don't add a const if the user passes in a non-const
string.

5 years agoMerge pull request #10088 from keszybz/man-systemctl-return
Lennart Poettering [Tue, 25 Sep 2018 10:35:36 +0000 (12:35 +0200)]
Merge pull request #10088 from keszybz/man-systemctl-return

man: add a description of systemctl return codes

5 years agoMerge pull request #10059 from yuwata/env-exec-directory
Lennart Poettering [Tue, 25 Sep 2018 10:34:30 +0000 (12:34 +0200)]
Merge pull request #10059 from yuwata/env-exec-directory

core: introduce $RUNTIME_DIRECTORY= or friends

5 years agoexec-util: add missing logging call
Lennart Poettering [Tue, 25 Sep 2018 10:03:06 +0000 (12:03 +0200)]
exec-util: add missing logging call

This function logs about all errors, but one case was forgotten. Fix
that.

5 years agoexec-util: handle putenv() errors
Lennart Poettering [Tue, 25 Sep 2018 10:02:26 +0000 (12:02 +0200)]
exec-util: handle putenv() errors

Just paranoia, as putenv() can fail and we should catch it, like we
catch all other errors.

Follow-up for #10073

5 years agotest-journal-syslog: initialize variable
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 09:34:52 +0000 (11:34 +0200)]
test-journal-syslog: initialize variable

The *priority argument to syslog_parse_priority() needs to be initialized
if the last argument (with_facility) is false.

CID #1394690.

5 years agoudev-builtin-net_id: do not assume "type" attribute exists
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 09:29:54 +0000 (11:29 +0200)]
udev-builtin-net_id: do not assume "type" attribute exists

It *should*, but who knows, let's be more defensive here.

CID #1395805.

5 years agojournal-upload: fix off-by-one in assert()
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 09:22:13 +0000 (11:22 +0200)]
journal-upload: fix off-by-one in assert()

CID #1394386.

5 years agosd-event: use new cleanup function more
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 09:15:27 +0000 (11:15 +0200)]
sd-event: use new cleanup function more

5 years agosd-event: remove dead code and use _cleanup_
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 09:10:12 +0000 (11:10 +0200)]
sd-event: remove dead code and use _cleanup_

CID #1393250.

5 years agodocs: clarify controller mount logic in hybrid cgroups mode
Lennart Poettering [Mon, 24 Sep 2018 17:01:37 +0000 (19:01 +0200)]
docs: clarify controller mount logic in hybrid cgroups mode

Fixes: #10107

5 years agoMake bzip2 an optional dependency for systemd-importd
Thiago Macieira [Mon, 24 Sep 2018 20:03:02 +0000 (13:03 -0700)]
Make bzip2 an optional dependency for systemd-importd

Yes, there are still a lot of users of bzip2, but it's fallen out of
favour after LZMA/xz, which can compress a lot more and often
decompresses faster than bzip2 too.

5 years agoMerge pull request #10163 from poettering/inhibit-format-table
Lennart Poettering [Tue, 25 Sep 2018 08:24:30 +0000 (10:24 +0200)]
Merge pull request #10163 from poettering/inhibit-format-table

systemd-inhibit --list: port to format-table.c

5 years agoMerge pull request #10073 from xnox/execve
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 08:07:23 +0000 (10:07 +0200)]
Merge pull request #10073 from xnox/execve

Execute generators with manager's environment exported

5 years agoDHCPv6: use unsigned for flags
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 07:29:36 +0000 (09:29 +0200)]
DHCPv6: use unsigned for flags

5 years agoMerge pull request #10164 from poettering/btrfs-resize-fix
Zbigniew Jędrzejewski-Szmek [Tue, 25 Sep 2018 07:24:14 +0000 (09:24 +0200)]
Merge pull request #10164 from poettering/btrfs-resize-fix

btrfs resize fix

5 years agoudev: fix some type sloppiness
Lennart Poettering [Mon, 24 Sep 2018 16:59:54 +0000 (18:59 +0200)]
udev: fix some type sloppiness

We use strtoul() which returns an "unsigned long", but then assign this
to int or unsigned in, i.e. drop 32bit silently on 64bit systems. Let's
clean this up a bit, and retain the right types.

5 years agologind: fix blacklist/whitelist confusion in comment (#10165)
Lennart Poettering [Mon, 24 Sep 2018 22:02:41 +0000 (01:02 +0300)]
logind: fix blacklist/whitelist confusion in comment (#10165)

Triggered by this:

https://github.com/systemd/systemd/commit/602a41c22ac2df33b4b5e5083719c1cfaf58acf9#r30575293

5 years agodocs: fix CONTRIBUTING path (#10160)
Lennart Poettering [Mon, 24 Sep 2018 21:25:48 +0000 (00:25 +0300)]
docs: fix CONTRIBUTING path (#10160)

5 years agobtrfs: log at debug log when we ignore errors
Lennart Poettering [Mon, 24 Sep 2018 17:47:42 +0000 (19:47 +0200)]
btrfs: log at debug log when we ignore errors

This stuff is likely to fail in many setups (for example when quota is
not supported by the btrfs version), hence only log at debug
level. Previously we'd silently ignore things altogether which makes
things pretty hard to debug.

5 years agobtrfs: fix loopback resizing code
Lennart Poettering [Mon, 24 Sep 2018 17:44:06 +0000 (19:44 +0200)]
btrfs: fix loopback resizing code

This corrects the block device to use, to the right path, as it was
before 553e15f21bd7b1ecb709edfb5686d5768fe942f2.

Replaces: #10153

5 years agoupdate TODO
Lennart Poettering [Mon, 24 Sep 2018 17:01:08 +0000 (19:01 +0200)]
update TODO

5 years agoinhibit: use format-table to format systemd-inhibit --list
Lennart Poettering [Wed, 19 Sep 2018 18:21:45 +0000 (21:21 +0300)]
inhibit: use format-table to format systemd-inhibit --list

This changes the output a bit, as the previous multi-line output of each
inhibitor is changed to a single line, but it does unify the output look
with the one of our other tools. Moreover this adds proper sorting.

5 years agoinhibit: normalize variable types
Lennart Poettering [Wed, 19 Sep 2018 17:57:42 +0000 (20:57 +0300)]
inhibit: normalize variable types

When we parse an "u" from an sd_bus_message then we need to do that into
a uint32_t, not a pid_t or uid_t, even if this is likely the same.

Also, let's count objects we keep in memory as size_t as usual.

5 years agoinhibit: normalize when we log about failures to list inhibitors
Lennart Poettering [Wed, 19 Sep 2018 17:53:22 +0000 (20:53 +0300)]
inhibit: normalize when we log about failures to list inhibitors

let's print log messages about all types of errors inside of the
function, since otherwise we might sometimes log twice about some
specific cases.

5 years agofs-util: make symlink_idempotent() optionally create relative link
Yu Watanabe [Sun, 23 Sep 2018 07:17:03 +0000 (16:17 +0900)]
fs-util: make symlink_idempotent() optionally create relative link

5 years agoMerge pull request #9989 from yuwata/sd-device-enoent
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 15:27:49 +0000 (17:27 +0200)]
Merge pull request #9989 from yuwata/sd-device-enoent

sd-device: make sd_device_get_*() return -ENOENT if the values are not set

5 years agoseccomp: tighten checking of seccomp filter creation
Zbigniew Jędrzejewski-Szmek [Thu, 20 Sep 2018 12:19:41 +0000 (14:19 +0200)]
seccomp: tighten checking of seccomp filter creation

In seccomp code, the code is changed to propagate errors which are about
anything other than unknown/unimplemented syscalls. I *think* such errors
should not happen in normal usage, but so far we would summarilly ignore all
errors, so that part is uncertain. If it turns out that other errors occur and
should be ignored, this should be added later.

In nspawn, we would count the number of added filters, but didn't use this for
anything. Drop that part.

The comments suggested that seccomp_add_syscall_filter_item() returned negative
if the syscall is unknown, but this wasn't true: it returns 0.

The error at this point can only be if the syscall was known but couldn't be
added. If the error comes from our internal whitelist in nspawn, treat this as
error, because it means that our internal table is wrong. If the error comes
from user arguments, warn and ignore. (If some syscall is not known at current
architecture, it is still silently ignored.)

5 years agoseccomp: reduce logging about failure to add syscall to seccomp
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 14:59:12 +0000 (16:59 +0200)]
seccomp: reduce logging about failure to add syscall to seccomp

Our logs are full of:
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldstat() / -10037, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call get_thread_area() / -10076, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call set_thread_area() / -10079, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldfstat() / -10034, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldolduname() / -10036, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldlstat() / -10035, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call waitpid() / -10073, ignoring: Numerical argument out of domain
...
This is pointless and makes debug logs hard to read. Let's keep the logs
in test code, but disable it in nspawn and pid1. This is done through a function
parameter because those functions operate recursively and it's not possible to
make the caller to log meaningfully.

There should be no functional change, except the skipped debug logs.

5 years agotest-seccomp: log function names
Zbigniew Jędrzejewski-Szmek [Fri, 21 Sep 2018 12:14:45 +0000 (14:14 +0200)]
test-seccomp: log function names

Various tests produce similar output, and the function names make it
easier to see where the output is generated.

5 years agotest-seccomp: move two similar tests closer
Zbigniew Jędrzejewski-Szmek [Fri, 21 Sep 2018 12:12:04 +0000 (14:12 +0200)]
test-seccomp: move two similar tests closer

5 years agoMerge pull request #10087 from keszybz/xnox/fix-test-functions
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 13:15:23 +0000 (15:15 +0200)]
Merge pull request #10087 from keszybz/xnox/fix-test-functions

test/test-functions: drop all prefixes

5 years agocore: execute generators with manager's environmnet
Dimitri John Ledkov [Wed, 12 Sep 2018 18:52:30 +0000 (19:52 +0100)]
core: execute generators with manager's environmnet

5 years agocore: execute environment_generators with manager's environment
Dimitri John Ledkov [Wed, 12 Sep 2018 18:51:23 +0000 (19:51 +0100)]
core: execute environment_generators with manager's environment

5 years agoexec-util: in execute_directories, support initial exec environment
Dimitri John Ledkov [Wed, 12 Sep 2018 17:19:13 +0000 (18:19 +0100)]
exec-util: in execute_directories, support initial exec environment

5 years agoMerge pull request #10082 from porrided/udev-ipoib
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 11:14:06 +0000 (13:14 +0200)]
Merge pull request #10082 from porrided/udev-ipoib

Introduce predictable naming for IP-over-InfiniBand NICs

5 years agoMerge pull request #9981 from pfl/dhcp6_pd_other_information_quirk
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 11:02:24 +0000 (13:02 +0200)]
Merge pull request #9981 from pfl/dhcp6_pd_other_information_quirk

DHCPv6 PD other information quirk

5 years agotree-wide: drop unnecessary initializations
Yu Watanabe [Sat, 1 Sep 2018 14:13:54 +0000 (23:13 +0900)]
tree-wide: drop unnecessary initializations

5 years agotree-wide: do not assign unused return values
Yu Watanabe [Sat, 1 Sep 2018 14:12:47 +0000 (23:12 +0900)]
tree-wide: do not assign unused return values

5 years agologind-acl: replace strdup()+set_consume() by set_put_strdup()
Yu Watanabe [Sat, 1 Sep 2018 14:09:54 +0000 (23:09 +0900)]
logind-acl: replace strdup()+set_consume() by set_put_strdup()

5 years agogpt-auto-generator: do not assign '*ret' on error
Yu Watanabe [Sat, 1 Sep 2018 14:07:18 +0000 (23:07 +0900)]
gpt-auto-generator: do not assign '*ret' on error

5 years agotree-wide: use streq() instead of streq_ptr()
Yu Watanabe [Sat, 1 Sep 2018 14:03:22 +0000 (23:03 +0900)]
tree-wide: use streq() instead of streq_ptr()

5 years agosd-device: make sd_device_get_*() return -ENOENT if the values are not set
Yu Watanabe [Sat, 1 Sep 2018 09:05:27 +0000 (18:05 +0900)]
sd-device: make sd_device_get_*() return -ENOENT if the values are not set

5 years agotest-udev: use LOG_REALM_UDEV
Yu Watanabe [Fri, 21 Sep 2018 08:10:34 +0000 (17:10 +0900)]
test-udev: use LOG_REALM_UDEV

Otherwise, even if SYSTEMD_LOG_LEVEL=debug is specified, the test does
not show most debug messages.

5 years agoudevadm: show only version number for '--version' option
Yu Watanabe [Fri, 21 Sep 2018 08:45:26 +0000 (17:45 +0900)]
udevadm: show only version number for '--version' option

This effectively reverts 2bc54be485def3d1697a00209ff73ae21aa7f268
and relevant changes in #9920, as it is used to determine the version
of udev, e.g., dracut.

Fixes dracutdevs/dracut#468.

5 years agoMerge pull request #10135 from yuwata/log-skipped-tests
Zbigniew Jędrzejewski-Szmek [Thu, 20 Sep 2018 21:07:48 +0000 (23:07 +0200)]
Merge pull request #10135 from yuwata/log-skipped-tests

test: add log messages when some tests are skipped

5 years agotest-seccomp: add log messages when skipping tests
Yu Watanabe [Fri, 14 Sep 2018 06:55:15 +0000 (15:55 +0900)]
test-seccomp: add log messages when skipping tests

5 years agotest-process-util: logs something when skipping tests
Yu Watanabe [Thu, 20 Sep 2018 07:09:05 +0000 (16:09 +0900)]
test-process-util: logs something when skipping tests

5 years agosd-hwdb: initialize variable
Yu Watanabe [Thu, 20 Sep 2018 07:38:19 +0000 (16:38 +0900)]
sd-hwdb: initialize variable

The variable 'fn' was not initialized on compat mode.

Fixes CID#1395731.

5 years agotmpfiles: Order tmpfiles-setup after journald
João Paulo Rechi Vita [Tue, 18 Sep 2018 22:03:54 +0000 (15:03 -0700)]
tmpfiles: Order tmpfiles-setup after journald

systemd-tmpfiles-setup.service needs to be ordered after
systemd-journald.service, so entries in /run/log/journal are already
created when systemd-tmpfiles tries to adjust its permissions.

This is specially problematic for setups using a volatile journal where
the initrd does not ship a machine-id (i.e. OSTree-based systems), where
logs from the initrd will be inaccessible for users in the
systemd-journal group. It also has a side effect of `journalctl --user`
failing with "No journal files were opened due to insufficient
permissions".

Fixes #10128.

5 years agomeson: fix dirname/basename confusion in meson-and-wants.sh install helper (#10126)
Zbigniew Jędrzejewski-Szmek [Thu, 20 Sep 2018 07:01:58 +0000 (09:01 +0200)]
meson: fix dirname/basename confusion in meson-and-wants.sh install helper (#10126)

We would create a useless empty directory under build/.
It seems we were lucky and all symlinks were installed into directories
which were alredy created because we installed something into the same
location earlier.

While at it, also add '-v' to 'mkdir -p'. This will print the names of
directories as they are created (just once), making it easier to see all of
what the install script is doing.

5 years agonetworkd-manager: Fix route removals on shutdown
Patrik Flykt [Wed, 19 Sep 2018 00:32:30 +0000 (18:32 -0600)]
networkd-manager: Fix route removals on shutdown

In order to shut down networkd properly, the delegated routes added
need to be removed properly, and as error reporting is wanted, the
network link is needed in the debug output.

Solve this by calling manager_dhcp6_prefix_remove_all(), which will
remove each prefix stored in the Manager structure, and while doing
that reference each link so that it isn't freed before the route
removal callback is called. This in turn causes the network link to
be referenced once more, and an explicit hashmap_remove() must be
called to remove the network link from the m->links hashmap.

Also, since the registered callback is not called when the DHCPv6
client is stopped with sd_dhcp6_client_stop(), an explicit call
to dhcp6_lease_pd_prefix_lost() needs to be made to clean up any
unreachable routes set up for the delegated prefixes.

5 years agonetworkd-manager: Update logging of route additions and removals
Patrik Flykt [Wed, 19 Sep 2018 00:32:28 +0000 (18:32 -0600)]
networkd-manager: Update logging of route additions and removals

Log route additions and removals when the action is to be done, as
the reply rtnl message may contain only a success or failure.

5 years agosd-dhcp6-client: Reference and unreference a stored lease
Patrik Flykt [Wed, 19 Sep 2018 00:32:26 +0000 (18:32 -0600)]
sd-dhcp6-client: Reference and unreference a stored lease

In order to be able to properly free a DHCPv6 lease, unreference the
previous lease and reference the new one.

5 years agonetworkd-dhcp6: Remove functions whose output is not used
Patrik Flykt [Wed, 19 Sep 2018 00:32:23 +0000 (18:32 -0600)]
networkd-dhcp6: Remove functions whose output is not used

Remove dhcp6_reset_pd_prefix_network() that returns the network, but
whose output is not used anywhere.

5 years agonetworkd-dhcp6: Set one unreachable route per DHCPv6 delegated prefix
Patrik Flykt [Wed, 19 Sep 2018 00:32:19 +0000 (18:32 -0600)]
networkd-dhcp6: Set one unreachable route per DHCPv6 delegated prefix

Instead of setting many small unreachable routes for each of the /64
subnets that were not distributed between the links requesting delegated
prefixes, set one unreachable route for the size of the delegated
prefix. Each subnet asssigned to a downstream link will add a routable
subnet for that link, and as the subnet assigned to the downstream link
has a longer prefix than the whole delegated prefix, the downstream
link subnet routes are preferred over the unroutable delegated one.
The unreachable route is not added when the delegated prefix is exactly
a /64 as the prefix size cannot be used to sort out the order of routing
into a bigger blocking subnet with the smaller /64 punching routable
"holes" into it.

When stopping the DHCPv6 client, the unroutable delegated prefix is
removed before the downstream link prefixes are unassigned.

5 years agodhcp6-client: Store lease timeouts T1 and T1 in client struct
Patrik Flykt [Tue, 11 Sep 2018 22:26:01 +0000 (16:26 -0600)]
dhcp6-client: Store lease timeouts T1 and T1 in client struct

Since we now have the possibility to request prefixes to be delegated
without corresponding IPv6 addresses, it does not make sense to store
lease T1 and T2 timeouts in the otherwise unused IA_NA structure.
Therefore lease timeouts T1 and T2 are moved to the DHCPv6 client
structure, as there will be only one set of stateful timeouts required
by RFC 7550, Section 4.3.

5 years agodhcp6-client: Select T1 and T2 timeouts from IA_NA and IA_PD
Patrik Flykt [Tue, 11 Sep 2018 17:55:38 +0000 (11:55 -0600)]
dhcp6-client: Select T1 and T2 timeouts from IA_NA and IA_PD

Select T1 and T2 timeouts based on whether addresses or prefixes were
requested and what the server offered. The address and prefix timeouts
values have been computed earlier when the relevant DHCPv6 options were
parsed.

5 years agodhcp6-lease: Add function to fetch the IAID for the prefix
Patrik Flykt [Fri, 7 Sep 2018 20:37:56 +0000 (14:37 -0600)]
dhcp6-lease: Add function to fetch the IAID for the prefix

Add function to fetch the IAID for the delegated IA_PD prefix. In
order to keep things simple in the implemntation, the same IAID
is used with IA_NA addresses and IA_PD prefixes. But the DHCPv6
server can choose to return only IA_PD prefixes, and the client
can nowadays omit requesting of IA_NA addresses. Since the function
fetching said IAID from the lease looks only for IA_NA ones, it
will return an empty IAID, which of course does not match the one
set for prefixes.

Fix this by adding a function returning the IAID for the prefix.

5 years agonetworkd-network: Introduce DHCPv6 PD knob for RFC 7084 WPD-4
Patrik Flykt [Fri, 7 Sep 2018 20:15:55 +0000 (14:15 -0600)]
networkd-network: Introduce DHCPv6 PD knob for RFC 7084 WPD-4

RFC 7084, WPD-4, requires Customer Edge end routers to behave
according to the following:

"WPD-4:  By default, the IPv6 CE router MUST initiate DHCPv6 prefix
           delegation when either the M or O flags are set to 1 in a
           received Router Advertisement (RA) message.  Behavior of the
           CE router to use DHCPv6 prefix delegation when the CE router
           has not received any RA or received an RA with the M and the
           O bits set to zero is out of scope for this document."

Since it cannot be automatically detected whether DHCPv6 is to be
operated as an CE end router or whether to initiate an Informational
exchange to obtain other useful network information via DHCPv6 when the
Router Advertisement 'O' bit is set, a 'ForceDHCPv6PDOtherInformation'
boolean network configuration option in the '[DHCP]' section of a is
introduced. Setting this option causes DHCPv6 to be started in stateful
mode, although only the 'O' bit is seen in the Router Advertisement.

When 'ForceDHCPv6PDOtherInformation' is set and the Router Advertisement
has only the Other information 'O' bit set, disable requests for IA_NA
addresses.

Fixes #9745.

5 years agodhcp6-client: Add tests for address, information and prefix requests
Patrik Flykt [Fri, 7 Sep 2018 15:24:15 +0000 (09:24 -0600)]
dhcp6-client: Add tests for address, information and prefix requests

Add simple test cases to ensure the request for addresses, prefixes
and information request are handled as expected.

5 years agodhcp6-client: Function for enabling/disabling IA_NA request
Patrik Flykt [Fri, 7 Sep 2018 20:00:10 +0000 (14:00 -0600)]
dhcp6-client: Function for enabling/disabling IA_NA request

Add function to enable/disable IA_NA address requests. Internally
handle the request as a bit mask and add IA_PD prefix delegation
to the same bit mask instead of having a separate boolean. Thus
the calling code can set requests for prefix and address delegation
separately. This is handy when supporting RFC 7084.

Add a check in the code that at least something is requested from
the server in Managed mode. By default request IA_NA addresses from
the DHCPv6 server. Although a value has been defined for IA_TA,
temporay IA_TA addresses are not yet requested.

5 years agodhcp6_client: Add helper for fetching Prefix Delegation information
Patrik Flykt [Thu, 6 Sep 2018 17:31:48 +0000 (11:31 -0600)]
dhcp6_client: Add helper for fetching Prefix Delegation information

Add helper function for fetching enabled/disabled state of Prefix
Delegation for a DHCPv6 client. Update function setting prefix
delegation to use an int instead of a boolean.

5 years agoMerge pull request #10113 from yuwata/unify-hwdb
Zbigniew Jędrzejewski-Szmek [Wed, 19 Sep 2018 11:34:01 +0000 (13:34 +0200)]
Merge pull request #10113 from yuwata/unify-hwdb

hwdb,udevadm: unify duplicated code and move it to hwdb-util.c

5 years agohwdb,udevadm: also unify hwdb_query() and hwdb_test()
Yu Watanabe [Tue, 18 Sep 2018 14:14:18 +0000 (23:14 +0900)]
hwdb,udevadm: also unify hwdb_query() and hwdb_test()

5 years agosd-hwdb: use structured initializers
Yu Watanabe [Tue, 18 Sep 2018 14:09:43 +0000 (23:09 +0900)]
sd-hwdb: use structured initializers

5 years agohwdb: unify duplicated code and move it to hwdb-util.c
Yu Watanabe [Tue, 18 Sep 2018 13:57:45 +0000 (22:57 +0900)]
hwdb: unify duplicated code and move it to hwdb-util.c

Both 'systemd-hwdb update' and 'udevadm hwdb --update' creates hwdb
database. The database created by systemd-hwdb containes additional
information such that priority, line number, and source filename.
The unified function 'hwdb_update()' can take a flag 'compat' which
controls the format version of created database.

5 years agosd-hwdb: adjust included headers
Yu Watanabe [Tue, 18 Sep 2018 04:37:51 +0000 (13:37 +0900)]
sd-hwdb: adjust included headers

5 years agohwdb: use _cleanup_ attribute at one more place
Yu Watanabe [Tue, 18 Sep 2018 03:50:33 +0000 (12:50 +0900)]
hwdb: use _cleanup_ attribute at one more place

5 years agohwdb: make trie_node_cleanup() can take NULL
Yu Watanabe [Tue, 18 Sep 2018 03:49:51 +0000 (12:49 +0900)]
hwdb: make trie_node_cleanup() can take NULL

5 years agoRemove trailing space
javitoom [Wed, 19 Sep 2018 07:29:25 +0000 (09:29 +0200)]
Remove trailing space

Remove trailing space

5 years agohwdb: Add accelerometer orientation quirk for the Teclast X98 Plus I (A5C6) tablet
javitoom [Mon, 17 Sep 2018 14:48:41 +0000 (16:48 +0200)]
hwdb: Add accelerometer orientation quirk for the Teclast X98 Plus I (A5C6) tablet

Add accelerometer orientation quirk for the Teclast X98 Plus I (A5C6) tablet.

5 years agonspawn: suppress one more log message when --quiet is passed
Yu Watanabe [Tue, 18 Sep 2018 23:42:01 +0000 (08:42 +0900)]
nspawn: suppress one more log message when --quiet is passed

Fixes #10119.

5 years agoSupport for Kensington Expert Mouse in hwdb
Tony Novak [Tue, 18 Sep 2018 20:17:08 +0000 (16:17 -0400)]
Support for Kensington Expert Mouse in hwdb

Fixes #10120.