Commit Graph
4047 Commits
Author SHA1 Message Date
Beniamino Galvani f7996e2a33 network: add support for HSR netdev
Add support for creating HSR/PRP interfaces. HSR (High-availability Seamless
Redundancy) and PRP (Parallel Redundancy Protocol) are two protocols that
provide seamless failover against failure of any single network component. They
are both implemented by the "hsr" kernel driver.
2025-04-05 05:23:53 +09:00
Yu Watanabe c421abaf80 sd_journal_get_cursor() tweaks (#36964) 2025-04-03 04:11:35 +09:00
Lennart Poettering b49ba39071 sd-event: don't consider no pending IO event a programming error in sd_event_source_get_io_revents() 2025-04-03 04:07:44 +09:00
Lennart Poettering a7d58b7d3d varlink: add common helper that refuse method calls from unpriv clients 2025-04-03 04:07:08 +09:00
Yu Watanabe fd386a6a9d tree-wide: pass -EBADF to device_monitor_new_full()
Prompted by https://github.com/systemd/systemd/pull/36922#discussion_r2024940885.
2025-04-03 02:14:52 +09:00
Lennart Poettering 98d6578335 sd-journal: make return parameter to sd_journal_get_cursor() optional 2025-04-02 17:29:04 +02:00
Mike Yuan 6b4a05519b sd-bus/bus-common-errors: add missing error map entries 2025-03-29 19:51:13 +01:00
Luca Boccassi 5aee5bda1a tree-wide: introduce LOG_ITEM() macro for verifying format string (#36780)
This introduce `LOG_ITEM()` macro that checks format strings in
log_struct() and friends.

Hopefully, this silences false-positive warnings by Coverity.
2025-03-24 12:58:14 +00:00
Erik Larsson 6e529860ba networkd: add support for externally managed vxlan devices
With this a vxlan interface can be created which is managed by
for example a EVPN control plane.
2025-03-20 20:29:47 +09:00
Yu Watanabe db4b4e0cd3 core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN (#36771)
Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all
namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.
2025-03-20 06:28:18 +09:00
Lennart Poettering 179dcf924f sd-event: make pidfd copy in event_add_child_pidref()
So far we'd directly use the pidfd passed into event_add_child_pidref(),
hoping it would not be closed by the caller before we are done. This was
violated by vmspawn however.

Let's make this safe, and simply duplicate the fd, and make us
independent of the caller.
2025-03-19 18:14:24 +01:00
Daan De Meyer 9e34c34b7b sd_bus_open_user_machine(): Don't shortcut without necessary env
Don't shortcut if we don't have the necessary environment variables
set in sd_bus_open_user_machine().
2025-03-19 10:01:19 +01:00
Yu Watanabe 3cf6a3a3d4 tree-wide: check more log message format in log_struct() and friends
This introduce LOG_ITEM() macro that checks arbitrary formats in
log_struct().
Then, drop _printf_ attribute from log_struct_internal(), as it does not
help so much, and compiler checked only the first format string.

Hopefully, this silences false-positive warnings by Coverity.
2025-03-19 01:56:48 +09:00
Yu Watanabe a65d2de6d1 sd-varlink: fix overwrite of loop count
Fixes a bug introduced by 206504a594 (v255).
2025-03-19 01:47:20 +09:00
Zbigniew Jędrzejewski-Szmek 1ae9b0cfa8 basic/glyph-util: rename "special glyph" to just "glyph"
Admittedly, some of our glyphs _are_ special, e.g. "O=" for SPECIAL_GLYPH_TOUCH ;)
But we don't need this in the name. The very long names make some invocations
very wordy, e.g. special_glyph(SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY).
Also, I want to add GLYPH_SPACE, which is not special at all.
2025-03-15 14:40:39 +01:00
Yu Watanabe d9000d708c test: drop redundant parentheses in ASSERT_OK() and friends
This reverts 278e3adf50, and drop more
redundant parentheses, as they unfortunately does not suppress the
false-positive warnings by coverity.
2025-03-15 09:08:06 +09:00
Yu Watanabe 09e0ce8010 test: fix wrong use of ASSERT_OK() and friends 2025-03-15 08:56:38 +09:00
Yu Watanabe 278e3adf50 test: wrap assignments in ASSERT_OK() and friends with parentheses
Hopefully fixes many CID reports.
2025-03-13 05:15:28 +09:00
Yu Watanabe 8df80dfbbf test-netlink: fix use of ASSERT_OK()
Follow-up for 3841288e5f.
2025-03-13 05:15:22 +09:00
Yu Watanabe 2ee01dbc05 netlink-util: move several function prototypes 2025-03-13 01:48:50 +09:00
Yu Watanabe 472ad6af94 netlink-util: allow to call rtnl_set_link_name() and friends with NULL rtnl 2025-03-13 01:48:50 +09:00
Yu Watanabe 0e44a7c085 netlink-util: merge rtnl_get_link_info() and rtnl_get_ifname_full() into rtnl_get_link_info_full()
Then, this makes rtnl_get_ifname_full() and friends as inline wrappers of
rtnl_get_link_info_full().
2025-03-13 01:48:50 +09:00
Yu Watanabe 3841288e5f test-netlink: use ASSERT_OK() and friends 2025-03-13 01:48:50 +09:00
Yu Watanabe bec2f4dc3e sd_device: introduce device_get_ifname()
sd-device replaces '!' in sysname with '/'. Hence, sysname and ifname
may be different. Let's get network interface name through INTERFACE
property.
2025-03-13 01:08:57 +09:00
Yu Watanabe 0f52a1107e test-sd-device: use ASSERT_OK() and friends 2025-03-13 01:08:57 +09:00
Yu Watanabe c7523292da sd-device: reorder elements in sd_device object
No functional change, just refactoring.
2025-03-13 01:08:57 +09:00
Yu Watanabe 1707b41e76 sd-device: protect more properties often set by kernel and internally used by udevd 2025-03-13 01:08:53 +09:00
Yu Watanabe c24148451a event-util: move event_source_hash_ops to event-util 2025-03-11 05:48:19 +09:00
Lennart Poettering cbf9a1c888 homed: add concept for "adopting" an existing homedir locally
Currently homed scans /home/ via inotify for new .home + .homedir/
popping up to register as local users. Let's also add an explicit way to
request this form of "adoption": a bus call that takes a path and that
makes a home dir activatable locally.

(Usecase: you cross boot between two systems – let's say your traditional
fedora and your ParticleOS – and want to use the same homedir from both:
simply mount the /home dir from the other somewhere, and then hit
"homectl adopt /somewhere/lennart.home" and you have the user locally
too).
2025-03-07 18:14:25 +01:00
Lennart Poettering f1b6417fea homed: add apis for managing home signing keys
This makes it easier to actually migrate home directories between
systems.
2025-03-07 18:13:40 +01:00
Yu Watanabe 5c9feb2d6e tree-wide: drop unnecessary break in default branch 2025-03-06 11:42:20 +01:00
Mike Yuan f2f9b82724 sd-journal/journal-send: use is_main_thread() where appropriate 2025-03-04 23:02:40 +01:00
Lennart Poettering 837849561b varlink: optionally create leading dirs when binding AF_UNIX socket
This is such a common case, let's make it easy to do this.
2025-03-04 18:07:17 +01:00
Daan De Meyer 5abf819a5f basic: remove unnecessary definition in missing_xyz.h (#36565) 2025-03-04 08:41:14 +01:00
Yu Watanabe f342c2420a chattr-util: two trivial cleanups (#36593) 2025-03-04 13:13:25 +09:00
Lennart Poettering 591e1492b7 Coverity fixups (#36503)
Details in individual commits.
2025-03-03 22:54:42 +01:00
Yu Watanabe ec32732043 basic: introduce our own sys/mount.h implementation
To resolve conflict with sys/mount.h and linux/mount.h or linux/fs.h.

The conflict between sys/mount.h and linux/mount.h is resolved in
glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), but our baseline
is still glibc-2.31. Also, even with the version or newer, still
sys/mount.h conflicts with linux/fs.h, which is included by
linux/btrfs.h.

This introduces our own implementation of sys/mount.h, that can be
simultaneously included with linux/mount.h and linux/fs.h. This also
imports linux/fs.h, linux/mount.h, and several other dependent headers.
The introduced sys/mount.h header itself may not be enough simple, but
by using the header, we can drop most of workarounds in other source files.
2025-03-04 02:24:49 +09:00
Yu Watanabe aa14f19398 basic/linux: import capability.h from kernel 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe e75372958d missing_threads.h: threads.h exists since glibc-2.28 2025-03-04 02:24:49 +09:00
Yu Watanabe a7cb43d8d1 missing_resource.h: RLIMIT_RTTIME is defined since glibc-2.14
Now our baseline is glibc-2.31.
2025-03-04 02:24:49 +09:00
Yu Watanabe a997f3387f chattr-util: drop mostly unused 'previous' argument from chattr_path() and friends 2025-03-04 00:47:12 +09:00
Lennart Poettering f2e38b01e0 sd-id128: gracefully handle systems where kernel keyring access is blocked
In various scenarios we invoke containers with access to the kernel
keyring blocked. Let's make sure we can handle this properly: when the
invocation ID is stored in in the kernel keyring and we try to read it
and get EPERM we should handle it gracefully, like EOPNOTSUPP.
2025-03-03 14:30:41 +09:00
Lennart Poettering f2b1de6f5b Revert "sd-json: add new sd_json_variant_unset_field() call"
This reverts commit b6a2df6307.

The functionality is entirely redundant, we already have
sd_json_variant_filter() which does the same, and is in fact even more
powerful, since it takes a list instead of a single field to remove.
2025-03-02 11:04:15 +00:00
Michal Koutný 1644724a4d sd-event: Fix sd_event_source leak
Hinted by CID#1591563 but the issue is different -- when
sd_event_source_set_destroy_callback() fails, we would use the old
n_sources value and possibly missing sd_event_source_unref() of the last
added source.
2025-02-28 15:16:53 +01:00
Yu Watanabe 2c051721ec sd-device: always pass random UUID on triggering uevent
Then, this makes sd_device_trigger() a simple wrapper of
sd_device_trigger_with_uuid().
2025-02-26 18:07:51 +09:00
Yu Watanabe ed3a95b2fb test-bus-object: check if enumerated objects are sorted 2025-02-25 23:41:20 +09:00
Yu Watanabe 31cdcca8dc sd-bus: sort enumerated child objects
Fixes #8008.
2025-02-25 23:41:20 +09:00
Mike Yuan 19e1a908b5 sd-event: pidfdize sd_event_source_send_child_signal()
Follow-up for c6cc7efcd3

The documentation has been updated, but apparently I forgot
to update the function itself...

Also, actually pass flags to pidfd_send_signal(). Previously
it was spuriously ignored.
2025-02-23 12:16:58 +01:00
Mike Yuan c6cc7efcd3 sd-event: always operate on child source via pidfd
Follow-up for 6e14c46bac

Nowadays a pidfd is guarenteed to be around for child
event sources, hence drop the effectively unused pid-based
branches.

Addresses https://github.com/systemd/systemd/pull/36410#discussion_r1959930716
2025-02-21 18:08:55 +01:00
Mike Yuan 4f63673482 sd-event: assert on hashmap_remove(child.pid)
Follow-up for 54988a27b9
and a342c71d36
2025-02-21 18:08:02 +01:00