Commit Graph
50475 Commits
Author SHA1 Message Date
jauge-technica 82f2a2f032 Added support for L2 BridgeMDB entries (#32894)
* Added support for L2 BridgeMDB entries
2024-08-02 16:31:20 +01:00
Yu Watanabe 40d90c9c01 localectl: introduce -l/--full option
Closes #33906.
2024-08-02 09:33:46 +02:00
Yu Watanabe 44557e03d8 Merge pull request #33032 from yuwata/sd-device-monitor-low-level-api
sd-device-monitor: expose low-level functions
2024-08-02 12:41:53 +09:00
Yu Watanabe 76459af531 Merge pull request #33876 from dbnicholson/firstboot-root-creds-only
firstboot: fix root params with creds and prompting disabled
2024-08-02 11:37:05 +09:00
Ronan Pigott ddd710a355 resolved: don't treat conn reset as packet loss
tcp reset / icmp port-unreachable are markedly different conditions than
packet loss. It doesn't make much sense to retry in this case. It's
actually not clear if there is any benefit at all retrying tcp
connections, which were presumably already retried as necessary by the
tcp stack.
2024-08-02 11:29:25 +09:00
Yu Watanabe 0bc6fde08a test: add test case for restarting device monitor 2024-08-02 11:22:24 +09:00
Yu Watanabe 9d37cf28a3 sd-device-monitor: rename device_monitor_send_device() -> device_monitor_send() 2024-08-02 11:22:24 +09:00
Yu Watanabe bab889c51e sd-device-monitor: expose low-level functions
To make it work without sd-event.

Prompted by recent chat:
> Hey all!
> reading man libudev, it says to use sd-device instead now. I've read that
> APIs header file and it seems it no longer has an equivalent to libudev's
> udev_monitor_get_fd, which AFAICT means I have to use sd-event to watch
> for events I'm interested in. I know I can "embed" sd-event in other event
> loops I might already have, but that seems overkill when I'm only interested
> in this one type of event and don't need sd-event for anything else.
2024-08-02 11:22:24 +09:00
Yu Watanabe d3fa16131e sd-device-monitor: make device_monitor_receive_device() always initialize ret on success 2024-08-02 11:22:07 +09:00
Yu Watanabe 67825de267 sd-device-monitor: remove device_monitor_disconnect()
It is not necessary to be exposed anymore.
2024-08-02 11:16:33 +09:00
Yu Watanabe 98ca8eac11 udev: manage only socket address of device monitor
Previously, the main process of systemd-udevd manages worker process
with their sd_device_monitor object to save the destination address.
Let's save only destination address, and drop worker's sd_device_monitor
object.
2024-08-02 11:16:33 +09:00
Yu Watanabe 7abc0201d0 sd-device-monitor: introduce device_monitor_get_address()
Currently it is used internally, but will be used later at other places.
2024-08-02 11:16:33 +09:00
Yu Watanabe 1f267e77ed sd-device: allow to restart device monitor
Previously, sd_device_monitor_stop() closes socket, hence we cannot
restart monitoring unless recreating sd_device_monitor object.
Let's allow to restart monitor by sd_device_monitor_start().
2024-08-02 11:16:33 +09:00
Yu Watanabe ece1e280ee sd-device-monitor: introduce sd_device_monitor_is_running() 2024-08-02 11:16:33 +09:00
Yu Watanabe f49faf0562 sd-device-monitor: bind socket in device_monitor_new_full()
Previously, device_monitor_enable_receiving() does
- update filter,
- bind socket.

But, binding socket can be done in when the socket is opened.
Let's remove device_monitor_enable_receiving() and bind the socket in
device_monitor_new_full().
2024-08-02 11:16:33 +09:00
Yu Watanabe bf1283c1fb sd-device-monitor: replace -1 with -EBADF 2024-08-02 11:16:33 +09:00
Yu Watanabe 0403221a2a test: modernize test-sd-device-monitor.c 2024-08-02 11:16:33 +09:00
Yu Watanabe 029709f932 socket-util: introduce netlink_socket_get_multicast_groups()
No functional change. Preparation for later commits.
2024-08-02 11:16:33 +09:00
Yu Watanabe f7012a93a7 import: check overflow
Fixes CID#1548022 and CID#1548075.
2024-08-01 22:45:53 +09:00
Yu Watanabe fea2f92d8d test: use ASSERT_OK_ERRNO() for setenv() and unsetenv() 2024-08-01 22:42:08 +09:00
Yu Watanabe 6141fe925a test: resolve "Unchecked return value" coverity warning
Follow-up for c8210d98a4.
Fixes CID#1548920.
2024-08-01 22:42:08 +09:00
Yu Watanabe a30ac8d52c vmspawn: check overflow earlier
Follow-up for 862c68a914.
Fixes CID#1550749.
2024-08-01 22:42:08 +09:00
Yu Watanabe 96bf7e1f3b test: resolve "Unchecked return value" coverity warning
Follow-up for 5fef5552a6.
Fixes CID#1558540.
2024-08-01 22:42:08 +09:00
Yu Watanabe dc7607f687 test: resolve "Unchecked return value" coverity warning
Follow-up for 8c57700b6b.
Fixes CID#1558539.
2024-08-01 22:42:08 +09:00
Yu Watanabe a8bc75089d journalctl: fix compile error on i386
Fixes the following error:
===
In file included from ../src/basic/macro.h:13,
                 from ../src/basic/dirent-util.h:8,
                 from ../src/journal/journalctl-misc.c:3:
../src/journal/journalctl-misc.c: In function 'show_log_ids':
../src/journal/journalctl-misc.c:107:22: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  107 |         assert(n_ids < INT64_MAX);
      |                      ^
../src/fundamental/macro-fundamental.h:70:44: note: in definition of macro '_unlikely_'
   70 | #define _unlikely_(x) (__builtin_expect(!!(x), 0))
      |                                            ^
../src/basic/macro.h:165:22: note: in expansion of macro 'assert_message_se'
  165 | #define assert(expr) assert_message_se(expr, #expr)
      |                      ^~~~~~~~~~~~~~~~~
../src/journal/journalctl-misc.c:107:9: note: in expansion of macro 'assert'
  107 |         assert(n_ids < INT64_MAX);
      |         ^~~~~~
cc1: all warnings being treated as errors
===

Follow-up for 0a8c1f6212.
2024-08-01 10:49:40 +02:00
Yu Watanabe 12a12c5af5 Merge pull request #33888 from YHNdnzj/followups
core: a few follow-ups for recent PRs
2024-08-01 11:35:13 +09:00
Yu Watanabe 7d3ae6b213 journalctl: add --list-invocations command and -I/--invocation options
The --list-invocations command is similar to --list-boots, but shows
invocation IDs of specified unit. This should be useful when showing
a specific invocation of a unit.

The --invocation option is similar to --boot, but takes a invocation ID
or an offset. The -I option is equivalent to --invocation=0.
2024-08-01 07:31:44 +09:00
Yu Watanabe 82721be7d6 logs-show: extend journal_get_boots() and friends to find invocation IDs
Currently the extended features are not used, but will be used later.
2024-08-01 07:31:44 +09:00
Yu Watanabe 1a997cb732 logs-show: introduce several helper functions
Currently these are not used, but will be used later.
2024-08-01 07:31:44 +09:00
Yu Watanabe 0a8c1f6212 use int64_t for index in show_log_ids() 2024-08-01 07:31:44 +09:00
Yu Watanabe b3a16f3985 journalctl: split out show_log_ids() from action_list_boots()
No functional change, just refactoring and prepraration for later change.
2024-08-01 07:31:44 +09:00
Yu Watanabe a581a2ce8d journalctl: update log messages 2024-08-01 07:31:44 +09:00
Yu Watanabe 6ecee6cf2b logs-show: rename BootId -> LogId
The struct itself is generic, and can be used for other ID.
Let's rename it to more generic one.
No functional change, just refactoring and preparation for later
commits.
2024-08-01 07:31:44 +09:00
Mike Yuan 4c523d62d2 core/socket: stop hardcoding every service inactive state
History (c068650fcf,
941a12dcba) has proven
that we're not good at keeping socket and service states
in sync. Instead, let's query the high-level unit_active_state()
first, and only hardcode the two special auto-restart
service states.

Additionally, allow returning to listening state on SERVICE_CLEANING.
2024-07-31 21:56:28 +02:00
Mike Yuan 067c91fcb8 core/cgroup: use UNIT_IS_INACTIVE_OR_FAILED where appropriate 2024-07-31 21:40:28 +02:00
Mike Yuan 8574b7940b core/unit: merge use of LOG_CONTEXT_SET_LOG_LEVEL into LOG_CONTEXT_PUSH_UNIT
No functional change, since LOG_CONTEXT_PUSH_UNIT is only used
in exec_spawn().
2024-07-31 21:40:28 +02:00
Mike Yuan c4c416b109 core: clean up ambient capability logging
Follow-up for e0ebc81b2d
2024-07-31 21:40:28 +02:00
Daan De Meyer ff5662129a Merge pull request #33885 from DaanDeMeyer/pidref-kthread
Two pidfd fixes
2024-07-31 19:07:35 +02:00
Daan De Meyer e54a8e0fc3 Merge pull request #33873 from DaanDeMeyer/rename-creds
core: Add support for renaming credentials with ImportCredential=
2024-07-31 17:35:58 +02:00
Michal Sekletar 941a12dcba socket: fix socket activation of stopped services with pinned FD store 2024-07-31 16:29:07 +02:00
Luca Boccassi 0e5c97ae6f Merge pull request #32937 from steelman/github/drop-ambient-caps-executor
core: drop ambient capabilities in systemd-executor
2024-07-31 16:11:30 +02:00
Daan De Meyer 831f208783 core: Add support for renaming credentials with ImportCredential=
This allows for "per-instance" credentials for units. The use case
is best explained with an example. Currently all our getty units
have the following stanzas in their unit file:

"""
ImportCredential=agetty.*
ImportCredential=login.*
"""

This means that setting agetty.autologin=root as a system credential
will make every instance of our all our getty units autologin as the
root user. This prevents us from doing autologin on /dev/hvc0 while
still requiring manual login on all other ttys.

To solve the issue, we introduce support for renaming credentials with
ImportCredential=. This will allow us to add the following to e.g.
serial-getty@.service:

"""
ImportCredential=tty.serial.%I.agetty.*:agetty.
ImportCredential=tty.serial.%I.login.*:login.
"""

which for serial-getty@hvc0.service will make the service manager read
all credentials of the form "tty.serial.hvc0.agetty.xxx" and pass them
to the service in the form "agetty.xxx" (same goes for login). We can
apply the same to each of the getty units to allow setting agetty and
login credentials for individual ttys instead of globally.
2024-07-31 15:52:27 +02:00
Daan De Meyer 3de13e6148 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.
2024-07-31 15:23:45 +02:00
Daan De Meyer 590348e2bf exec-credential: Log if we skip duplicate credential 2024-07-31 15:23:45 +02:00
Daan De Meyer 2c2ed3272b Drop EEXIST handling in load_credential_glob()
Credentials are written to a temporary file and renamed to the
destination with renameat() which will replace existing files so
EEXIST should not happen so drop the handling for EEXIST.
2024-07-31 15:23:45 +02:00
Daan De Meyer 5551426785 Merge pull request #33884 from DaanDeMeyer/log-context
log: Fix size calculation for number of iovecs
2024-07-31 14:23:08 +02:00
Daan De Meyer ead48ec35c cgroup-util: Don't try to open pidfd for kernel threads
The kernel might start returning -EINVAL when trying to open pidfd's
for kernel threads so let's not try to open pidfd's for kernel threads.
2024-07-31 13:50:16 +02:00
Daan De Meyer 9ce964d55b Merge pull request #33882 from bluca/efi_proto_fallback_memory
stub: allocate and zero enough space in legacy x86 handover protocol
2024-07-31 13:46:41 +02:00
Daan De Meyer fc83ff3f55 log: Fix size calculation for number of iovecs
Each log context field can expand to up to three iovecs (key, value
and newline) so let's fix the size calculation to take this into
account.
2024-07-31 13:12:55 +02:00
Daan De Meyer 7881f485c9 execute: Drop log level to unit log level in exec_spawn()
All messages logged from exec_spawn() are attributed to the unit
and as such we should set the log level to the unit's max log level
for the duration of the function.
2024-07-31 13:12:55 +02:00