Commit Graph
3572 Commits
Author SHA1 Message Date
Lennart Poettering 897448bd37 sd-event: if signal nr has high bit set sd_event_add_signal() auto-block it via sigprocmask()
So far we expected callers to block the signals manually. Which is
usually a good idea, since they should do that before forking off
threads and similar. But let's add a mode where we automatically block
it for the caller, to simplify things.
2022-09-30 14:17:46 +02:00
Lennart Poettering dd51b0f952 Merge pull request #24805 from yuwata/sd-network
sd-network: several cleanups
2022-09-27 11:28:25 +02:00
Yu Watanabe b577d5569d Merge pull request #24812 from yuwata/udev-drop-netlink
udev: drop workaround for slow read of phys_port_name sysattr
2022-09-27 14:10:02 +09:00
Yu Watanabe e05dd7718d sd-network: make sd_network_link_get_dns() or friends return -ENODATA
To make them consistent with other functions.
2022-09-27 10:42:31 +09:00
Yu Watanabe 778e3da95e sd-network: drop fallback values
This drops spurious lines in `networkctl status` for unmanaged interfaces.
Before:
```
$ networkctl status --lines 0 lo
● 1: lo
                     Link File: n/a
                  Network File: n/a
                          Type: loopback
                         State: carrier (unmanaged)
                  Online state: unknown
                    HW Address: 00:00:00:00:00:00
                           MTU: 65536
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
          Queue Length (Tx/Rx): 1/1
                       Address: 127.0.0.1
                                ::1
             Activation Policy: up
           Required For Online: yes
```
After:
```
$ networkctl status --lines 0 lo
● 1: lo
                     Link File: n/a
                  Network File: n/a
                         State: carrier (unmanaged)
                  Online state: unknown
                          Type: loopback
              Hardware Address: 00:00:00:00:00:00
                           MTU: 65536
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 1/1
                       Address: 127.0.0.1
                                ::1
```

That is, the lines for Activation Policy and Required For Online are
dropped.
2022-09-27 10:42:31 +09:00
Yu Watanabe c9d22489ca sd-network: introduce network_link_get_boolean() helper function 2022-09-27 10:42:31 +09:00
Yu Watanabe 27b13df45a sd-network: accept all space-like separators 2022-09-27 10:42:31 +09:00
Yu Watanabe ce2e75021c sd-network: propagate -ENOENT
On -ENOENT, it suggests that network-manager is not running, and
interfaces are not unmanaged. Such information may be useful for
callers.
2022-09-27 10:42:31 +09:00
Yu Watanabe e7c1b3f73a sd-network: rename function arguments for storing return value 2022-09-27 10:42:27 +09:00
Lennart Poettering d57e43ad28 Merge pull request #24757 from yuwata/sd-device-get-child-first
sd-device: introduce sd_device_get_child_first() and _next()
2022-09-26 19:03:15 +02:00
Yu Watanabe bb1bc2fcb0 sd-device: introduce device_get_sysattr_int() 2022-09-25 13:59:49 +09:00
Lennart Poettering 32e2767080 tree-wide: use the term "initrd" at most places we so far used "initramfs"
In most cases we refernced the concept as "initrd". Let's convert most
remaining uses of "initramfs" to "initrd" too, to stay internally
consistent.

This leaves "initramfs" only where it's relevant to explain historical
concepts or where "initramfs" is part of the API (i.e. in
/run/initramfs).

Follow-up for: b66a6e1a58
2022-09-23 15:10:53 +02:00
Yu Watanabe fadc8c48ac test-sd-device: add tests for sd_device_get_child_first() and _next() 2022-09-23 07:03:18 +09:00
Yu Watanabe ec9b4f2b92 sd-device: introduce sd_device_get_child_first() and _next()
These functions provide a high-level interface for enumerating
child devices.

Suggested at https://github.com/systemd/systemd/pull/24731#discussion_r973987065.
2022-09-23 07:03:15 +09:00
Yu Watanabe 10a2f90d02 sd-device: refuse to get a parent device by sd_device_new_child() 2022-09-23 06:53:09 +09:00
Yu Watanabe 83b94cf10e sd-device: use fd_reopen() at one more place
It provides recognizable error if /proc is not mounted.
2022-09-20 09:41:34 +02:00
Yu Watanabe 62ccd11d38 sd-device: use device_opendir() 2022-09-19 19:42:36 +09:00
Yu Watanabe db3049b6f0 sd-device: introduce device_opendir() 2022-09-19 19:42:02 +09:00
Yu Watanabe 4bc9d8165b sd-device: re-implement device_sysattrs_read_all() without recursion 2022-09-19 18:04:13 +09:00
Yu Watanabe 5b304c7052 sd-device: use faccessat()
No functional changes, just refactoring.
2022-09-19 18:04:13 +09:00
Yu Watanabe 65c0f14bc1 sd-device: use fstatat()
No functional changes, just refactoring.
2022-09-19 18:04:13 +09:00
Yu Watanabe bc5e8ebbfb sd-device: use path_hash_ops to store sysattrs
As the stored values are actually path. Just for safety.

This also drops unnecessary duplication of path.
2022-09-19 18:04:12 +09:00
Yu Watanabe 23d3dfc369 sd-device: refuse block device without subsystem
Previously, even if sd_device_get_subsystem() returns -ENOENT for block
device, we accepted that. This makes the check slightly stricter.
2022-09-18 15:35:56 +02:00
Yu Watanabe dd35a61caf sd-netlink: unexport sd-netlink
This effectively reverts 84e1001541.

The sd-netlink library has several issues, and we should not export it
without solving them. See issues #24258 and #24124.
2022-09-17 01:31:57 +09:00
Yu Watanabe 8dcc66cefc uid-range: tie up number and array of uid range entries
This renames UidRange -> UidRangeEntry, and reintroduces UidRange which
contains the array of UidRangeEntry and its size.
No fucntional changes, just refactoring.
2022-09-16 20:56:58 +09:00
Yu Watanabe f91c23f785 sd-device-monitor: do not trigger assertion when uid_map is not empty
Follow-up for c0aa23cf1e.
2022-09-16 13:05:51 +02:00
j00512545 365c2885f0 fix typo in log 2022-09-15 17:46:04 +02:00
David Tardon 995340074e tree-wide: use ASSERT_PTR more 2022-09-13 08:13:27 +02:00
Yu Watanabe 3fb94c7062 sd-device: move device_new_from_watch_handle_at() to udev-watch.c
And drop unused watch handle related functions.
2022-09-12 01:36:06 +09:00
Yu Watanabe 88b5080ea9 sd-device-enumerator: use _cleanup_free_ attribute for safety
No functional changes, just improve readability.

Suggested by https://github.com/systemd/systemd/pull/24601#discussion_r966883459.
2022-09-09 21:16:37 +09:00
Yu Watanabe 89ad604839 sd-device-enumerator: always ignore ENOENT from opendir()
But logs all errors.
2022-09-09 21:16:37 +09:00
Yu Watanabe 0f519b9c2e sd-device-enumerator: check sysname earlier 2022-09-09 21:16:32 +09:00
Yu Watanabe 2d9c58d786 test: add test for sd_device_enumerator_add_match_parent() 2022-09-08 18:10:50 +09:00
Yu Watanabe 6c876f0c20 sd-device-enumerator: rewrite child enumeration without recursion 2022-09-08 18:10:50 +09:00
Yu Watanabe bae477676a sd-device-enumerator: do not fail when a directory vanishes on enumerate 2022-09-08 18:10:50 +09:00
Yu Watanabe cdffb95cce sd-device-enumerator: use test_matches() more 2022-09-08 18:10:50 +09:00
Yu Watanabe c0aa23cf1e sd-device-monitor: relax sender uid check when running in user namespace
If sd-device-monitor is running in a user namespace, the sender uid is
not zero. Let's relax the verification in that case.
2022-09-08 11:08:43 +09:00
Yu Watanabe 778912a659 sd-device: introduce devname_from_stat_rdev() 2022-09-03 00:42:31 +09:00
Yu Watanabe 4fe46c349d sd-device: rename devpath_from_devnum() -> devname_from_devnum()
In sd-device, `devpath` is a kind of syspath without '/sys' prefix, e.g.
/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0/nvme0n1,
and `devname` is a path to the device node, e.g. /dev/nvme0n1.

Let's use the consistent name for the helper function.
2022-09-03 00:42:31 +09:00
Jan Janssen f996072fe0 tree-wide: Fix field width specifier warnings
The casting here isn't pretty, but at least it makes it obvious what is
happening instead of implicit and it allows enabling -Wformat-signedness.
2022-08-30 12:03:33 +02:00
Jan Janssen 1dbab956ba journal: Show grcrypt error message instead of a raw code 2022-08-30 12:03:33 +02:00
Jan Janssen c0f86d66f3 tree-wide: Use correct format specifiers
gcc will complain about all these with -Wformat-signedness.
2022-08-30 12:03:28 +02:00
Topi Miettinen 5b198025de sd-netlink: add NetLabel support 2022-08-29 14:23:17 +09:00
Yu Watanabe 42899bcee5 sd-device: skip to check diskseq if device is not initialized 2022-08-28 10:10:44 +09:00
Yu Watanabe ff65036cfe sd-device: introduce device_open_from_devnum() 2022-08-28 09:08:21 +09:00
Yu Watanabe f79fdea6fd sd-device: introduce devpath_from_devnum() 2022-08-28 09:08:21 +09:00
Yu Watanabe a2ded81f73 sd-device: rename device-util.c -> device-filter.c
The functions provided by the file are only used in sd-device.
2022-08-28 09:08:21 +09:00
Yu Watanabe 6dd3b818bb tree-wide: fix typo 2022-08-28 00:03:36 +09:00
Luca Boccassi 34f166d601 Merge pull request #24456 from yuwata/network-tcp-congctl
network: introduce TCPCongestionControlAlgorithm=
2022-08-26 18:04:51 +01:00
Yu Watanabe 5342810bcf test-sd-device: run subsystem filter test several times
The test is quite racy. Let's wait for all queued udev events to be
processed, and run the test several times.

Fixes #24400.
2022-08-26 07:29:36 +00:00