Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/, sys-apps/systemd/files/
Date: Tue, 14 Sep 2021 23:47:23
Message-Id: 1631663165.456fb26fe2564868771b7948b6049dc96743d947.floppym@gentoo
1 commit: 456fb26fe2564868771b7948b6049dc96743d947
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 14 23:46:05 2021 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 14 23:46:05 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=456fb26f
7
8 sys-apps/systemd: backport network fix
9
10 Closes: https://bugs.gentoo.org/813102
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 sys-apps/systemd/files/249-network-renaming.patch | 41 ++++++++++++++++++++++
14 ...emd-249.4-r3.ebuild => systemd-249.4-r4.ebuild} | 1 +
15 2 files changed, 42 insertions(+)
16
17 diff --git a/sys-apps/systemd/files/249-network-renaming.patch b/sys-apps/systemd/files/249-network-renaming.patch
18 new file mode 100644
19 index 00000000000..b9eecf57b10
20 --- /dev/null
21 +++ b/sys-apps/systemd/files/249-network-renaming.patch
22 @@ -0,0 +1,41 @@
23 +From 160203e974945ce520fe8f569458634ef898c61c Mon Sep 17 00:00:00 2001
24 +From: Yu Watanabe <watanabe.yu+github@×××××.com>
25 +Date: Fri, 10 Sep 2021 08:09:56 +0900
26 +Subject: [PATCH] network: fix handling of network interface renaming
27 +
28 +Fixes #20657.
29 +---
30 + src/network/networkd-link.c | 14 +++++++++-----
31 + 1 file changed, 9 insertions(+), 5 deletions(-)
32 +
33 +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
34 +index 4afd540d2015..caad6205ae83 100644
35 +--- a/src/network/networkd-link.c
36 ++++ b/src/network/networkd-link.c
37 +@@ -1470,17 +1470,21 @@ static int link_initialized(Link *link, sd_device *device) {
38 + assert(link);
39 + assert(device);
40 +
41 +- if (link->state != LINK_STATE_PENDING)
42 +- return 0;
43 ++ /* Always replace with the new sd_device object. As the sysname (and possibly other properties
44 ++ * or sysattrs) may be outdated. */
45 ++ sd_device_ref(device);
46 ++ sd_device_unref(link->sd_device);
47 ++ link->sd_device = device;
48 +
49 +- if (link->sd_device)
50 ++ /* Do not ignore unamanaged state case here. If an interface is renamed after being once
51 ++ * configured, and the corresponding .network file has Name= in [Match] section, then the
52 ++ * interface may be already in unmanaged state. See #20657. */
53 ++ if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_UNMANAGED))
54 + return 0;
55 +
56 + log_link_debug(link, "udev initialized link");
57 + link_set_state(link, LINK_STATE_INITIALIZED);
58 +
59 +- link->sd_device = sd_device_ref(device);
60 +-
61 + /* udev has initialized the link, but we don't know if we have yet
62 + * processed the NEWLINK messages with the latest state. Do a GETLINK,
63 + * when it returns we know that the pending NEWLINKs have already been
64
65 diff --git a/sys-apps/systemd/systemd-249.4-r3.ebuild b/sys-apps/systemd/systemd-249.4-r4.ebuild
66 similarity index 99%
67 rename from sys-apps/systemd/systemd-249.4-r3.ebuild
68 rename to sys-apps/systemd/systemd-249.4-r4.ebuild
69 index b651ce70662..dff4c114007 100644
70 --- a/sys-apps/systemd/systemd-249.4-r3.ebuild
71 +++ b/sys-apps/systemd/systemd-249.4-r4.ebuild
72 @@ -229,6 +229,7 @@ src_prepare() {
73 "${FILESDIR}/249-libudev-static.patch"
74 "${FILESDIR}/249-home-secret-assert.patch"
75 "${FILESDIR}/249-fido2.patch"
76 + "${FILESDIR}/249-network-renaming.patch"
77 )
78
79 if ! use vanilla; then