Commit Graph
2101 Commits
Author SHA1 Message Date
Alvin Šipraga 19ff06b3a4 udev/net: support Match.Firmware= in .link files (#22462)
In cbcdcaaa0e ("Add support for conditions on the machines firmware")
a new Firmware= directive was added for .netdev and .network files.
While it was also documented to work on .link files, in actual fact the
support was missing. Add that one extra line to make it work, and also
update the fuzzer directives.
2022-02-10 16:19:28 +09:00
Yu Watanabe 18f84f8aba udev/net: support to set MDI-X mode
Closes #22386.
2022-02-08 15:47:46 +00:00
Franck Bui e36b00e938 udev/net_id: show the correct identifier in the debug output of dev_pci_onboard() 2022-02-04 09:45:47 +01:00
Lennart Poettering a24e3938e8 udevadm: don't claim a sysattr was write only just because we get EPERM on read
it might be totally inaccessible, hence weaken our language a bit and
just say "not readable", thus making not claim whether it is writable or
not.

Follow-up for 3a90bef55a
2022-02-03 07:32:54 +09:00
Yu Watanabe 043543f1bb udevadm: trigger: drop unnecessary slash 2022-02-02 20:34:38 +09:00
Yu Watanabe f4f3249539 udevadm: make test and test-builtin command accept /dev path or device unit 2022-02-02 20:34:38 +09:00
Yu Watanabe f30943c12f udev: do not generate format dynamically
Prompted by LGTM.
2022-02-02 20:34:31 +09:00
Yu Watanabe 57cbf080b3 Merge pull request #22205 from yuwata/udevadm-info-cleanups
udevadm: keep watch directory and several cleanups
2022-01-22 02:45:36 +09:00
Daan De Meyer e93ada9821 meson: Add missing test dependencies
Currently, running "meson build" followed by "meson test -C build"
will result in many failed tests due to missing dependencies. This
commit adds the missing dependencies to make sure no tests fail.
2022-01-22 01:56:03 +09:00
Yu Watanabe 4881a0d2d4 udevadm: add more assertions 2022-01-22 00:45:14 +09:00
Yu Watanabe 636ab00182 udevadm: simplify the code of removing udev state files 2022-01-22 00:44:51 +09:00
Yu Watanabe 9e0bd1d69b udevadm: split assertions
Then we can easily find which pointer is NULL.
2022-01-22 00:16:38 +09:00
Yu Watanabe bd97980193 udevadm: do not remove watch directory
See the comment in the code.
2022-01-22 00:13:32 +09:00
Martin Wilck 7ec624147a udevadm: cleanup-db: don't delete information for kept db entries
devices with the db_persist property won't be deleted during database
cleanup. This applies to dm and md devices in particular.
For such devices, we should also keep the files under /run/udev/links,
/run/udev/tags, and /run/udev/watch, to make sure that after restart,
udevd has the same information about the devices as it did before
the cleanup.

If we don't do this, a lower-priority device that is discovered in
the coldplug phase may take over symlinks from a device that persisted.
Not removing the watches also enables udevd to resume watching a device
after restart.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2022-01-21 13:32:20 +01:00
Martin Wilck 28d6e85451 udevadm: cleanup_dir: use dot_or_dot_dot()
which is safer than just checking dent[0].
Also, fix two style issues.
2022-01-21 13:31:42 +01:00
Yu Watanabe 252e96eaa9 udev/net: check if the requested SR-IOV virtual function exists before configuring it 2022-01-19 15:00:53 +09:00
Yu Watanabe 41ce9d769d udev/net: allow to set number of SR-IOV virtual functions
This adds SR-IOVVirtualFunctions= setting in [Link] section.
2022-01-19 15:00:53 +09:00
Yu Watanabe bd29dfef8b udev/net: also support [SR-IOV] section in .link files
The same section is already supported by .network files. But such
low-level inteerface setting should be done by udevd, instead of
networkd. Let's also support the same semantics by .link files.

Prompted by https://github.com/systemd/systemd/issues/20474#issuecomment-901901360.
2022-01-19 15:00:49 +09:00
Jan Janssen bbec46c817 meson: Use files() for fuzzers
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Jan Janssen e1eeebbb11 meson: Use files() for tests
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Yu Watanabe 60e930fc3e udev: fix ID_NET_NAME_MAC= udev property
This fixes a bug introduced by eaba9bb3e6.

The commit mistakenly drops 'x' in ID_NET_NAME_MAC, and adds colons.
The colons were dropped by the commit dfa4876c41,
but the missing 'x' was not added at that time.

Follow-up for dfa4876c41.
2021-12-31 13:21:12 +00:00
Yu Watanabe 3e7bf8535f tree-wide: fix typo 2021-12-25 18:32:22 +09:00
Yu Watanabe b0c01c9846 test: add test for truncation of program result invoked by udev 2021-12-25 15:13:19 +09:00
Yu Watanabe 567c19a62c udev: refuse to process line when invalid program output is obtained 2021-12-25 15:13:19 +09:00
Yu Watanabe 6b6e471a32 udev: do not import property value from truncated line of program result 2021-12-25 15:13:19 +09:00
Yu Watanabe 7056adbf16 udev: warn about truncation of program result
Closes #21078.
2021-12-25 15:13:19 +09:00
Yu Watanabe f6caab8995 udev: warn when result of string substitution is truncated 2021-12-25 15:13:17 +09:00
Yu Watanabe 37057fe93e Merge pull request #21762 from yuwata/udev-ctrl-do-not-kill
udev: do not kill "udevadm control" processes in the same cgroup
2021-12-25 15:08:13 +09:00
Xiaotian Wu ff6d286902 dmi: add LoongArch 64bit support 2021-12-22 11:07:54 +08:00
Yu Watanabe ccadf9ac0d udev: do not kill "udevadm control" process in the same cgroup
Fixes #16867.
2021-12-18 20:05:26 +09:00
Yu Watanabe f9da11ef1e udev-ctrl: make udev_ctrl_send() accept integer and string through a single argument 2021-12-18 19:41:14 +09:00
Yu Watanabe a00fd2a553 Merge pull request #21800 from keszybz/net-id-debugging
Add more debugging info to udev builtin net_id
2021-12-18 08:35:08 +09:00
Zbigniew Jędrzejewski-Szmek edee65a6a4 udev/net_id: add debug logging for construction of device names
I think this makes it much easier to figure out what information sources
were used to generate the names, and why certain names were not generated.

On my laptop:

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
wwp0s20f0u2i12: addr_assign_type=3, MAC address is not permanent.
wwp0s20f0u2i12: Parsing slot information from sysname "0000:00:14.0": success
wwp0s20f0u2i12: dev_port=0
wwp0s20f0u2i12: PCI path identifier: domain=0 bus=0 slot=20 func=0 phys_port= dev_port=0 → p0s20f0
wwp0s20f0u2i12: USB name identifier: ports=2 config=1 interface=12 → u2i12
ID_NET_NAME_PATH=wwp0s20f0u2i12

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
ID_NET_NAME_MAC=en54ee75cb1dc0
enp0s31f6: MAC address identifier: hw_addr=54:ee:75:cb:1d:c0 → 54ee75cb1dc0
ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
enp0s31f6: Parsing slot information from sysname "0000:00:1f.6": success
enp0s31f6: dev_port=0
enp0s31f6: PCI path identifier: domain=0 bus=0 slot=31 func=6 phys_port= dev_port=0 → p0s31f6
ID_NET_NAME_PATH=enp0s31f6

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
ID_NET_NAME_MAC=en0050b6856d36
hub0: MAC address identifier: hw_addr=00:50:b6:85:6d:36 → 0050b6856d36
ID_OUI_FROM_DATABASE=GOOD WAY IND. CO., LTD.
hub0: Parsing slot information from sysname "0000:00:14.0": success
hub0: dev_port=0
hub0: PCI path identifier: domain=0 bus=0 slot=20 func=0 phys_port= dev_port=0 → p0s20f0
hub0: USB name identifier: ports=4.1.3 config=2 interface=0 → u4u1u3c2
ID_NET_NAME_PATH=enp0s20f0u4u1u3c2

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
wlp4s0: addr_assign_type=3, MAC address is not permanent.
wlp4s0: Parsing slot information from sysname "0000:04:00.0": success
wlp4s0: dev_port=0
wlp4s0: PCI path identifier: domain=0 bus=4 slot=0 func=0 phys_port= dev_port=0 → p4s0
ID_NET_NAME_PATH=wlp4s0
2021-12-17 19:07:42 +01:00
Zbigniew Jędrzejewski-Szmek 3c1af24182 udev/net_id: use STRLEN() to make code clearer
The code was correct, but looked suspicious: we were comparing
strlen(x) with sizeof(y), with looks like an off-by-one. But we actually
want x to be one longer than y, so that's fine. Let's use STRLEN() to
make this more obvious.

While at it, drop unnecessary "_" prefix.
2021-12-17 11:45:55 +01:00
Zbigniew Jędrzejewski-Szmek be0586610e udev/net_id: fix signedness in format string
Both variables are unsigned. In practice those numbers cannot be large
enough to become negative, but let's use the correct type anyway.
2021-12-17 11:45:55 +01:00
Yu Watanabe d9338387d9 Merge pull request #21786 from keszybz/dirent-work
Make FOREACH_DIRENT and FOREACH_DIRENT_ALL declare the iterator variables
2021-12-17 04:07:35 +09:00
Zbigniew Jędrzejewski-Szmek 03f7ddf0bf meson: stop building out convenience libraries by default
The meson default for static_library() are:
build_by_default=true, install=false. We never interact with the
static libraries, and we only care about them as a stepping-stone towards
the installable executables or libraries. Thus let's only build them if
they are a dependency of something else we are building.

While at it, let's drop install:false, since this appears to be the default.

This change would have fixed the issue with lib_import_common failing
to build too: we wouldn't attempt to build it.

In practice this changes very little, because we generally only declare static
libraries where there's something in the default target that will make use of
them. But it seems to be a better pattern to set build_by_default to false.
2021-12-16 11:01:08 +01:00
Yu Watanabe ff516b4341 udev: move NamePolicy to netif-naming-scheme.[ch] 2021-12-16 01:55:37 +09:00
Zbigniew Jędrzejewski-Szmek c7f0d9e5ac tree-wide: make FOREACH_DIRENT_ALL define the iterator variable
The variable is not useful outside of the loop (it'll always be null
after the loop is finished), so we can declare it inline in the loop.
This saves one variable declaration and reduces the chances that somebody
tries to use the variable outside of the loop.

For consistency, 'de' is used everywhere for the var name.
2021-12-15 16:19:13 +01:00
Yu Watanabe 3a90bef55a udevadm: also show write-only attributes 2021-12-14 21:50:02 +09:00
Yu Watanabe 45aa0e841b network,udev: do not adjust local assignment bit of specified MAC address
People often assigns the MAC address of the enslaved interface to e.g.
bridge interface. So, the local assignment bit should not be adjusted.

Fixes #21649.
2021-12-07 15:01:04 +09:00
Yu Watanabe 6885a857e4 udev/path-id: comment why USB host number is dropped from the PATH_ID
Closes #21617.

The comment is borrowed from https://github.com/systemd/systemd/pull/21620#discussion_r762521508.
2021-12-06 16:06:04 +09:00
Yu Watanabe 56615f203b udev/path_id: fix skip_subsystem()
This partially reverts d340bdd1bd.

The function previously drops multiple except for the last parents
which matches the specified subsystem.
But the commit d340bdd1bd drops all
parents.

E.g. input is pci-pci-pci-usb-usb-usb, then
Before d340bdd: pci-pci-pci-usb
After d340bdd: pci-pci-pci
2021-12-06 16:01:33 +09:00
Yu Watanabe 8add30a03c tree-wide: use ERRNO_IS_TRANSIENT() 2021-11-30 23:06:43 +09:00
Yu Watanabe 9e2b7763d3 udev/net: make MACAddress= takes hardware address for infiniband 2021-11-26 21:06:24 +09:00
Yu Watanabe 613701a4e8 udev/net: introduce "struct Link" to store link attributes 2021-11-26 21:06:24 +09:00
Yu Watanabe 418c02c3f1 udev/net: rename variables 2021-11-26 21:06:24 +09:00
Yu Watanabe 5213507113 network,udev: make .network and .link file can match with hardware address longer or shorter than ETH_ALEN 2021-11-25 20:14:46 +01:00
Zbigniew Jędrzejewski-Szmek a33bc79b99 udev/cdrom_id: use a macro to initialize context
c was initialized unconditionally, but one has to look at the function
body to understand this. Let's make the whole thing shorter and more
direct.
2021-11-23 12:31:20 +01:00
Lennart Poettering 35cd0ba516 shared: clean up mkdir.h/label.h situation
Previously the mkdir_label() family of calls was implemented in
src/shared/mkdir-label.c but its functions partly declared ins
src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird
(and wrong).

Let's clean this up, and add a proper mkdir-label.h matching the .c
file.
2021-11-16 17:03:28 +01:00