summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/linux-info.eclass50
-rw-r--r--sys-apps/systemd/files/249-network-renaming.patch41
-rw-r--r--sys-apps/systemd/systemd-249.4-r4.ebuild (renamed from sys-apps/systemd/systemd-249.4-r3.ebuild)1
3 files changed, 64 insertions, 28 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 4e08949a3854..9eae5ad589bb 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -205,9 +205,10 @@ getfilevar() {
# We use nonfatal because we want the caller to take care of things #373151
# Pass need-config= to make to avoid config check in kernel Makefile.
+ # Pass dot-config=0 to avoid the config check in kernels prior to 5.4.
[[ ${EAPI:-0} == [0123] ]] && nonfatal() { "$@"; }
echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
- nonfatal emake -C "${basedname}" M="${T}" need-config= ${BUILD_FIXES} -s -f - 2>/dev/null
+ nonfatal emake -C "${basedname}" M="${T}" dot-config=0 need-config= ${BUILD_FIXES} -s -f - 2>/dev/null
ARCH=${myARCH}
fi
@@ -629,34 +630,27 @@ get_running_version() {
die "${FUNCNAME}() called on non-Linux system, please fix the ebuild"
fi
- KV_FULL=$(uname -r)
-
- if [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
- KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
- KBUILD_OUTPUT=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
- unset KV_FULL
- get_version
- return $?
- elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile ]]; then
- KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
- unset KV_FULL
- get_version
- return $?
- elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
- KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
- unset KV_FULL
- get_version
- return $?
- else
- # This handles a variety of weird kernel versions. Make sure to update
- # tests/linux-info_get_running_version.sh if you want to change this.
- local kv_full=${KV_FULL//[-+_]*}
- KV_MAJOR=$(ver_cut 1 ${kv_full})
- KV_MINOR=$(ver_cut 2 ${kv_full})
- KV_PATCH=$(ver_cut 3 ${kv_full})
- KV_EXTRA="${KV_FULL#${KV_MAJOR}.${KV_MINOR}${KV_PATCH:+.${KV_PATCH}}}"
- : ${KV_PATCH:=0}
+ local kv=$(uname -r)
+
+ if [[ -f ${ROOT%/}/lib/modules/${kv}/source/Makefile ]]; then
+ KERNEL_DIR=$(readlink -f "${ROOT%/}/lib/modules/${kv}/source")
+ if [[ -f ${ROOT%/}/lib/modules/${kv}/build/Makefile ]]; then
+ KBUILD_OUTPUT=$(readlink -f "${ROOT%/}/lib/modules/${kv}/build")
+ fi
+ get_version && return 0
fi
+
+ KV_FULL=${kv}
+
+ # This handles a variety of weird kernel versions. Make sure to update
+ # tests/linux-info_get_running_version.sh if you want to change this.
+ local kv_full=${KV_FULL//[-+_]*}
+ KV_MAJOR=$(ver_cut 1 ${kv_full})
+ KV_MINOR=$(ver_cut 2 ${kv_full})
+ KV_PATCH=$(ver_cut 3 ${kv_full})
+ KV_EXTRA="${KV_FULL#${KV_MAJOR}.${KV_MINOR}${KV_PATCH:+.${KV_PATCH}}}"
+ : ${KV_PATCH:=0}
+
return 0
}
diff --git a/sys-apps/systemd/files/249-network-renaming.patch b/sys-apps/systemd/files/249-network-renaming.patch
new file mode 100644
index 000000000000..b9eecf57b10f
--- /dev/null
+++ b/sys-apps/systemd/files/249-network-renaming.patch
@@ -0,0 +1,41 @@
+From 160203e974945ce520fe8f569458634ef898c61c Mon Sep 17 00:00:00 2001
+From: Yu Watanabe <watanabe.yu+github@gmail.com>
+Date: Fri, 10 Sep 2021 08:09:56 +0900
+Subject: [PATCH] network: fix handling of network interface renaming
+
+Fixes #20657.
+---
+ src/network/networkd-link.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 4afd540d2015..caad6205ae83 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -1470,17 +1470,21 @@ static int link_initialized(Link *link, sd_device *device) {
+ assert(link);
+ assert(device);
+
+- if (link->state != LINK_STATE_PENDING)
+- return 0;
++ /* Always replace with the new sd_device object. As the sysname (and possibly other properties
++ * or sysattrs) may be outdated. */
++ sd_device_ref(device);
++ sd_device_unref(link->sd_device);
++ link->sd_device = device;
+
+- if (link->sd_device)
++ /* Do not ignore unamanaged state case here. If an interface is renamed after being once
++ * configured, and the corresponding .network file has Name= in [Match] section, then the
++ * interface may be already in unmanaged state. See #20657. */
++ if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_UNMANAGED))
+ return 0;
+
+ log_link_debug(link, "udev initialized link");
+ link_set_state(link, LINK_STATE_INITIALIZED);
+
+- link->sd_device = sd_device_ref(device);
+-
+ /* udev has initialized the link, but we don't know if we have yet
+ * processed the NEWLINK messages with the latest state. Do a GETLINK,
+ * when it returns we know that the pending NEWLINKs have already been
diff --git a/sys-apps/systemd/systemd-249.4-r3.ebuild b/sys-apps/systemd/systemd-249.4-r4.ebuild
index b651ce706624..dff4c1140078 100644
--- a/sys-apps/systemd/systemd-249.4-r3.ebuild
+++ b/sys-apps/systemd/systemd-249.4-r4.ebuild
@@ -229,6 +229,7 @@ src_prepare() {
"${FILESDIR}/249-libudev-static.patch"
"${FILESDIR}/249-home-secret-assert.patch"
"${FILESDIR}/249-fido2.patch"
+ "${FILESDIR}/249-network-renaming.patch"
)
if ! use vanilla; then