Antonio Alvarez Feijoo
f824cd660a
journalctl-show/util: add missing header
...
```
[1237/2836] Compiling C object journalctl.p/src_journal_journalctl-show.c.o
FAILED: journalctl.p/src_journal_journalctl-show.c.o
cc -Ijournalctl.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -MD -MQ journalctl.p/src_journal_journalctl-show.c.o -MF journalctl.p/src_journal_journalctl-show.c.o.d -o journalctl.p/src_journal_journalctl-show.c.o -c ../src/journal/journalctl-show.c
../src/journal/journalctl-show.c: In function ‘setup_event’:
../src/journal/journalctl-show.c:330:38: error: ‘STDOUT_FILENO’ undeclared (first use in this function)
330 | r = sd_event_add_io(e, NULL, STDOUT_FILENO, EPOLLHUP|EPOLLERR, NULL, INT_TO_PTR(-ECANCELED));
| ^~~~~~~~~~~~~
../src/journal/journalctl-show.c:330:38: note: each undeclared identifier is reported only once for each function it appears in
[1238/2836] Compiling C object journalctl.p/src_journal_journalctl-util.c.o
FAILED: journalctl.p/src_journal_journalctl-util.c.o
cc -Ijournalctl.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -MD -MQ journalctl.p/src_journal_journalctl-util.c.o -MF journalctl.p/src_journal_journalctl-util.c.o.d -o journalctl.p/src_journal_journalctl-util.c.o -c ../src/journal/journalctl-util.c
../src/journal/journalctl-util.c: In function ‘acquire_journal’:
../src/journal/journalctl-util.c:36:60: error: ‘STDIN_FILENO’ undeclared (first use in this function)
36 | r = sd_journal_open_files_fd(&j, (int[]) { STDIN_FILENO }, 1, arg_journal_additional_open_flags);
| ^~~~~~~~~~~~
../src/journal/journalctl-util.c:36:60: note: each undeclared identifier is reported only once for each function it appears in
```
Fixes ade2db83fe
2024-03-27 13:14:46 +00:00
Yu Watanabe
95d3570b47
sd-ndisc-router: introduce sd_ndisc_router_set_sender_address()
...
Currently this is not used, but will be used later to modify the sender
address.
2024-03-27 13:13:12 +00:00
Yu Watanabe
9f3587ae44
ndisc-option: add HomeAgent option support
...
Currently, these are not used, but will be used later in sd-radv.
2024-03-27 13:12:30 +00:00
Luca Boccassi
5e8adf9f50
Merge pull request #31965 from yuwata/logs-show-cleanups
...
logs-show: several cleanups
2024-03-27 13:09:56 +00:00
Luca Boccassi
c3c5be4836
Merge pull request #31964 from yuwata/journalctl-filter-cleanups
...
journalctl-filter: several cleanups
2024-03-27 13:07:43 +00:00
Luca Boccassi
66f35161f6
core: add counter for soft-reboot iterations
...
Allow to query via D-Bus how many times the current booted system has
been soft rebooted
2024-03-27 01:27:35 +00:00
Luca Boccassi
7addfba9c4
analyze: show only current times after soft-reboot
...
The firmware/loader/kernel times are no longer relevant for the startup
sequence on soft-reboot, so use only the userspace timestamps
2024-03-27 01:27:34 +00:00
Luca Boccassi
54f86b86ba
core: add SoftRebootStartTimestamp
...
Will be useful to calculate how long it took to shut down the system before starting
in the new root
2024-03-27 01:25:49 +00:00
Luca Boccassi
375d091f71
core: do not serialize timestamps that are re-measured on soft-reboot
...
Otherwise the de-serialization overwrites the timestamps taken after
soft-reboot (e.g.: userspace start/finish) and sd-analyze shows bogus
data
2024-03-27 01:25:49 +00:00
Yu Watanabe
93998559f8
Merge pull request #31789 from jsitnicki/socket-pass-fds-to-exec
...
Pass socket FDs to all ExecXYZ= commands in socket unit but ExecStartPre=
2024-03-27 10:18:13 +09:00
Ronan Pigott
0dfea62ee3
resolved: always return the validated answers when validating
...
We normally expect sd-resolved only to return the validated subset of a
validated response. In some cases we give up on validating, because we
have enough information already to conclude the answer is bogus.
Let's be sure to always reply with only the validated subset in these
cases too, so that we don't return bogus answers and confuse primitive
clients that won't see the SERVFAIL rcode.
2024-03-27 10:17:15 +09:00
Ronan Pigott
4001710365
resolved: minor dnssec fixups
...
Fixes: ce5b9d5b3c ("resolved: request DS with DNSKEY")
2024-03-27 10:16:38 +09:00
Zbigniew Jędrzejewski-Szmek
1e8c0c671e
shared/logs-show: restore infinite loop avoidance for corrupted journals
...
Fixes a bug introduced in e44f06065b : it was
supposed to be a refactoring, but unfortunately FOREACH_ARRAY is implemented
using a for loop, so when the 'goto finish' was replaced by 'break', it only
broke the inner loop, leading to a infinite loop.
2024-03-27 10:16:16 +09:00
Yu Watanabe
193134de54
home: fix typo
...
Follow-up for 5ec87d577f .
2024-03-27 04:07:51 +09:00
Jakub Sitnicki
97df75d7bd
socket: pass socket FDs to all ExecXYZ= commands but ExecStartPre=
...
Today listen file descriptors created by socket unit don't get passed to
commands in Exec{Start,Stop}{Pre,Post}= socket options.
This prevents ExecXYZ= commands from accessing the created socket FDs to do
any kind of system setup which involves the socket but is not covered by
existing socket unit options.
One concrete example is to insert a socket FD into a BPF map capable of
holding socket references, such as BPF sockmap/sockhash [1] or
reuseport_sockarray [2]. Or, similarly, send the file descriptor with
SCM_RIGHTS to another process, which has access to a BPF map for storing
sockets.
To unblock this use case, pass ListenXYZ= file descriptors to ExecXYZ=
commands as listen FDs [4]. As an exception, ExecStartPre= command does not
inherit any file descriptors because it gets invoked before the listen FDs
are created.
This new behavior can potentially break existing configurations. Commands
invoked from ExecXYZ= might not expect to inherit file descriptors through
sd_listen_fds protocol.
To prevent breakage, add a new socket unit parameter,
PassFileDescriptorsToExec=, to control whether ExecXYZ= programs inherit
listen FDs.
[1] https://docs.kernel.org/bpf/map_sockmap.html
[2] https://lore.kernel.org/r/20180808075917.3009181-1-kafai@fb.com
[3] https://man.archlinux.org/man/socket.7#SO_INCOMING_CPU
[4] https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
2024-03-27 01:41:26 +08:00
Yu Watanabe
d30d0b04ae
Merge pull request #31951 from bluca/resolve_reload
...
resolved: support reloading configuration at runtime
2024-03-27 02:37:52 +09:00
Yu Watanabe
18640f8211
Merge pull request #31959 from YHNdnzj/execute-pass-fds
...
core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
2024-03-27 02:37:23 +09:00
Yu Watanabe
5c7292fa80
Merge pull request #31960 from YHNdnzj/capsule-followup
...
Some follow-ups for capsule
2024-03-27 02:34:43 +09:00
Antonio Alvarez Feijoo
dde1931b06
dissect: fix memory leak
2024-03-27 02:33:00 +09:00
Yu Watanabe
0aad30d4b5
logs-show: read the current boot ID if nothing specified for add_match_boot_id()
...
No functional change, just refactoring.
2024-03-26 23:54:46 +09:00
Yu Watanabe
8e976dc920
sd-id128: move get_boot_id_for_machine() to id128-util.c
...
And rename it to id128_get_boot_for_machine().
This also splits out id128_get_boot() from sd_id128_get_boot(), and
make id128_get_boot_for_machine() use it.
2024-03-26 23:54:46 +09:00
Yu Watanabe
96a7f3fc75
journalctl-filter: several cleanups for add_matches()
...
- split it into small pieces to reduce indentation,
- return earlier if no filter specified,
- use journal_add_matchf() and journal_add_match_pair(),
chase_and_stat(), is_symlink(), and sd_device_new_from_devname(),
- replace sd_device_get_devname() + stat() with sd_device_get_devnum(),
- refuse to install filter by path with --root, --image, or --machine
at least now, as previously it has not worked anyway.
2024-03-26 23:51:47 +09:00
Yu Watanabe
bb59f34c21
journalctl-filter: add missing sd_journal_add_conjunction()
...
Otherwise, if --facility= is specified with extra matches with '+',
the facility filter will not be applied to the specified filter after '+'.
2024-03-26 23:51:47 +09:00
Yu Watanabe
22f2b5566d
journalctl-filter: several trivial cleanups
...
- declare iterator in loop,
- use journal_add_match_pair() and journal_add_matchf(),
- log failures in the caller.
2024-03-26 23:51:47 +09:00
Yu Watanabe
5d53eef97b
journalctl-filter: modernize add_units()
...
- add missing assertions,
- use set_ensure_consume() and strv_consume(),
- use string_hash_ops_free and _cleanup_set_free_,
- use strv_fnmatch_full(),
- replace unused counter with a boolean flag,
- return earlier if no unit filtering is requested.
2024-03-26 23:51:46 +09:00
Yu Watanabe
17c512f1cc
Merge pull request #31879 from yuwata/journalctl-split
...
journalctl: split journalctl.c into small pieces
2024-03-26 23:45:20 +09:00
Yu Watanabe
073f438365
ndisc-option: sort options in sent message
...
To make the sent message reproducible.
2024-03-26 13:58:36 +00:00
Luca Boccassi
d1b08f2460
Merge pull request #31943 from yuwata/sd-ndisc-option-getter-remover
...
sd-ndisc: introduce option getter and remover
2024-03-26 13:55:46 +00:00
Yu Watanabe
846efaf532
sd-ndisc-protocol: list up all known options
...
See below for more details:
https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5
2024-03-26 13:53:42 +00:00
Mike Yuan
8e34fdb884
bus-util: dedup bus_set_address_capsule
...
Follow-up for ad963c3f56
2024-03-26 21:40:10 +08:00
Luca Boccassi
14a5217679
resolved: support reloading configuration at runtime
...
Drop connections and caches and reload config from files, to allow
for low-interruptions updates, and hook up to the usual SIGHUP and
ExecReload=. Mark servers and services configured directly via D-Bus
so that they can be kept around, and only the configuration file
settings are dropped and reloaded.
Fixes https://github.com/systemd/systemd/issues/17503
Fixes https://github.com/systemd/systemd/issues/20604
2024-03-26 13:36:42 +00:00
Yu Watanabe
2129240447
journalctl-show: split out seek_journal()
...
No functional change, just refactoring.
2024-03-26 22:25:24 +09:00
Yu Watanabe
ade2db83fe
journalctl: split journalctl.c into small pieces
...
And introduces per-action functions.
No functional change, just refactoring.
2024-03-26 22:24:24 +09:00
Yu Watanabe
adc8a60b88
journalctl: use correct type for flags
...
This also moves its declaration, as it is not changed in the loop.
2024-03-26 22:21:13 +09:00
Yu Watanabe
dc586975b2
journalctl: merge three if blocks for seeking to the initial position
...
No functional change, just refactoring.
2024-03-26 22:21:13 +09:00
Mike Yuan
2a17866bbd
systemctl,busctl: sort includes
...
Follow-up for 56cb74c3cd
and 00431b2b66
2024-03-26 21:08:49 +08:00
Mike Yuan
b377a7cce9
daemon-util: introduce notify_reloading helper
...
Prompted by #31951
2024-03-26 12:52:33 +00:00
Zbigniew Jędrzejewski-Szmek
c38e4e2fda
Merge pull request #29721 from poettering/systemd-project
...
New capsule@.service feature
2024-03-26 13:19:33 +01:00
Mike Yuan
07ff03d6b2
core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
...
Prompted by #31789 (specifically
https://github.com/systemd/systemd/pull/31789#discussion_r1525267612 )
2024-03-26 20:08:52 +08:00
Mike Yuan
469ff6b40e
core/service: remove redundant Unit.type check
...
SOCKET(u) returns NULL if the type doesn't match.
2024-03-26 18:55:19 +08:00
Dionna Amalie Glaze
dbbd878340
efi: Measure into both CC and TPM if available. ( #31939 )
...
* efi: Measure into both CC and TPM if available.
It's possible that both measurement protocols are made available, so
instead of assuming only one or the other are available, measure into
both to avoid a problem like CVE-2021-42299.
Signed-off-by: Dionna Glaze <dionnaglaze@google.com >
2024-03-26 09:26:59 +00:00
Luca Boccassi
b1d18b96c4
Merge pull request #31801 from flatcar-hub/krnowak/sysext-config
...
systemd-sysext: Add support for env vars, ephemeral layers and some fixes
2024-03-26 09:23:19 +00:00
Yu Watanabe
24578ce63a
ndisc-option: introduce ndisc_option_remove()
2024-03-26 03:30:41 +09:00
Yu Watanabe
697c3693b3
ndisc-option: rename ndisc_option_get() -> ndisc_option_get_by_type()
...
Then, introduce more generic ndisc_option_get().
2024-03-26 03:30:41 +09:00
Mike Yuan
3b09af2004
home/homework: use FOREACH_ARRAY more
...
Prompted by #31932
2024-03-26 03:06:42 +09:00
Yu Watanabe
373452ff9f
Merge pull request #31932 from bluca/coverity
...
Fix coverity issues
2024-03-26 03:04:51 +09:00
Vitaly Kuznetsov
df94b28366
kernel-install/60-ukify: do not rebuild existing UKIs
...
In case kernel-install is called to install what's already a UKI, 60-ukify
must be skipped. E.g. when distro shipped and signed UKI is being installed,
it is counter-productive to try to rebuild it with ukify. Also, the existing
script is not ready to handle UKIs with embedded initramfs.
Note, it is already possible to disable 60-ukify by setting
KERNEL_INSTALL_UKI_GENERATOR to something but in case it is not set, 60-ukify
assumes it should run.
2024-03-26 03:01:30 +09:00
Yu Watanabe
0ffcf398e5
Merge pull request #31899 from yuwata/sd-journal-add-match
...
sd-journal: introduce two helpers for adding journal filter
2024-03-26 02:56:58 +09:00
Yu Watanabe
6871b9c638
Merge pull request #31807 from yuwata/sd-ndisc-send
...
sd-ndisc: introduce sd_ndisc_send()
2024-03-26 02:55:33 +09:00
Yu Watanabe
65265b51df
Merge pull request #31938 from YHNdnzj/journalctl-facility
...
journalctl: explicitly check < 0 for error
2024-03-26 02:23:50 +09:00