mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 23:51:28 +03:00
udev/net-id: Fix check for address to keep interface names stable (#8458)
This was a bug inadvertently added by commit 73fc96c8ac
.
The intent of the check is to "match slot address with device by
stripping the function" (as the comment above states it), for example
match network device PCI address 0000:05:00.0 (including a .0 for
function) to PCI slot address 0000:05:00, but changing that to a streq()
call prevented the match.
Change that to startswith(), which should both fix the bug and make the
intent of the check more clear and prevent unintentional bugs from being
introduced by future refactorings.
This commit is contained in:
parent
848e863acc
commit
8eebb6a9e5
@ -297,7 +297,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
|
||||
if (snprintf_ok(str, sizeof str, "%s/%s/address", slots, dent->d_name) &&
|
||||
read_one_line_file(str, &address) >= 0)
|
||||
/* match slot address with device by stripping the function */
|
||||
if (streq(address, udev_device_get_sysname(names->pcidev)))
|
||||
if (startswith(udev_device_get_sysname(names->pcidev), address))
|
||||
hotplug_slot = i;
|
||||
|
||||
if (hotplug_slot > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user