diff options
author | Etienne Champetier <e.champetier@ateme.com> | 2024-08-22 22:30:56 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-23 02:30:49 +0200 |
commit | 448f9f81fd32f8658449101ada2eadd853f6b06b (patch) | |
tree | 0bb9b75d35a15f50fce34d45e7f62e32ad8e0895 /src | |
parent | Merge pull request #34087 from DaanDeMeyer/nspawn-init-revert (diff) | |
download | systemd-448f9f81fd32f8658449101ada2eadd853f6b06b.tar.xz systemd-448f9f81fd32f8658449101ada2eadd853f6b06b.zip |
udev-builtin-net_id: ignore firmware_node/sun == 0
Since ID_NET_NAME_SLOT was introduced we ignore slot == 0
https://github.com/systemd/systemd/blob/0035597a30d120f70df2dd7da3d6128fb8ba6051/src/udev/udev-builtin-net_id.c#L139
Qemu sets _SUN to PCI_SLOT() for all NICs, so _SUN is not unique.
https://gitlab.com/qemu-project/qemu/-/issues/2530
In my tests with libvirt I can only set 'slot="0x00"' in interface definition,
so all NICs end up with _SUN == 0, and this commit is enough to avoid the issue.
Fixes 0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 5094b95373..f88fa0f71d 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -577,10 +577,14 @@ static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) { if (r < 0) return log_device_debug_errno(dev, r, "Failed to read firmware_node/sun, ignoring: %m"); - r = safe_atou32(attr, ret); + uint32_t sun; + r = safe_atou32(attr, &sun); if (r < 0) return log_device_warning_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr); + if (sun == 0) + return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "firmware_node/sun == 0, ignoring: %m"); + *ret = sun; return 0; } |