Commit Graph
39218 Commits
Author SHA1 Message Date
Yu Watanabe a9d2d037ee network: do not try to bring up wifi interface if rfkill is active
This fixes the following error:
---
systemd-networkd[465]: wlan0: Could not bring up interface: Operation not possible due to RF-kill
---

Fixes #23649.
2022-07-23 20:55:03 +09:00
Yu Watanabe 8642e04b78 network: also assign rfkill device to Wiphy object
Preparation for later commits.
2022-07-23 20:55:03 +09:00
Yu Watanabe c49d536295 network: assign corresponding sd-device object to Wiphy object
As an analogy for Link object, let's each Wiphy object has the
corresponding sd-device object. The sd-device object will be used in
later commits.
2022-07-23 20:55:02 +09:00
Yu Watanabe fc85b32302 network: set wiphy name in wiphy_new()
Then, we can assume all Wiphy objects managed by Manager has both valid
index and name.
2022-07-23 20:53:06 +09:00
Yu Watanabe 71cdfe16aa network: add TODO about interface renaming 2022-07-23 20:04:28 +09:00
Yu Watanabe 75255a8d43 network: unref sd-device object assigned to Link on remove uevent
Otherwise, outdated device information may be used in a short timespan.
2022-07-23 20:04:28 +09:00
Yu Watanabe 1fd3ac1eef network: introduce a tiny wrapper for manager_udev_process_link()
Preparation for later commits.
2022-07-23 20:04:22 +09:00
Yu Watanabe 8de56fb3e0 network: rename Link.sd_device -> Link.dev 2022-07-23 20:00:44 +09:00
Yu Watanabe 009b2c3ac1 udev-builtin: logs when needs reloading 2022-07-23 15:05:22 +09:00
Yu Watanabe e9d1fae3bb udev: reload rules and builtins only when mtime of a config changed
This makes udevd reload rules only when the timestamp is updated,
even on SIGHUP or `udevadm control --reload`.
So, we can call `udevadm control --reload` without huge performance
penalty when no rules, .link files, and so on are changed.
2022-07-23 15:05:22 +09:00
Yu Watanabe acfbd71ccc udev: save stats of all udev rules file
The mtime of directory is not updated when an existing rule file is
changed. Hence, paths_check_timestamp() is not reliable.
2022-07-23 15:05:22 +09:00
Yu Watanabe 3f4dfd9d87 conf-parser: add a boolean flag for config_get_stats_by_path() to control if drop-in configs are checked
Preparation for later commits.
2022-07-23 15:03:48 +09:00
Yu Watanabe d7bddfa109 udev: delay to start queued events on udevadm control --start-exec-queue 2022-07-23 14:08:40 +09:00
Yu Watanabe 8e543eb86a udev: use event_reset_time_relative() 2022-07-23 14:08:40 +09:00
Yu Watanabe 6e40ed5325 udev: downgrade error level and mention that the error is ignored 2022-07-23 14:08:40 +09:00
Yu Watanabe 298316ebdf udev: fix error check 2022-07-23 14:08:40 +09:00
Yu Watanabe 853188db90 network: use device_unref_and_replace() 2022-07-23 08:17:43 +09:00
Yu Watanabe d6985e76f2 sd-device: introduce device_unref_and_replace() 2022-07-23 08:16:38 +09:00
Yu Watanabe 5eb83e9000 sd-device: introduce device_clear_sysattr_cache() 2022-07-23 08:11:36 +09:00
Yu Watanabe 2829fca249 sd-device: introduce device_get_sysattr_bool() 2022-07-23 08:11:36 +09:00
Yu Watanabe b05e52000b network: do not silently stop to process configuration on activation failure
Previously, if activation failed, link did not enter the failed state,
but still Link.activated flag not set. Hence, nothing processed even if
the interface is manually brought up later.

Partially fixes #23649.
2022-07-23 08:11:36 +09:00
Yu Watanabe c9fbe0bd10 Merge pull request #24074 from yuwata/network-dhcp6-rapid-commit
network: dhcp6: re-introduce RapidCommit= setting
2022-07-23 08:10:01 +09:00
Zbigniew Jędrzejewski-Szmek df1cbd1adf manager: limit access to private dbus socket
For the system manager, /run/systemd/private is publicly accessible, because
/run/systemd is 0755, and /run/systemd/private is 0777. For the user manager,
/run/user/<uid> is 0700, and /run/user/<uid>/systemd/private is 0777. This
does not directly cause any security issue because we check the sender in
bus_check_peercred (ucred.uid != 0 && ucred.uid != geteuid()).

But it makes sense to limit access to the socket to avoid wasting time in PID1.
Somebody could send messages there that'd we'd reject anyway. It also makes
things more explicit.
2022-07-23 08:08:49 +09:00
Zbigniew Jędrzejewski-Szmek 35a926777e tests: add a simple test that checks what fexecve_or_execve does
This can be easily used to show that the issue described in
ceedbf8185 is still reproduced:

$ strace -e execveat build/test-execve /bin/grep Name /proc/self/status
execveat(3, "", ["/bin/grep", "Name", "/proc/self/status"], NULL, AT_EMPTY_PATH) = 0
Name:	3
2022-07-23 07:13:30 +09:00
Andrey Albershteyn 704116c976 udev: enable BLKID_SUBLKS_FSINFO tags
libblkid gained new tags - FSSIZE, FSLASTBLOCK and FSBLOCKSIZE.
These tags are filesystem related properties probed from superblock.
All of them are enabled by BLKID_SUBLKS_FSINFO flag.

Set the flag to allow these tags to be cached in udev db.
2022-07-22 22:08:47 +02:00
Yu Watanabe 50ee1fec3a network: dhcp6: re-introduce RapidCommit= setting
Previous implementation of disabling rapid commit was broken, and
dropped by 308d01f3c4.

Let's re-introduce the option in the correct way, as some servers seem
to return borked message when the solicit message contain the rapid
commit option.

Closes #24065.
2022-07-22 21:28:20 +09:00
Yu Watanabe 4397967f8c sd-dhcp6-client: introduce sd_dhcp6_client_set_rapid_commit() 2022-07-22 21:26:44 +09:00
Luca Boccassi 8d0c34f367 Merge pull request #24014 from poettering/tmpfiles-extra-creds
tmpfiles: accept additional tmpfiles lines via credential
2022-07-21 11:55:43 +01:00
Lennart Poettering 3e9b77dea4 Merge pull request #23986 from poettering/cache-selinux-unit-labels
selinux: make selinux access checks based on unit file contexts read at unit load time
2022-07-21 10:24:51 +02:00
Alexander Wilson 64b634fbc6 coredumpctl: Use BusLocator functions 2022-07-21 09:50:47 +02:00
Zbigniew Jędrzejewski-Szmek a5d0919c9b Merge pull request #24051 from yuwata/json-fpclassify
json: use fpclassify() macro and refuse -ffinite-math-only
2022-07-21 09:35:19 +02:00
Daan De Meyer fc4c10b28b tree-wide: Introduce free_and_replace_full()
Let's have all our free_and_replace() functions use a single
implementation.
2022-07-21 09:45:55 +09:00
Yu Watanabe 1561db8ac2 json: use fpclassify() or its helper functions 2022-07-21 09:18:13 +09:00
Yu Watanabe fbccfa95c4 math-util: introduce iszero_safe() and fp_equal() 2022-07-21 09:18:08 +09:00
Yu Watanabe 39229a2a0e test: use fabs() as the argument is double
This also drop unnecessary cast.
2022-07-21 09:06:53 +09:00
Lennart Poettering 4a0cb5474e Merge pull request #23963 from matoro/main
Replace __sync intrinsics with __atomic
2022-07-21 00:10:01 +02:00
Lennart Poettering e52f6f6358 tmpfiles: add ^ line modifier for loading file contents from specific credential 2022-07-20 23:53:22 +02:00
Lennart Poettering 1d77721f30 tmpfiles: accept additional tmpfiles lines via credential 2022-07-20 23:53:22 +02:00
Lennart Poettering 62f174cf1f selinux: include precise low-level error string in returned D-Bus errors 2022-07-20 19:09:24 +02:00
Lennart Poettering 23e9a7dde5 core: cache unit file selinux label, and make decisions based on that
Do not go back to disk on each selinux access, but instead cache the
label off the inode we are actually reading. That way unit file contents
and unit file label we use for access checks are always in sync.

Based on discussions here:

https://github.com/systemd/systemd/pull/10023#issuecomment-1179835586

Replaces:

https://github.com/systemd/systemd/pull/23910

This changes behaviour a bit, because we'll reach and cache the label at
the moment of loading the unit (i.e. usually on boot and reload), but
not after relabelling. Thus, users must refresh the cache explicitly via
a "systemctl daemon-reload" if they relabelled things.

This makes the SELinux story a bit more debuggable, as it adds an
AccessSELinuxContext bus property to units that will report the label we are
using for a unit (or the empty string if not known).

This also drops using the "source" path of a unit as label source. if
there's value in it, then generators should manually copy the selinux
label from the source files onto the generated unit files, so that the
rule that "access labels are read when we read the definition files" is
upheld. But I am not convinced this is really a necessary, good idea.
2022-07-20 19:08:28 +02:00
Luca Boccassi 74c1cf6267 Merge pull request #23640 from cerebro1/week1
Estimate battery level
2022-07-20 18:07:22 +01:00
Sonali Srivastava 91ea7ebcdf sleep: store battery discharge rate/hour with hash
Estimated battery discharge rate per hour is stored in :
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour

This value is used to determine the initial suspend interval. In case
this file is not available or value is invalid, HibernateDelaySec
interval is used.
After wakeup from initial suspend, this value is again estimated and
written to file if value is in range of 1-199.

Logs for reference : HibernateDelaySec=15min
- Updated in /etc/systemd/sleep.conf

Jul 14 19:17:58 localhost systemd-sleep[567]: Current battery charge
percentage: 100%
Jul 14 19:17:58 localhost systemd-sleep[567]: Failed to read discharge
rate from /var/lib/systemd/sleep/batt
ery_discharge_percentage_rate_per_hour: No such file or directory
Jul 14 19:17:58 localhost systemd-sleep[567]: Set timerfd wake alarm
for 15min
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: Attempting to estimate
battery discharge rate after wakeup from 15min sleep
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Estimated discharge rate
39 successfully updated to
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Set timerfd wake alarm
for 1h 48min 27s
Jul 14 21:21:30 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 21:21:30 localhost systemd-sleep[567]: Battery was not
discharged during suspension
2022-07-20 17:39:07 +05:30
Sonali Srivastava 96d662fa4c sleep: use current charge level to decide suspension
If battery current charge percentage is below 5% hibernate directly.
Else initial suspend interval is set for HibernateDelaySec. On wakeup
estimate battery discharge rate per hour and if battery charge
percentage is not below 5% system is suspended else hibernated.
2022-07-20 14:46:43 +05:30
Yu Watanabe e1b45a756f tree-wide: fix typo 2022-07-20 13:15:37 +09:00
Luca Boccassi 9b9ddaf09d Merge pull request #24001 from yuwata/network-lifetime-fix
network: fixes for lifetime handling
2022-07-18 10:02:02 +01:00
Yu Watanabe 5509518193 Merge pull request #24047 from dtardon/list-users-linger
Add linger status to `loginctl list-users`
2022-07-18 15:05:25 +09:00
Richard Huang 5f2b4f9cb9 Update sleep.conf HibernateDelaySec default to match implementation 2022-07-18 15:04:03 +09:00
David Tardon cbc2593eea systemctl: include upheld units in dependencies
Fixes: #22706
2022-07-17 20:50:19 +01:00
David Tardon c5912adc85 loginctl: add linger status to list-users output
Fixes: #3907
2022-07-16 15:10:26 +02:00
Frantisek Sumsal e99b9285cb core: drop a stray %m specifier from a warning message
since in this specific case (r == 0) `errno` is irrelevant and most likely
set to zero, leading up to a confusing message:

```
[  120.595085] H systemd[1]: session-5.scope: No PIDs left to attach to the scope's control group, refusing: Success
[  120.595144] H systemd[1]: session-5.scope: Failed with result 'resources'.
```
2022-07-16 07:00:40 +09:00