summaryrefslogtreecommitdiffstats
path: root/src/test/test-local-addresses.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-04-20README: add a Weblate badgeFrantisek Sumsal1-0/+1
2023-04-20tree-wide: code spelling fixesFrantisek Sumsal18-26/+26
As reported by Fossies.
2023-04-20detect-virt: add message at debug levelZbigniew Jędrzejewski-Szmek1-2/+2
Normal users do not have permissions to access /proc/1/root, so 'systemd-detect-virt -r' fails, but the output, even at debug level is cryptic: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Failed to check for chroot() environment: Permission denied Let's make this a bit easier to figure out: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Cannot stat /proc/1/root: Permission denied Failed to check for chroot() environment: Permission denied I looked over other users of files_same(), and I think in general the message at debug level is OK for them too.
2023-04-20Apply known iocost solutions to block devicesGustavo Noronha Silva7-0/+452
Meta's resource control demo project[0] includes a benchmark tool that can be used to calculate the best iocost solutions for a given SSD. [0]: https://github.com/facebookexperimental/resctl-demo A project[1] has now been started to create a publicly available database of results that can be used to apply them automatically. [1]: https://github.com/iocost-benchmark/iocost-benchmarks This change adds a new tool that gets triggered by a udev rule for any block device and queries the hwdb for known solutions. The format for the hwdb file that is currently generated by the github action looks like this: # This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000. # From the following commit: # https://github.com/iocost-benchmark/iocost-benchmarks/commit/ca82acfe93c40f21d3b513c055779f43f1126f88 # # Match key format: # block:<devpath>:name:<model name>: # 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249] block:*:name:HFS256GD9TNG-62A0A:fwver:*: IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive IOCOST_MODEL_ISOLATION=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_NAIVE=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00 The IOCOST_SOLUTIONS key lists the solutions available for that device in the preferred order for higher isolation, which is a reasonable default for most client systems. This can be overriden to choose better defaults for custom use cases, like the various data center workloads. The tool can also be used to query the known solutions for a specific device or to apply a non-default solution (say, isolation or bandwidth). Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
2023-04-20kmod-setup: Add early loading for virtio_consoleDaan De Meyer1-8/+33
getty-generator enables serial-getty@.service for virtualizer consoles that it can find in /sys/class/tty. To make sure this works for virtio consoles, let's make sure we load the module is loaded early so that the /sys/class/tty/hvc0 exists before we run getty-generator.
2023-04-20core: Parse logging environment earlierDaan De Meyer1-4/+10
Let's make sure we parse the logging environment ASAP so that the options apply to more code. e.g. to allow debugging kmod-setup.c for example.
2023-04-20kmod-setup: Introduce match_modalias_recurse_dir_cb()Daan De Meyer1-4/+5
Let's make the logic around matching a modalias a bit more generic.
2023-04-20string-util: Add startswith_strv()Daan De Meyer3-12/+17
This is the function version of STARTSWITH_SET(). We also move STARTSWITH_SET() to string-util.h as it fits more there than in strv.h and reimplement it using startswith_strv().
2023-04-20mkosi: Disable kmsg ratelimitingDaan De Meyer1-0/+1
2023-04-20log: Log when kmsg is being ratelimitedDaan De Meyer1-2/+6
Let's avoid confusing developers and users when log messages suddenly stop getting logged to kmsg because of ratelimiting by logging an additional message if we start ratelimiting log messages to kmsg.
2023-04-20log: Add knob to disable kmsg ratelimitingDaan De Meyer4-4/+41
This allows us to disable kmsg ratelimiting in the integration tests and mkosi for easier debugging.
2023-04-20dissect: let's check for crypto_LUKS before fstype allowlist checkLennart Poettering1-5/+6
When trying to mount a partition that is encrypted without the encryption first having been set up we want to return a recognizable error (EUNATCH). This was broken by 80ce8580f5aa6b03fa13a0b3b30207bc9b5c5fe0 which added an allowlist check for permissible file systems first. Let's reverse the check order, so that we get EUNATCH again, as before. (And leave EIDRM as error for the failed allowlist check).
2023-04-20ratelimit: handle counter overflows somewhat sanelyLennart Poettering1-9/+11
An overflow here (i.e. the counter reaching 2^32 within a ratelimit time window) is not so unlikely. Let's handle this somewhat sanely and simply stop counting, while remaining in the "limit is hit" state until the time window has passed.
2023-04-20man: try to make clearer that /var/ is generally not available in ↵Lennart Poettering1-32/+25
/usr/lib/systemd/system-shutdown/ callouts I made the mistake to look into what is installed into /usr/lib/systemd/system-shutdown/ on Fedora. fwdupd among other things assumes /var/ is available from these callouts, though it is not in the general case. Hence, let's emphasize this in the documentation a bit more.
2023-04-20dissect-image: issue BLKFLSBUF before probing an fs at block device offset != 0Lennart Poettering1-0/+15
See added code comment for a longer explanation. TLDR: Linux maintains distinct block device caches for partition and "whole" block devices, and a simply BLKFLSBUF should make the worst confusions this causes go away.
2023-04-20networkd: fallback to chaddr for static lease lookup when not foundRobert Meijers1-1/+37
DHCP static leases are looked up by the client identifier as send by the client, while configured based on MAC. As RFC 2131 states the client identifier is an opaque key and must not be interpreted by the server this means that DHCP clients can (/will) also use a client identifier which is not a MAC address. One of these clients actually is systemd-networkd which uses an RFC 4361 by default to generate the client identifier. For these kind of DHCP clients static leases thus don't work because of this mismatch between configuring a MAC address but the server matching based on client identifier. This adds a fallback to try to look up a configured static lease based on the "chaddr" of the DHCP message as this will always contain the MAC address of the client. Fixes #21368
2023-04-20core/device: rewrite how device unit is removed from Manager.devices_by_sysfsYu Watanabe1-7/+14
If the device unit is not the head of the list saved in Manager.devices_by_sysfs, then it is not necessary to replace the existing hashmap entry. This should not change any behavior, just refactoring.
2023-04-20list: fix double evaluationYu Watanabe1-3/+6
2023-04-19hwdb: disable entry for Logitech USB receiver used by G502 XYu Watanabe1-1/+3
Fixes a bug introduced by dede07d3d04007c70c78653a73e2bcd8616564a5. Fixes #27118.
2023-04-19core: add one missing assertion for release_resource_queueYu Watanabe1-0/+1
Follow-up for 6ac62d61db737b01ad3776a7688d8a4c57b3f7d9.
2023-04-19dissect-image: fix log level in dissect_log_errorQuintin Hill1-15/+15
Actually use the log_level argument in this function! Fixes 4953e39
2023-04-19mkosi: Update to latestDaan De Meyer3-1/+7
2023-04-18test: add regression tests for find_esp() and friendYu Watanabe1-0/+9
2023-04-18chase: replace path_prefix_root_cwd() with chaseat_prefix_root()Yu Watanabe8-72/+74
The function path_prefix_root_cwd() was introduced for prefixing the result from chaseat() with root, but - it is named slightly generic, - the logic is different from what chase() does. This makes the name more explanative and specific for the result of the chaseat(), and make the logic consistent with chase(). Fixes https://github.com/systemd/systemd/pull/27199#issuecomment-1511387731. Follow-up for #27199.
2023-04-18fd-util: skip to check mount ID if kernel is too old and /proc is not mountedYu Watanabe1-7/+15
Now, dir_fd_is_root() is heavily used in chaseat(), which is used at various places. If the kernel is too old and /proc is not mounted, then there is no way to get the mount ID of a directory. In that case, let's silently skip the mount ID check. Fixes https://github.com/systemd/systemd/pull/27299#issuecomment-1511403680.
2023-04-18mountpoint-util: check /proc is mounted on failureYu Watanabe1-2/+4
2023-04-18chase: prefix with the root directory only when it is not "/"Yu Watanabe1-8/+16
2023-04-18chase: drop repeated call of empty_to_root()Yu Watanabe1-13/+12
2023-04-18chase: update outdated comment about result pathYu Watanabe1-6/+20
2023-04-18chase: make the result absolute when a symlink is absoluteYu Watanabe2-1/+15
As the path may be outside of the specified dir_fd.
2023-04-18chase: make chaseat() provides absolute path also when dir_fd points to the ↵Yu Watanabe2-2/+31
root directory Usually, we pass the file descriptor of the root directory to chaseat() when `--root=` is not specified. Previously, even in such case, the result was relative, and we need to prefix the path with "/" when we want to pass the path to other functions that do not support dir_fd, or log or show the path. That's inconvenient.
2023-04-18test: prefix the transient unit with test- to make coverage runs happyFrantisek Sumsal1-0/+1
See 9fd8226312 for more details. Follow-up to c9210b7470.
2023-04-18gpt-auto-generator: "translate" errno codes into proper messagesZbigniew Jędrzejewski-Szmek3-7/+10
E.g. in logs on jammy-ppc64el in https://github.com/systemd/systemd/pull/27294: Apr 16 17:42:50 H systemd-gpt-auto-generator[300]: Failed to dissect partition table of block device /dev/sda: No message of desired type Apr 16 17:42:50 H (sd-execu[295]: /usr/lib/systemd/system-generators/systemd-gpt-auto-generator failed with exit status 1. ee0e6e476e61d4baa2a18e241d212753e75003bf made this particular condition not an error. But for other errnos we want to print a better message too. dissect_loop_device_and_warn() already does this, but it always prints the error at error level. We want to suppress some of the errors, so let's make the print helper public and do the error suppression in the caller.
2023-04-18fstab-generator: add missing phrase in commentZbigniew Jędrzejewski-Szmek1-1/+1
2023-04-18hwdb: Fix rotation for BMAX Y13Paolo Velati1-0/+9
2023-04-18kmod-setup: bypass heavy virtio-rng check if we are not running in a VM anywayLennart Poettering1-0/+4
detect_vm() is cheap, because cached, let's hence do that early before we get out the big guns and sweep through sysfs.
2023-04-18kmod-setup: use STARTSWITH_SET() where appropriateLennart Poettering1-4/+2
2023-04-18Revert "getty-generator: Use device hotplug to instantiate virtualizer consoles"Lennart Poettering1-17/+13
This reverts commit e7e6ce5f8d467304731a98e8a140e69713f1bf07.
2023-04-18gpt-auto: do not fail when no suitable partitions foundYu Watanabe1-1/+2
Follow-up for 598fd4da1cf9665834110583fd9133073cc12481.
2023-04-18getty-generator: Use device hotplug to instantiate virtualizer consolesDaan De Meyer1-13/+17
If getty-generator runs in the initrd, the corresponding tty might not have been instantiated yet in /dev, which means a serial getty is not spawned on it. Instead, let's instantiate the serial-getty when the device appears so that it always gets instantiated.
2023-04-18lsm-util: move detection of support of LSMs into a new lsm-util.[ch] helperLennart Poettering4-37/+40
This makes the bpf LSM check generic, so that we can use it elsewhere. it also drops the caching inside it, given that bpf-lsm code in PID1 will cache it a second time a stack frame further up when it checks for various other bpf functionality.
2023-04-18bpf-firewall: give a name to maps usedDominique Martinet3-5/+26
Running systemd with IP accounting enabled generates many bpf maps (two per unit for accounting, another two if IPAddressAllow/Deny are used). Systemd itself knows which maps belong to what unit and commands like `systemctl status <unit>` can be used to query what service has which map, but monitoring these values all the time costs 4 dbus requests (calling the .IP{E,I}gress{Bytes,Packets} method for each unit) and makes services like the prometheus systemd_exporter[1] somewhat slow when doing that for every units, while less precise information could quickly be obtained by looking directly at the maps. Unfortunately, bpf map names are rather limited: - only 15 characters in length (16, but last byte must be 0) - only allows isalnum(), _ and . characters If it wasn't for the length limit we could use the normal unit escape functions but I've opted to just make any forbidden character into underscores for maximum brievty -- the map prefix is also rather short: This isn't meant as a precise mapping, but as a hint for admins who want to look at these. (Note there is no problem if multiple maps have the same name) Link: https://github.com/povilasv/systemd_exporter [1]
2023-04-17process-util: be more careful with pidfd_get_pid() special casesLennart Poettering1-1/+15
Let's be more careful with generating error codes for (expected) error causes. This does not introduce new error conditions, it just changes what we return under specific cases, to make things nicely recognizable in each case. Most importantly this detects if fdinfo reports a pid of "-1" for pidfds with processes that are already reaped (and thus have no PID anymore) None of our current users care about these error codes, but let's get this right for the future.
2023-04-17fsck: use execv_p_ and execl_p_Florian Klink3-30/+5
Instead of invoking find_executable on our own, use the variants of exec provided by glibc which does this for us.
2023-04-17creds: make available to all ExecStartPre= and ExecStart= processesLuca Boccassi2-1/+10
Fixes https://github.com/systemd/systemd/issues/27275
2023-04-17user-util:remove duplicate includesjcg1-1/+0
2023-04-17virt: Further improve detection of EC2 metal instancesBenjamin Herrenschmidt1-2/+4
Commit f90eea7d18d9ebe88e6a66cd7a86b618def8945d virt: Improve detection of EC2 metal instances Added support for detecting EC2 metal instances via the product name in DMI by testing for the ".metal" suffix. Unfortunately this doesn't cover all cases, as there are going to be instance types where ".metal" is not a suffix (ie, .metal-16xl, .metal-32xl, ...) This modifies the logic to also allow those new forms. Signed-off-by: Benjamin Herrenschmidt <benh@amazon.com>
2023-04-17mkosi: Use kernel-core for Fedora and CentOS imagesDaan De Meyer2-3/+2
Let's reduce image size by using a smaller kernel package.
2023-04-17hwdb: add accelerometer mount matrix for Lenovo Yoga Tablet 2 851F/LHans de Goede1-0/+4
Add an accelerometer mount matrix for Lenovo Yoga Tablet 2 851F/L, to fix screen rotation now that the kernel has support for the LSM303D IMU.
2023-04-16process-util: make safe_fork() unset $NOTIFY_SOCKETYu Watanabe5-4/+9
Propagating $NOTIFY_SOCKET is typically dangerous. Let's unset it unless explicitly requested to keep it. Fixes #27288. Replaces #27291.