Commit Graph
3645 Commits
Author SHA1 Message Date
Lennart Poettering 4d8f4e02ba Merge pull request #31109 from yuwata/nspawn-resolve-network-interface-before-move
nspawn: resolve network interface names before move to container namespace
2024-01-30 17:09:11 +01:00
Yu Watanabe 3652891c39 sd-device: use new interface name resolvers 2024-01-30 20:37:13 +09:00
Yu Watanabe 4e235561d6 sd-netlink: unify network interface name getter and resolvers
This makes rtnl_resolve_interface() always check the existence of the
resolved interface, which previously did not when a decimal formatted
ifindex is provided, e.g. "1" or "42".
2024-01-30 20:37:04 +09:00
Lennart Poettering 75e00d5e32 sd-bus: tighten rules on sd_bus_query_sender_creds() a bit
Let's always derive credentials from a bus name or a conneciton fd if we
can, because they pin things.

Let's not go via PID really, because it's always racy to do so.

Note that this doesn't change much, since we wouldn't use such augmented
data for auth anyway (because it will be masked in the
sd_bus_creds.augmented mask as untrusted). But still, let's prefer
trusted data over untrusted data.
2024-01-29 14:42:37 +01:00
Lennart Poettering 25fd5343ca sd-bus: also read supplementary gids from bus driver 2024-01-29 14:42:30 +01:00
Lennart Poettering 71be64064c sd-bus: add pidfd to the sd_bus_creds structure
Let's continue with the pidfd'ification, and include pidfd in our
sd_bus_creds structure tha tracks a peers credentials.
2024-01-29 14:41:58 +01:00
Luca Boccassi b5d4862707 sd-bus: fix exiting event loop when sd_bus_set_exit_on_disconnect is used
If sd_bus_set_exit_on_disconnect is used and the bus is part of an event
loop, and the D-Bus connection goes away (e.g.: soft-reboot), sd-bus
will always exit() the program instead of returning from the loop, as
the reference to the event is removed before it is checked.
2024-01-26 08:59:46 +01:00
Mike Yuan f789041c4a id128-util: use FOREACH_STRING where appropriate 2024-01-24 17:09:45 +08:00
Rafaël Kooi d2f2c20a6d id128-util: Attempt to read UUID from /sys/hypervisor/uuid
When using the Xen hypervisor the virtual machine UUID is exposed here.
This is useful when one needs stable IPv4 address assignment, e.g. for a
set of RAM nodes that are built from a template.
2024-01-23 18:55:15 +01:00
Yu Watanabe fc5edc91cb Merge pull request #31015 from yuwata/local-addresses
local-addresses: several cleanups and fixes, add test cases
2024-01-23 10:25:35 +09:00
Lennart Poettering 6ce868a0da event-util: add helper for adding pidref child to event loop 2024-01-22 14:03:09 +01:00
Yu Watanabe d10311f407 sd-netlink: drop unused parser for RTA_MULTIPATH 2024-01-20 16:07:19 +09:00
Yu Watanabe d926864073 sd-netlink: add policy for NL80211_ATTR_NETNS_FD 2024-01-19 15:06:08 +09:00
Yu Watanabe 6e931bc578 sd-netlink: introduce rtnl_rename_link() 2024-01-19 15:06:08 +09:00
Yu Watanabe 3e98379ec0 sd-device: introduce device_get_sysattr_u32() 2024-01-19 15:06:08 +09:00
Yu Watanabe d2881ef96e tree-wide: add short comments for namespace_open() and namespace_enter()
Also use -EBADF when unspecified.
2024-01-19 15:06:08 +09:00
Yu Watanabe 1cdd8b1b66 sd-netlink: fix rtnl_resolve_link_alternative_name()
Fixes a bug introduced by afdf6c3b60.
2024-01-17 18:53:45 +08:00
Yu Watanabe 2db2979505 sd-network: modernize parse_operational_state_range()
- rename 'out' -> 'ret',
- introduce LINK_OPERSTATE_RANGE_INVALID,
- constify LINK_OPERSTATE_RANGE_DEFAULT,
- drop spurious const specifier for allocated string,
- etc,.
2024-01-17 04:05:43 +09:00
Yu Watanabe 15f624f80f sd-network: introduce three helper functions for LinkOperationalState 2024-01-17 04:05:43 +09:00
Daan De Meyer 0e2f18eedd bus-socket: Clarify that inotify is supposed to watch all components
The previous wording of the components could mean that we should only
watch directories, not the socket itself. Reword so that we clearly
mention that all components of the path are watched, including the
socket itself.
2024-01-15 17:00:04 +00:00
Cristian Rodríguez 2a9ab0974b Fix gcc14 -Wcalloc-transposed-args warnings
all functions annotated with two parameter _alloc_ are calloc-like.
gcc14 enforces this and warns if arguments are backwards.
2024-01-14 12:57:38 +00:00
Lennart Poettering 1078628096 sd-netlink: hook up nsid APIs 2024-01-12 18:52:26 +01:00
Yu Watanabe 70c24d0d9f sd-netlink: add trailing NUL byte for safety in sd_netlink_message_read_data()
Then, drop sd_netlink_message_read_data_suffix0().
2024-01-12 04:48:26 +09:00
Rose aa9ff6c28d tree-wide: replace string functions with fundamental functions 2024-01-11 13:36:25 +09:00
Yu Watanabe 513ca8b6f0 udev: split out check that udev property can be updated 2024-01-10 04:27:41 +09:00
Lennart Poettering 84960b7f3c Merge pull request #30844 from keszybz/rename-uid-alloc-range
Rename uid-alloc-range.[ch] files
2024-01-09 18:51:35 +01:00
Zbigniew Jędrzejewski-Szmek 8e1ac16bc6 src/basic: rename uid-alloc-range.[ch] to uid-classification.[ch]
We had both uid-range.h and uid-alloc-range.h. The latter now contains helpers
like {uid,gid}_is_{system,dynamic,container}(), uid_for_system_journal(), so
the existing name is outdated. I think the uid-range.[ch] should stay separate
because it has a bunch of helpers for parsing and printing of uid ranges. So
let's rename as in $subject to better reflect the contents of the file and make
the two sets of files harder to confuse.
2024-01-09 11:15:00 +01:00
Zbigniew Jędrzejewski-Szmek eb7d7d14fb src/basic: "UidRange" → "UIDRange"
We don't "uncapitalize" parts of an already-capitalized name when concatenating
words. In particular, we had UidRange in basic/uid-range.h and UGIDAllocationRange
in basic/uid-alloc-range.h, which is annoying.
2024-01-09 11:15:00 +01:00
Lennart Poettering 5ee5b1659a id128-util: do not expose product UUID when running in a container
When we run in a container we should show our own system's info, not the
hosts hence suppress this info in that case.

This matches the behaviour of most other calls in hostnamed to expose
system properties.
2024-01-09 10:46:01 +01:00
Lennart Poettering bcb1bb379e sd-bus: also intrepret $SYSTEMD_SSH env var
To make things symmetric to the $SYSTEMD_SSH logic that the varlink
transport supports, let's also honour such a variable in sd-bus when
picking ssh transport.
2024-01-08 23:24:51 +01:00
Mike Yuan bdd2036e81 hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX 2024-01-09 03:59:15 +09:00
Luca Boccassi 6a80e22766 Merge pull request #30759 from mrc0mmand/resolved-followup
resolve: initialize `r` during OOM
2024-01-05 09:26:19 +01:00
Sergei Zhmylev 25aa35d465 journalctl: add --exclude-identifier option 2024-01-04 23:21:39 +01:00
Frantisek Sumsal 0a87b83497 shared: initialize a couple of values explicitly
As gcc has trouble figuring this itself with -O2 and -Wmaybe-initialized.
2024-01-04 20:57:03 +01:00
Yu Watanabe ef4e0b7e4f sd-netlink: introduce sd_rtnl_message_route_set_tos()
We already have the getter for the parameter, but forgot to introduce the setter.
2024-01-03 04:21:51 +09:00
Yu Watanabe 8f8b39c86b sd-netlink: move definitions of RTA_TYPE() and RTA_FLAGS() to netlink-util.h 2024-01-03 04:21:28 +09:00
Yu Watanabe 83a0417550 sd-journal: introduce cleanup function and hash ops for Directory
This makes the folloing:
- Each Directory object now has a reference to sd-journal.
- Hence, directory_free(), which is renamed from remove_directory(), can
  be called without sd-journal as an argument.
- Introduces hash ops for Directory, so the finalization becomes
  slightly simpler.
- Allocate hashmaps that store Directory objects when necessary.
- Split out add_directory_impl().

No functional changes, just refactoring.
2024-01-01 19:29:04 +01:00
Luca Boccassi 86b8b66675 Merge pull request #30591 from yuwata/device-util
device-util: introduce device_in_subsystem() and device_is_devtype() helper functions
2024-01-01 19:26:39 +01:00
Yu Watanabe 5b201ffb1e sd-journal: check sd-event state before setting up post change timer
The similar check already exists in schedule_post_change().

The function is currently called at two places.
- journal_file_open() in sd-journal:
  In this case, if the timer is not set up, then journal_file_post_change()
  will be called at the end of journal_file_append_entry(). So, the necessary
  task will be done sequentially when an journal entry is stored to the opened
  journal file. That is desired when the function is called at outside of the
  event loop.
- server_open_journal() in journald:
  This is not called after we exit the event loop.

So, we can safely do nothing in the function if the event loop is being
finished or already finished.

Fixes #30644.
2023-12-29 06:39:06 +09:00
Mike Yuan da6c52c57c various: don't use close_nointr if retval is not checked anyway 2023-12-28 20:44:01 +08:00
Yu Watanabe fe3fcb9492 Merge pull request #30633 from mrc0mmand/cocci-shenanigans
coccinelle: rework how we run the Coccinelle transformations
2023-12-26 05:45:58 +09:00
Frantisek Sumsal f2d0e2e5f5 sd-bus: drop unnecessary braces 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 0a6a59650e tree-wide: drop !! casts to booleans 2023-12-25 18:26:59 +01:00
Mike Yuan 0a0f49556f Merge pull request #30622 from yuwata/space
tree-wide: drop unnecessary space or insert missing space
2023-12-25 17:52:48 +08:00
Yu Watanabe c01a5c0527 siphash24: introduce siphash24_compress_typesafe() macro
To prevent copy-and-paste mistake.

This also introduce in_addr_hash_func().

No functional change, just refactoring.
2023-12-25 15:38:59 +09:00
Yu Watanabe b3a9d980f3 tree-wide: drop space between variable and an increment/decrement 2023-12-25 01:56:40 +09:00
Yu Watanabe 1d03d970a1 tree-wide: insert space after for and switch 2023-12-25 01:29:38 +09:00
Yu Watanabe 54cbad304c sd-device: shorten code a big
Suggested by coccinelle.
2023-12-25 00:47:42 +09:00
Luca Boccassi 65e1e29e55 Merge pull request #30596 from yuwata/sd-device-db-cleanups
sd-device: several cleanups for udev database related functions
2023-12-24 00:23:35 +01:00
Yu Watanabe 8161f6086e test: make assert_return() critical by default on fuzzer and unit tests
Several test cases intentionally trigger assert_return(). So, to avoid
the entire test fails, this introduces several macros that tentatively
make assert_return() not critical.
2023-12-24 02:02:18 +09:00