Commit Graph
38236 Commits
Author SHA1 Message Date
Luca Boccassi cd3c6322db compression: add build-time option to select default
Compression and decompression are controlled by the same build flag,
so if one wants to use, say, LZ4 to compress, ZSTD has to be disabled,
which means one loses the ability to read zstd-compressed journals.

Add a default-compression meson option, that allows to select any of
the available compression algorithms as the default.
2022-04-18 05:43:59 +09:00
Yu Watanabe bd4297e761 udevadm: info: also show parent devices by --tree 2022-04-17 21:27:33 +02:00
Luca Boccassi ee5b175b8c Merge pull request #23100 from yuwata/network-fix-tunnel-address-parser
network: fix tunnel address parser
2022-04-17 21:24:38 +02:00
amarjargal 354ca98085 systemctl: colorize "enabled" in 'systemctl status ...'
"enabled" state is highlighted in green and "disabled" state is
highlighted in yellow because I felt that white and grey colors were not
so distinguishable. Other states are not highlighted. Any other coloring
suggestions are welcome!

Closes #16932.
2022-04-17 14:30:46 +09:00
Yu Watanabe 5984b92726 network: l2tp: refuse null address 2022-04-17 09:31:35 +09:00
Yu Watanabe 96d96ec4e7 network: tunnel: handle null address as "any"
Fixes oss-fuzz#44881 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44881).

Fixes #23098.
2022-04-17 09:31:30 +09:00
Yu Watanabe 747bee2662 Merge pull request #23089 from yuwata/sd-device-use-path_extract_filename
sd-device: use path_extract_filename()
2022-04-16 14:33:58 +09:00
Yu Watanabe 7be87278a3 Merge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign
Tmpfiles fix precedence with plus sign
2022-04-16 01:36:51 +09:00
Zbigniew Jędrzejewski-Szmek 6e961aeb26 shared/install: fix crash when reenable is called without --root 2022-04-15 18:26:07 +02:00
Yu Watanabe b9d8209065 test: add tests for sd_device_get_sysnum() 2022-04-16 00:52:24 +09:00
Yu Watanabe 5fa9d220c2 sd-device: shorten code a bit 2022-04-16 00:52:24 +09:00
Yu Watanabe c58e0ce677 sd-device: use path_extract_filename() at one more place 2022-04-16 00:52:16 +09:00
Simon Ellmann 27cd31c0b2 networkctl: obey --full with lldp command
Do not ellipsize output when -l or --full is handed to networkctl lldp.

Fixes #22806.
2022-04-15 17:51:26 +02:00
Yu Watanabe ce8394f9c7 fs-util: use path_extract_filename() at one more place 2022-04-16 00:50:01 +09:00
Yu Watanabe 012f32d808 firewall-util: inline iterator and add several missing assertions 2022-04-15 17:44:51 +09:00
Yu Watanabe cc41c084cd sd-netlink: use correct type of iterator 2022-04-15 17:37:52 +09:00
Jan Janssen 4d54310da5 boot: Add missing continue statements
Fortunately, this was not causing any issues as it will just try
the other option branches unsuccessfuly before going to the next
config line.
2022-04-14 19:48:51 +02:00
Yu Watanabe bac8fe924e Merge pull request #23073 from medhefgo/boot-fixes
boot: Some fixes
2022-04-14 16:58:21 +09:00
Eduard Tolosa bb5824c9ab Add ConditionCPUFeature to load-fragment-gperf.gperf (#23076)
Fixes #23075
2022-04-14 15:30:03 +09:00
Jan Janssen 7b21973c42 boot: Use correct device root when loading device trees
If the boot entry comes from a XBOOT partition, we have to load the device
tree from that instead of the ESP.
2022-04-13 23:08:13 +02:00
Jan Janssen ec4106afa0 boot: Fix integer format specifiers
gnu-efi only knows two sizes for formatting integers: 32bit without
a length prefix and 64bit with 'l' prefix. Provide a PRI-style format
specifier for (U)INTN so that Print() can read the right amount of
bytes instead of printing garbage or worse.
2022-04-13 23:06:26 +02:00
Lennart Poettering 4bcf5c11c8 Merge pull request #23011 from mrc0mmand/TEST-64-md
test: add MD-related tests to TEST-64
2022-04-13 22:26:50 +02:00
Lennart Poettering 1fde09b3b4 Merge pull request #22759 from msekletar/issue-18077-long-sysfs-paths-hashing
Create "hashed" unit names from long paths
2022-04-13 22:21:38 +02:00
Yu Watanabe bd1f75d5fb Merge pull request #23070 from poettering/devnum-split
basic: some devnum handling tweaks and refactorings
2022-04-14 03:45:39 +09:00
Yu Watanabe 03b894fc09 sd-device: skip diskseq verification when ID_IGNORE_DISKSEQ property is set
Some drivers do not announce the diskseq change.
E.g. for md devices, the kernel increments the diskseq *after*
emitting a 'change' uevent when backing block devices are added to
a md device, and udevd does not receive no uevent which contains
the new diskseq.
2022-04-14 00:10:28 +09:00
Lennart Poettering 02b9047edf devnum-util: catch potential stack overruns early 2022-04-13 16:26:31 +02:00
Lennart Poettering ec61371fe6 devnum-util: define helper macros for formatting devnum major/minor pairs
And port some parts over.
2022-04-13 16:26:31 +02:00
Lennart Poettering 7176f06c9e basic: split out dev_t related calls into new devno-util.[ch]
No actual code changes, just splitting out of some dev_t handling
related calls from stat-util.[ch], they are quite a number already, and
deserve their own module now I think.

Also, try to settle on the name "devnum" as the name for the concept,
instead of "devno" or "dev" or "devid". "devnum" is the name exported in
udev APIs, hence probably best to stick to that. (this just renames a
few symbols to "devum", local variables are left untouched, to make the
patch not too invasive)

No actual code changes.
2022-04-13 16:26:31 +02:00
Lennart Poettering 7b6d168376 udevadm: use xopendirat() where appropriate
And while we are at it, let's use more appropriate open flags.

O_NONBLOCk is pointless in combination with O_NOFOLLOW.

O_NOFOLLOW makes a ton of sense otoh, since the inode is supposed to be
a dir, we just checked.

THe other flags are implied by xopendirat()
2022-04-13 14:41:05 +02:00
Lennart Poettering 9117d94b9a udevadm: add new --tree mode to "udevadm info"
sysfs is a tree, hence let's a mode that allows showing it as such.
2022-04-13 14:41:05 +02:00
Lennart Poettering 00dfbf35fd sd-device: include parent devices in enumeration 2022-04-13 14:41:05 +02:00
Lennart Poettering 0b859c9773 sd-device: properly support some corner case syspath 2022-04-13 14:41:05 +02:00
Lennart Poettering be247835c7 sd-device: add some comments 2022-04-13 14:41:05 +02:00
Lennart Poettering 29a5428f1c sd-device: filter regular files when enumerating
Currently if enumerating with debug logging you'll likely see something
like this:

sd-device: the syspath "/sys/class/devcoredump/disabled" is not a directory.
sd-device: the syspath "/sys/class/firmware/timeout" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_remove" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_add" is not a directory.
sd-device: the syspath "/sys/class/drm/version" is not a directory.

This is because these sysfs classes place regular files in these
directories, which we so far didn't expect.

Let's filter them early, and only bother with enumerated inodes if they
actually are dirs or symlinks, i.e. can be kobject dirs. Regular file
definitely never are kobject dirs...
2022-04-13 14:41:04 +02:00
Lennart Poettering e7c7d79d52 sd-device: split out checking of matches from enumerator_scan_dir_and_add_devices()
No change in behaviour, just some splitting out of code.
2022-04-13 14:41:04 +02:00
Lennart Poettering 5cf0ee31ec sd-device: generate e better error code when trying to allocate sd_device for non-dir
Currently, for sysfs paths outside of /sys/devices/ we do better
checking if something is a suitable path: we check if it's actually a
directory, and if not return ENODEV.

Let's make the codepath for nodes *inside* of /sys/device/ similar:
let's also return ENODEV if the path supplied is not a directory.

Previously, we'd return ENOTDIR in that case, which is quite confusing I
think.
2022-04-13 14:41:03 +02:00
Lennart Poettering a7910612a5 sd-device: don't accept non-sysfs paths
There are some file systems mounted below /sys/ that are not actually
sysfs, i.e. are not arranged in a sysfs/kobject style. Let's refuse
those early. (Example, /sys/fs/cgroup/ and similar.)

(Also, let's add an env var for this, so that it can be turned off for
test cases.)
2022-04-13 14:40:13 +02:00
Lennart Poettering 1793bb6112 sd-device: use chase_symlinks() O_PATH fd
chase_symlinks() can return its last O_PATH fd to us. Let's use that and
make the access() check a bit tighter by going via faccessat() on the
O_PATH fd.

This doesn't really change too much, but is nice in context of the next
commit, which uses the O_PATH fd in one other way.
2022-04-13 14:40:09 +02:00
Lennart Poettering 82c5db16cc pid1: pass useful env vars to generators
This is inspired by this:

    https://github.com/systemd/zram-generator/blob/main/src/generator.rs#L29

Given it's easy for PID 1 to pass this to generators, I thin we should.
All generators not written by us likely want to know these things so
that the can adjust to the execution environment.
2022-04-13 10:07:46 +02:00
Zbigniew Jędrzejewski-Szmek 87d44b6e1a Merge pull request #23002 from yuwata/udev-use-child-event
udev: use child event source
2022-04-13 08:32:16 +02:00
Lennart Poettering 5e9f594038 Merge pull request #23061 from poettering/chase-symlinks-tweaks,-new
some chase_symlinks() tweaks
2022-04-12 22:57:17 +02:00
Yu Watanabe 5180394b38 core: use assert_se() which takes side-effect
Fixes #23059.
2022-04-12 18:45:20 +02:00
Yu Watanabe 82e0b63183 udev: use child event source to manage workers 2022-04-13 01:08:42 +09:00
Yu Watanabe a79cba3326 udev: use EventResult type
This also adds EVENT_RESULT_SUCCESS for readability.
2022-04-13 01:00:08 +09:00
Yu Watanabe fbae50904f sd-event: make inotify event work after the process is forked 2022-04-13 01:00:08 +09:00
Yu Watanabe 86587c93b0 sd-event: do not kill a child process from another child 2022-04-13 01:00:08 +09:00
Yu Watanabe 01e6af7374 sd-event: do not update signal fd after PID is changed
Otherwise, child event source will not work after the process is forked
and the event source is unref()ed on the child process.
2022-04-13 01:00:08 +09:00
Yu Watanabe 54988a27b9 sd-event: set pid to event source after all setup processes finished
Otherwise, the assertion in source_disconnect() may be triggered,
2022-04-13 01:00:08 +09:00
Yu Watanabe 91c700713f sd-event: rebreak comments 2022-04-13 01:00:08 +09:00
Lennart Poettering 57f9ca3aa0 chase-symlinks: prefer path_extract_directory() over dirname() 2022-04-12 17:10:50 +02:00