Jan Janssen [Sun, 15 Aug 2021 11:44:35 +0000 (13:44 +0200)]
sd-boot: Draw custom edit cursor
Firmware likes to draw the EFI provided cursor in a weird way that
makes it invisible sometimes. This is even more likely to happen
if unusual colors are picked. It also fails to draw attention to the
user by being very small and not blinking.
Additionally, to make it more clear that we are in edit mode, we
now default to inverting the general default color and use that for
our line edit.
Fixes: #19301
Jan Janssen [Sat, 14 Aug 2021 12:38:43 +0000 (14:38 +0200)]
sd-boot: Add compile-time color support
Fixes: #10139
Jan Janssen [Sat, 14 Aug 2021 12:26:12 +0000 (14:26 +0200)]
sd-boot: Improve key bindings
Making keys case insensitive should help if caps lock is on.
We are not advertising them at runtime or in the manual to
reduce the noise.
This also hides the quit and version commands from the help
string. They are mostly for devs and otherwise have little
to no use to normal users. The latter overlaps with print
status which is still advertised.
Jan Janssen [Sat, 14 Aug 2021 12:10:35 +0000 (14:10 +0200)]
sd-boot: Render title entries centered and not to entire screen width
Jan Janssen [Sat, 14 Aug 2021 12:02:16 +0000 (14:02 +0200)]
sd-boot: Introduce print_at helper function
Jan Janssen [Sat, 14 Aug 2021 11:44:12 +0000 (13:44 +0200)]
sd-boot: Fix marking EFI var default entry
Fixes: #18072
Jan Janssen [Sat, 14 Aug 2021 11:06:37 +0000 (13:06 +0200)]
sd-boot: Allow automatic entries to be default
Jan Janssen [Sat, 14 Aug 2021 11:04:29 +0000 (13:04 +0200)]
sd-boot: Improve selection of initial entries to show
Lennart Poettering [Mon, 16 Aug 2021 13:35:08 +0000 (15:35 +0200)]
Merge pull request #20438 from medhefgo/boot
sd-boot: Better self-detection and windows loader title
Jan Janssen [Fri, 13 Aug 2021 17:03:35 +0000 (19:03 +0200)]
sd-boot: Detect windows boot loader title from BCD
Jan Janssen [Fri, 13 Aug 2021 17:03:35 +0000 (19:03 +0200)]
sd-boot: Add memmem_safe and memory_startswith
Jan Janssen [Fri, 13 Aug 2021 17:03:35 +0000 (19:03 +0200)]
sd-boot: Try harder to detect ourselves
By moving our magic string into its own PE section, we can forego
grepping for it.
Jan Janssen [Fri, 13 Aug 2021 16:55:32 +0000 (18:55 +0200)]
sd-boot: Fix PE section parsing
We only need the PE header offset from the DOS header, not
its size. Previously, the section table could be cut off in the middle.
While we are at it, also modernize the remaining code.
Milo Turner [Fri, 13 Aug 2021 14:28:58 +0000 (10:28 -0400)]
Don't open /var journals in volatile mode when runtime_journal==NULL
Yu Watanabe [Fri, 13 Aug 2021 08:31:28 +0000 (17:31 +0900)]
Merge pull request #20432 from yuwata/network-recreate-stacked-netdevs
network: recreate stacked netdevs when underlying device is re-added
Jan Janssen [Thu, 12 Aug 2021 14:18:10 +0000 (16:18 +0200)]
meson: Make unused-function an error
Steven Siloti [Sun, 11 Jul 2021 18:05:26 +0000 (11:05 -0700)]
resolved: retry on SERVFAIL before downgrading feature level
The SERVFAIL RCODE can be generated for many reasons which may not be related
to lack of feature support. For example, the Stubby resolver generates
SERVFAIL when a request times out. Such transient failures can cause
unnecessary downgrades to both the transaction and the server's feature level.
The consequences of this are especially severe if the server is in DNSSEC
strict mode. In this case repeated downgrades eventually cause the server to
stop resolving entirely with the error "incompatible-server".
To avoid unnecessary downgrades the request should be retried once with the
current level before the transaction's feature level is downgraded.
Lennart Poettering [Fri, 13 Aug 2021 07:22:48 +0000 (09:22 +0200)]
Merge pull request #20233 from maanyagoenka/log-error
systemd-analyze: add option to return an error value when unit verification fails
Lennart Poettering [Fri, 13 Aug 2021 07:22:12 +0000 (09:22 +0200)]
Merge pull request #20350 from medhefgo/boot
Grab bag of sd-boot improvements
Maanya Goenka [Mon, 26 Jul 2021 20:02:17 +0000 (13:02 -0700)]
systemd-analyze: option to exit with an error when 'verify' fails
The commit introduces a callback invoked from log_syntax_internal.
Use it from systemd-analyze to gather a list of units that contain
syntax warnings. A new command line option is added to make use of this.
The new option --recursive-errors takes in three possible modes:
1. yes - which is the default. systemd-analyze exits with an error when syntax warnings arise during verification of the
specified units or any of their dependencies.
3. no - systemd-analyze exits with an error when syntax warnings arise during verification of only the selected unit.
Analyzing and loading any dependencies will be skipped.
4. one - systemd-analyze exits with an error when syntax warnings arise during verification
of only the selected units and their direct dependencies.
Below are two service unit files that I created for the purposes of testing:
1. First, we run the commands on a unit that does not have dependencies but has a non-existing key-value setting (i.e. foo = bar).
> cat <<EOF>testcase.service
[Unit]
foo = bar
[Service]
ExecStart = echo hello
EOF
OUTPUT:
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify testcase.service
/home/maanya-goenka/systemd/testcase.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=yes testcase.service
/home/maanya-goenka/systemd/testcase.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=no testcase.service
/home/maanya-goenka/systemd/testcase.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=one testcase.service
/home/maanya-goenka/systemd/testcase.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
2. Next, we run the commands on a unit that is syntactically valid but has a non-existing dependency (i.e. foo2.service)
> cat <<EOF>foobar.service
[Unit]
Requires = foo2.service
[Service]
ExecStart = echo hello
EOF
OUTPUT:
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify foobar.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
foobar.service: Failed to create foobar.service/start: Unit foo2.service not found.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=yes foobar.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
foobar.service: Failed to create foobar.service/start: Unit foo2.service not found.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=no foobar.service
maanya-goenka@debian:~/systemd (log-error)$ echo $?
0
maanya-goenka@debian:~/systemd (log-error)$ sudo build/systemd-analyze verify --recursive-errors=one foobar.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
foobar.service: Failed to create foobar.service/start: Unit foo2.service not found.
maanya-goenka@debian:~/systemd (log-error)$ echo $?
1
Maanya Goenka [Thu, 8 Jul 2021 01:28:20 +0000 (18:28 -0700)]
manager: add a test flag to ignore dependencies
The MANAGER_TEST_RUN_IGNORE_DEPENDENCIES flag was added in order to allow the caller
to skip the recursive loading of dependency units when loading specific
unit files. This includes the default dependencies, the specified dependencies, the slice.
This will be used by systemd-analyze to allow checking individual unit files in isolation.
Maanya Goenka [Thu, 29 Jul 2021 20:01:08 +0000 (13:01 -0700)]
manager: use FLAGS_SET when checking for MANAGER_TEST_RUN_MINIMAL
Allows multiple flags to be set, for example, in systemd-analyze.
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Allow on/off and t/f for booleans too
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Provide error messages when parsing a config option fails
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Rework console input handling
Fixes: #15847
Probably fixes: #19191
Lennart Poettering [Thu, 12 Aug 2021 14:04:40 +0000 (16:04 +0200)]
Merge pull request #20199 from ddstreet/unit_cgroup_catchup
cgroup: do 'catchup' for unit cgroup inotify watch files
Maanya Goenka [Tue, 10 Aug 2021 21:30:46 +0000 (14:30 -0700)]
systemd-analyze: parse ip_filters_custom_egress correctly
Fixed bug in original assignment of security_info variable: ip_filters_custom_egress.
Yu Watanabe [Thu, 12 Aug 2021 04:39:53 +0000 (13:39 +0900)]
network: fix configuring of CAN devices
Fix a bug introduced by
7558f9e717381eef0ddc8ddfb5a754ea4b0f3e6c.
Fixes #20428.
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Use StrSize where it makes sense
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Assert all the things!
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Add assert implementation
There is a ASSERT() macro from gnu-efi, but that does not show any
output to ConOut. Having to do some additional setup just to get
some debug output is tedious and outright difficult on real hardware.
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Fix possible null pointer dereference
Auto entries are showing garbage for the version in print_status()
because StrDuplicate does not expect null pointers.
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Don't use magic integer constants
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Unify error handling
log_error_stall() and log_error_status_stall() will ensure the user has
a chance to catch an error message by stalling and also forcing a
lightred/black color on it. Also, convert several Print() calls to it
since they are actually error messages.
Lennart Poettering [Thu, 12 Aug 2021 07:34:21 +0000 (09:34 +0200)]
Merge pull request #20418 from yuwata/hostnamed-fix-20417
hostname: fix off-by-one issue in gethostname()
Yu Watanabe [Thu, 12 Aug 2021 05:45:40 +0000 (14:45 +0900)]
test-network: add a testcase for recreating stacked netdevs
Yu Watanabe [Thu, 12 Aug 2021 05:31:27 +0000 (14:31 +0900)]
network: recreate stacked netdevs when underlying device is re-added
Closes #20430.
Yu Watanabe [Thu, 12 Aug 2021 05:38:34 +0000 (14:38 +0900)]
network: adjust log messages, function names, etc.
Yu Watanabe [Thu, 12 Aug 2021 05:23:54 +0000 (14:23 +0900)]
network: use netdev_enter_failed() instead of netdev_drop() on error
Preparation for later commits to support reconfiguring netdevs.
Yu Watanabe [Thu, 12 Aug 2021 05:10:45 +0000 (14:10 +0900)]
network: introduce a helper function netdev_is_stacked_and_independent()
Yu Watanabe [Tue, 10 Aug 2021 18:44:24 +0000 (03:44 +0900)]
hostname: introduce gethostname_full() and use it in various gethostname() variants
Yu Watanabe [Tue, 10 Aug 2021 15:12:40 +0000 (00:12 +0900)]
hostname: fix off-by-one issue in gethostname()
gethostname() returns null-terminated hostname.
Fixes #20309 and #20417.
Luca Boccassi [Wed, 11 Aug 2021 17:40:00 +0000 (18:40 +0100)]
Merge pull request #20423 from yuwata/dhcp-server-static-lease-outside-pool
sd-dhcp-server: support static lease outside of pool
Andrej Lajovic [Sun, 8 Aug 2021 23:43:54 +0000 (01:43 +0200)]
shared/copy: add a new flag COPY_ALL_XATTRS
When the flag COPY_ALL_XATTRS is set, it causes the complete set of xattrs
to be copied. If the flag is unset, only xattrs from the "user" namespace
are copied.
Fixes #17178.
Lennart Poettering [Wed, 11 Aug 2021 15:47:45 +0000 (17:47 +0200)]
Merge pull request #20419 from keszybz/setenv-no-value
Allow --setenv=FOO in various programs
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
macro: Move some macros to macro-fundamental.h
Also, make sure STRLEN works with wide strings too.
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:58:17 +0000 (17:58 +0200)]
activate: simplify/rework implementation of --setenv
Previous implementation is simplified by using the new helper. The new code
does more looping, but considering that it's unlikely that people set more
than a handful of variables through commandline options, this should be OK.
If a variable is specified on the command line, it overrides any automatically
set variable. Effective behaviour was already were like this, because we would
specify two variables, both would be set, and since glibc will return
the first matching entry.
('systemd-socket-activate -E TERM=FOO -l 2000 --inetd -a env' would give
'TERM=FOO TERM=xterm-256color PATH=...', and getenv("TERM") returns "FOO".)
But it's nicer to filter out any duplicate entries and only pass the intended
variable to the child process.
Lennart Poettering [Wed, 11 Aug 2021 08:02:46 +0000 (10:02 +0200)]
Merge pull request #20079 from maanyagoenka/img-support
systemd-analyze: root validation and verify support for root arg and discrete images
Yu Watanabe [Wed, 11 Aug 2021 07:42:06 +0000 (16:42 +0900)]
test-network: test static lease outside of pool
Yu Watanabe [Wed, 11 Aug 2021 07:18:45 +0000 (16:18 +0900)]
sd-dhcp-server: support static lease outside of address pool
Closes #20341.
Yu Watanabe [Wed, 11 Aug 2021 07:20:35 +0000 (16:20 +0900)]
sd-dhcp-server: fix possible double-free or use-after-free
Yu Watanabe [Wed, 11 Aug 2021 06:25:20 +0000 (15:25 +0900)]
sd-dhcp-server: use hashmap_ensure_put()
MertsA [Wed, 11 Aug 2021 03:54:50 +0000 (20:54 -0700)]
Get rid of dangling setutxent()
utmp_wall() and utmp_put_dead_process() called setutxent() directly instead of the stub in utmp-wtmp.h and never called endutxent(). This would leave /run/utmp left open by PID 1 or journald. This can be reproduced by e.g. lsof /run/utmp and systemd-cat -p 0 echo test. For utmp_put_dead_process() it would only leave it open if it returned early before calling write_utmp_wtmp()
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:34:07 +0000 (17:34 +0200)]
activate: use global variable instead of passing char **envp around
The effect should be the same, but the code is less verbose.
In particular, the variable was called envp in parts of the code,
but in other parts, we had a local envp variable, and envp was called
env.
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:28:47 +0000 (17:28 +0200)]
machinectl: allow --setenv=FOO
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:25:47 +0000 (17:25 +0200)]
run: allow --setenv=FOO
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:19:31 +0000 (17:19 +0200)]
homectl: allow --setenv=FOO
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:11:56 +0000 (17:11 +0200)]
nspawn: allow --setenv=FOO as equivalent to --setenv=FOO=$FOO
systemd-socket-activate has supported such a mode since
5e65c93a433447b15180249166f7b3944c3e6156. '--setenv=FOO=$FOO' is a fairly
common use in scripts, and it's nicer to do this automatically without worrying
about quoting and whatnot.
https://github.com/systemd/mkosi/pull/765 added the same to 'mkosi --environment='.
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 15:03:12 +0000 (17:03 +0200)]
basic/env-util: add a mode where we pull in the variable value from environment
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 14:53:00 +0000 (16:53 +0200)]
test-env-util: extend the test for strv_env_merge() a bit
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 08:16:19 +0000 (10:16 +0200)]
Add implicit sentinel to strv_env_merge()
Just to make it a tiny bit nicer to use.
Lennart Poettering [Tue, 10 Aug 2021 12:36:00 +0000 (14:36 +0200)]
alloc-util: make mfree() typesafe
Make sure we return the same type as we accept.
One incorrect use of mfree() is discovered and fixed this way.
Luca Boccassi [Tue, 10 Aug 2021 19:32:29 +0000 (20:32 +0100)]
Merge pull request #20414 from yuwata/sd-dhcp6-client-trivial-fixes
sd-dhcp6-client: several fixes and cleanups
Luca Boccassi [Tue, 10 Aug 2021 19:31:36 +0000 (20:31 +0100)]
Merge pull request #20413 from poettering/mempmen
add and use mempmem_safe()
Lennart Poettering [Tue, 10 Aug 2021 12:50:54 +0000 (14:50 +0200)]
core: don't go to disk for masked unit state if we know it anyway
This should speed up our selinux checks a bit, since in most cases we
already know if a unit is masked, so use that info.
Maanya Goenka [Wed, 4 Aug 2021 19:00:31 +0000 (12:00 -0700)]
systemd-analyze: add root to find and verify executable
Maanya Goenka [Wed, 4 Aug 2021 18:59:45 +0000 (11:59 -0700)]
path-util: teach find_executable_full how to look into the root directory
When the root parameter in find_executable_full is set, chase_symlinks prefixes this root
to every check of the path name to find the complete path of the execuatble in case the
path provided is not absolute. This is only done for the non NULL root because otherwise
the chase_symlinks function would alter the behavior of some of the callers which would
in turn alter the outputs in a way that is undesirable. The find_execuatble_full function is
invoked by the verify_executable function in analyze-verify.
Yegor Alexeyev [Sun, 25 Jul 2021 02:20:27 +0000 (05:20 +0300)]
units: added factory-reset.target
Jack Dähn [Tue, 3 Aug 2021 06:07:05 +0000 (08:07 +0200)]
resolved: Don't omit AD bit in reply if DO is set in the query
Set the AD bit in the response if the data is authenticated and AD or DO is set in the query, as suggested by section 5.8 of RFC6840.
Fixes #20332
Michael Biebl [Mon, 9 Aug 2021 17:45:48 +0000 (19:45 +0200)]
test: fix TEST-10-ISSUE-2467
Depending on the timing, socat will either get ECONNREFUSED oder EPIPE
from systemd. The latter will cause it to exit(1) and subsequently the
test to fail.
We are not actually interested in the return code of socat though. The
test is supposed to check, whether rate limiting of a socket unit works
properly.
So ignore any failures from the socat invocation and instead check, if
test10.socket is in state "failed" with result "trigger-limit-hit" after
it has been triggered.
TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should
give systemd enough time even on slower machines, to reach the trigger
limit.
For better readability, break the test into separate ExecStart lines.
Fixes #19154.
Lennart Poettering [Tue, 10 Aug 2021 12:35:42 +0000 (14:35 +0200)]
update TODO
Yu Watanabe [Tue, 10 Aug 2021 12:57:42 +0000 (21:57 +0900)]
sd-dhcp6-client: use SYNTHETIC_ERRNO()
Lennart Poettering [Tue, 10 Aug 2021 12:39:57 +0000 (14:39 +0200)]
tree-wide: use memmem_safe()
Let's be paranoid and do something useful if we operate with empty
haystack/needle. This doesn't actually fix anything, as the places as
far as I can see check for non-emptyness already beforehand, but I will
sleep safer at night, if we don't even allow the trap to be fallen in,
ever, even if the code is changed sooner or later.
Lennart Poettering [Tue, 10 Aug 2021 12:37:00 +0000 (14:37 +0200)]
memory-util: add mempmem_safe()
This is like memmem_safe() but returns a pointer after the needle,
instead to the beginning of the needle.
This is then used at one place. Not much, but it makes me sleep safer at
night, as it avoids the manual counting done so far.
Yu Watanabe [Tue, 10 Aug 2021 12:39:27 +0000 (21:39 +0900)]
sd-dhcp6-client: cirtainly adjust T1 and T2
This fixes a bug introduced by
99f1d3fc5043b33dea5faa88f7015a487965333f.
Note that in the information requesting mode, the lease has neither
addresses nor PD prefixes.
Yu Watanabe [Tue, 10 Aug 2021 12:36:04 +0000 (21:36 +0900)]
sd-dhcp6-client: fix copy-and-paste mistake
Fix bug introduced by
b47fb949b338a8e77be789542fffb8c86da79284.
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 06:37:50 +0000 (08:37 +0200)]
fstab-generator: put What= before Where=
All units in units/ follow this pattern, as do all other generators that we
provide. The question of the order was raised in
https://github.com/systemd/zram-generator/pull/90#discussion_r684965984,
and I think it's nice to make it consistent everywhere
(What= before Where= matches mount(8) and fstab(5)).
Lennart Poettering [Tue, 10 Aug 2021 11:28:48 +0000 (13:28 +0200)]
Merge pull request #19959 from yuwata/udev-reduce-loop
udev: reduce number of times checking event dependency
Yu Watanabe [Tue, 10 Aug 2021 10:44:39 +0000 (19:44 +0900)]
Merge pull request #20410 from yuwata/network-ndisc-cleanups
network: several NDisc cleanups
Yu Watanabe [Tue, 10 Aug 2021 10:44:14 +0000 (19:44 +0900)]
Merge pull request #19939 from yuwata/network-dhcp-client-use-request-queue
network: use request queue to configure DHCP clients
Yu Watanabe [Tue, 10 Aug 2021 10:43:54 +0000 (19:43 +0900)]
Merge pull request #19901 from yuwata/network-reconfigure-after-sleep
network: reconfigure interface after coming back from sleep
Maanya Goenka [Wed, 30 Jun 2021 17:02:51 +0000 (10:02 -0700)]
systemd-analyze: support discrete images for 'verify' verb
Adding --image parameter for verify verb using the dissect image functionality
-----------------------------------------------------------------------------------
Example Run:
I created a unit service file testrun.service with an invalid key-value pairing
(foo = bar) and a squashfs image run.raw to test the code.
maanya-goenka@debian:~/systemd (img-support)$ cat <<EOF>img/usr/lib/systemd/system/testrun.service
> [Unit]
> foo = bar
>
> [Service]
> ExecStart = /opt/script0.sh
> EOF
maanya-goenka@debian:~/systemd (img-support)$ mksquashfs img/ run.raw
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on run.raw, block size 131072.
[==============================================================================================================================|] 6/6 100%
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments, compressed xattrs
duplicates are removed
Filesystem size 0.60 Kbytes (0.00 Mbytes)
52.32% of uncompressed filesystem size (1.14 Kbytes)
Inode table size 166 bytes (0.16 Kbytes)
43.01% of uncompressed inode table size (386 bytes)
Directory table size 153 bytes (0.15 Kbytes)
58.40% of uncompressed directory table size (262 bytes)
Number of duplicate files found 1
Number of inodes 12
Number of files 6
Number of fragments 1
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 6
Number of ids (unique uids + gids) 1
Number of uids 1
maanya-goenka (1000)
Number of gids 1
maanya-goenka (1000)
maanya-goenka@debian:~/systemd (img-support)$ sudo build/systemd-analyze verify --image=run.raw testrun.service
/tmp/.#systemd-analyzec71c7297a936b91c/usr/lib/systemd/system/testrun.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
testrun.service: Failed to create testrun.service/start: Unit sysinit.target not found.
The 'Unit sysinit.target not found' error that we see here is due to recursive dependency searching during
unit loading and has been addressed in a different PR:
systemd-analyze: add option to return an error value when unit verification fails #20233
Maanya Goenka [Wed, 30 Jun 2021 16:57:54 +0000 (09:57 -0700)]
systemd-analyze: add --root option for 'verify' verb and allow path parsing
-------------------------------------------------------------------------------
Example Run:
foobar.service created below is a service unit file that has a non-existing key-value
pairing (foo = bar) and is thus, syntactically invalid.
maanya-goenka@debian:~/systemd (img-support)$ cat <<EOF>img/usr/lib/systemd/system/foobar.service
> [Unit]
> foo = bar
>
> [Service]
> ExecStart = /opt/script0.sh
> EOF
The failure to create foobar.service because of the recursive dependency searching and verification has been addressed
in a different PR: systemd-analyze: add option to return an error value when unit verification fails #20233
maanya-goenka@debian:~/systemd (img-support)$ sudo build/systemd-analyze verify --root=img/ foobar.service
/home/maanya-goenka/systemd/img/usr/lib/systemd/system/foobar.service:2: Unknown key name 'foo' in section 'Unit', ignoring.
foobar.service: Failed to create foobar.service/start: Unit sysinit.target not found.
Maanya Goenka [Wed, 30 Jun 2021 16:28:19 +0000 (09:28 -0700)]
systemd-analyze: validate root argument
Yu Watanabe [Thu, 17 Jun 2021 08:14:10 +0000 (17:14 +0900)]
udev: skip event when its dependency cannot be checked
Yu Watanabe [Thu, 17 Jun 2021 07:57:32 +0000 (16:57 +0900)]
udev: do not try to find blocker again when no blocker found previously
Yu Watanabe [Thu, 17 Jun 2021 07:12:06 +0000 (16:12 +0900)]
list: introduce LIST_FOREACH_BACKWARDS() macro and drop LIST_FOREACH_AFTER/BEFORE()
Yu Watanabe [Thu, 17 Jun 2021 07:14:01 +0000 (16:14 +0900)]
udev: rename is_device_busy() -> event_is_blocked()
Also this rename delaying_seqnum -> blocker_seqnum.
Yu Watanabe [Thu, 17 Jun 2021 06:51:34 +0000 (15:51 +0900)]
udev: do not try to process events if there is no free worker
Yu Watanabe [Thu, 17 Jun 2021 06:47:34 +0000 (15:47 +0900)]
udev: propagate error on spawning a worker
Yu Watanabe [Thu, 17 Jun 2021 06:41:20 +0000 (15:41 +0900)]
udev: add usec_add() at one more place
Yu Watanabe [Thu, 17 Jun 2021 06:29:02 +0000 (15:29 +0900)]
udev: make event_queue_start() return negative errno on error
Yu Watanabe [Thu, 17 Jun 2021 06:21:27 +0000 (15:21 +0900)]
udev: make event_free() return NULL
Yu Watanabe [Wed, 16 Jun 2021 12:02:01 +0000 (21:02 +0900)]
udev: update log message to clarify that the error is ignored
Yu Watanabe [Thu, 17 Jun 2021 06:14:59 +0000 (15:14 +0900)]
udev: move several functions
No functional chage.
Yu Watanabe [Wed, 16 Jun 2021 10:18:56 +0000 (19:18 +0900)]
udev: also rename struct udev_ctrl -> UdevCtrl
Yu Watanabe [Wed, 16 Jun 2021 10:05:39 +0000 (19:05 +0900)]
udev: rename type name e.g. struct worker -> Worker
Yu Watanabe [Wed, 30 Jun 2021 21:42:55 +0000 (06:42 +0900)]
network: use usec_add() at several more places
Yu Watanabe [Wed, 30 Jun 2021 21:37:44 +0000 (06:37 +0900)]
network: make IPv6Token private, and ipv6token_new() static
Yu Watanabe [Wed, 30 Jun 2021 19:12:20 +0000 (04:12 +0900)]
network: ndisc: update a log message
Also slightly rename functions.