Backport patch to revert inadvertent change of "predictable" interface name

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-03-20 09:31:28 +01:00
parent b5fa4adf3f
commit f770414d95
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 8eebb6a9e5e74ec0ef40902e2da53d24559b94a4 Mon Sep 17 00:00:00 2001
From: Filipe Brandenburger <filbranden@google.com>
Date: Thu, 15 Mar 2018 10:42:38 -0700
Subject: [PATCH] udev/net-id: Fix check for address to keep interface names
stable (#8458)
This was a bug inadvertently added by commit 73fc96c8ac0aa9.
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.
---
src/udev/udev-builtin-net_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 36994360c7..6efa712930 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -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)
--
2.16.2

View File

@ -13,7 +13,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 238
Release: 4%{?gitcommit:.git%{gitcommitshort}}%{?dist}
Release: 5%{?gitcommit:.git%{gitcommitshort}}%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -51,6 +51,7 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[
Patch0001: 0001-test-cgroup-util-bail-out-when-running-under-mock.patch
Patch0002: 0002-basic-fs-util-skip-fsync_directory_of_file-if-proc-s.patch
Patch0003: 0003-core-when-reloading-delay-any-actions-on-journal-and.patch
Patch0004: 0004-udev-net-id-Fix-check-for-address-to-keep-interface-.patch
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
@ -705,6 +706,9 @@ fi
%files tests -f .file-list-tests
%changelog
* Tue Mar 20 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 238-5
- Backport patch to revert inadvertent change of "predictable" interface name (#1558027)
* Fri Mar 16 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 238-4
- Do not close dbus connection during dbus reload call (#1554578)