parent
392204423c
commit
62500e3a7f
@ -1,3 +1,3 @@
|
|||||||
SOURCES/nmstate-2.2.7.tar.gz
|
SOURCES/nmstate-2.2.10.tar.gz
|
||||||
SOURCES/nmstate-vendor-2.2.7.tar.xz
|
SOURCES/nmstate-vendor-2.2.10.tar.xz
|
||||||
SOURCES/nmstate.gpg
|
SOURCES/nmstate.gpg
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
81e7b247cdbce99278f10da00b36865512c07672 SOURCES/nmstate-2.2.7.tar.gz
|
8fb04d2537b3a700d9e979ef67b9298c31555723 SOURCES/nmstate-2.2.10.tar.gz
|
||||||
c0ca6dae9ed0042aa2da5bb3a048677391370bb5 SOURCES/nmstate-vendor-2.2.7.tar.xz
|
cccaa521f9271fc0acf4196538edf090d747a306 SOURCES/nmstate-vendor-2.2.10.tar.xz
|
||||||
5c1d9d65f9db4fedc9dc96e0fb6cac0a86749c88 SOURCES/nmstate.gpg
|
b01a236c478366b0248688f02d299cb29168a080 SOURCES/nmstate.gpg
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
From c9fd1e80d3c87e1f844edcd86e9d36ae499ce717 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gris Ge <fge@redhat.com>
|
||||||
|
Date: Sun, 23 Apr 2023 16:01:29 +0800
|
||||||
|
Subject: [PATCH] cli: Do nothing for `persist-nic-names` when got
|
||||||
|
`net.ifnames=0`
|
||||||
|
|
||||||
|
When `net.ifnames=0` is defined in kernel argument, systemd will disable
|
||||||
|
the predicable network interface name which make no sense for nmstate to
|
||||||
|
pin the interface names. Hence we do nothing in `persist-nic-names` in
|
||||||
|
that case.
|
||||||
|
|
||||||
|
Manually tested in CentOS stream 9 VM.
|
||||||
|
|
||||||
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||||
|
---
|
||||||
|
rust/src/cli/persist_nic.rs | 19 +++++++++++++++++++
|
||||||
|
1 file changed, 19 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/rust/src/cli/persist_nic.rs b/rust/src/cli/persist_nic.rs
|
||||||
|
index 6b126d58..61b07dbb 100644
|
||||||
|
--- a/rust/src/cli/persist_nic.rs
|
||||||
|
+++ b/rust/src/cli/persist_nic.rs
|
||||||
|
@@ -7,6 +7,8 @@
|
||||||
|
//!
|
||||||
|
//! The logic currently is:
|
||||||
|
//!
|
||||||
|
+//! - Do nothing if kernel argument contains `net.ifnames=0` which disabled the
|
||||||
|
+//! predicable network interface name, hence not fit our use case here.
|
||||||
|
//! - Iterate over all active NICs
|
||||||
|
//! - Pin every ethernet interface to its MAC address (prefer permanent MAC
|
||||||
|
//! address)
|
||||||
|
@@ -70,6 +72,14 @@ pub(crate) fn run_persist_immediately(
|
||||||
|
PersistAction::CleanUpDryRun => return clean_up(root, true),
|
||||||
|
};
|
||||||
|
|
||||||
|
+ if is_prediable_ifname_disabled() {
|
||||||
|
+ log::info!(
|
||||||
|
+ "Systemd predicable network interface name is disabled \
|
||||||
|
+ by kernel argument `net.ifnames=0`, will do nothing"
|
||||||
|
+ );
|
||||||
|
+ return Ok("".to_string());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
let stamp_path = Path::new(root)
|
||||||
|
.join(SYSTEMD_NETWORK_LINK_FOLDER)
|
||||||
|
.join(NMSTATE_PERSIST_STAMP);
|
||||||
|
@@ -317,3 +327,12 @@ fn is_nmstate_generated_systemd_link_file(file_path: &PathBuf) -> bool {
|
||||||
|
.map(|_| buff == PERSIST_GENERATED_BY.as_bytes())
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+const KERNEL_CMDLINE_FILE: &str = "/proc/cmdline";
|
||||||
|
+
|
||||||
|
+fn is_prediable_ifname_disabled() -> bool {
|
||||||
|
+ std::fs::read(KERNEL_CMDLINE_FILE)
|
||||||
|
+ .map(|v| String::from_utf8(v).unwrap_or_default())
|
||||||
|
+ .map(|c| c.contains("net.ifnames=0"))
|
||||||
|
+ .unwrap_or_default()
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.40.0
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
From 333e82445c048812e3e85fb9f3cb7558dc3f2aeb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gris Ge <fge@redhat.com>
|
||||||
|
Date: Tue, 25 Apr 2023 14:10:34 +0800
|
||||||
|
Subject: [PATCH] ip: Fix error when DHCP with auto IP address on STP enabled
|
||||||
|
bridge
|
||||||
|
|
||||||
|
When DHCP enabled with auto IP address on STP enabled bridge, nmstate
|
||||||
|
will fail with verification error:
|
||||||
|
|
||||||
|
Verification failure: br0.interface.ipv4.address desire '[]',
|
||||||
|
current 'null'
|
||||||
|
|
||||||
|
The root cause is STP suspended the DHCP action which cause current
|
||||||
|
state shows null IP address. And nmstate incorrectly treat [] != null
|
||||||
|
for IP address.
|
||||||
|
|
||||||
|
Fixed in `sanitize_current_for_verify()` to set empty array if None.
|
||||||
|
|
||||||
|
To reproduce this problem, we just enable DHCP with auto IP address
|
||||||
|
where no DHCP server exists. Integration test case included.
|
||||||
|
|
||||||
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||||
|
---
|
||||||
|
rust/src/lib/query_apply/ip.rs | 13 ++++++++++---
|
||||||
|
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/rust/src/lib/query_apply/ip.rs b/rust/src/lib/query_apply/ip.rs
|
||||||
|
index b2d6ac49..a6df740b 100644
|
||||||
|
--- a/rust/src/lib/query_apply/ip.rs
|
||||||
|
+++ b/rust/src/lib/query_apply/ip.rs
|
||||||
|
@@ -12,6 +12,11 @@ impl InterfaceIpv4 {
|
||||||
|
if self.dhcp_custom_hostname.is_none() {
|
||||||
|
self.dhcp_custom_hostname = Some(String::new());
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // No IP address means empty.
|
||||||
|
+ if self.enabled && self.addresses.is_none() {
|
||||||
|
+ self.addresses = Some(Vec::new());
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort addresses and dedup
|
||||||
|
@@ -89,6 +94,11 @@ impl InterfaceIpv6 {
|
||||||
|
if self.dhcp_custom_hostname.is_none() {
|
||||||
|
self.dhcp_custom_hostname = Some(String::new());
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // No IP address means empty.
|
||||||
|
+ if self.enabled && self.addresses.is_none() {
|
||||||
|
+ self.addresses = Some(Vec::new());
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort addresses and dedup
|
||||||
|
@@ -96,9 +106,6 @@ impl InterfaceIpv6 {
|
||||||
|
if let Some(addrs) = self.addresses.as_mut() {
|
||||||
|
addrs.sort_unstable();
|
||||||
|
addrs.dedup();
|
||||||
|
- if addrs.is_empty() {
|
||||||
|
- self.addresses = None;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub(crate) fn update(&mut self, other: &Self) {
|
||||||
|
--
|
||||||
|
2.40.0
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQIzBAABCAAdFiEESP1vrlFad7SENoIch4lWe4cVzrwFAmRE9mYACgkQh4lWe4cV
|
||||||
|
zrw58w/+Jsk4Ot5Pnyif9KaI7WXbZAncUw86CClteu8sThT/TZDWcPd//t7xy6tA
|
||||||
|
BzLF9blOMrpIBwvMVchfe4fFz8f/t5rRKO8SycymOcLI/IGKCLXAzRP7BdL6wQDm
|
||||||
|
HD+SCAzF8VFm6u8gZy5hZDE1PVuz2WDkcU/lkPt9EFRzbG8FW1oMEfH+rc48bSQx
|
||||||
|
thgZlLK7lUU9w4ZWJ6H4uh+AToRlzsvw7xU3ARB056FyRs4pls1BQrDyDZQOfuc9
|
||||||
|
NmeFdy9lDpITF9zvMTrDhviobVAEO/MmBBinoPf5WEkf59b+JNoBOQU77LsmyJn8
|
||||||
|
XaFy7DuXyMkQtM+XR9X8jy50eEvDqsOH+Ww2HzHFbzY74nKDff+Ip7iTwmBxPkG0
|
||||||
|
QM6Py0A6ToROi3nZK3RFacBkVVM2BPYXxBQhhXeO9rI1siig6aEhDaoyvHItnj2b
|
||||||
|
7MoI7dKXvAtSCKpBt92XVn/vdLaLPx6pXjh0hnb4PblepZx10BVWEdY2LpH6PXav
|
||||||
|
YBvZ37Xz0JUqJdNPcANG+7Boq3qhfmB2Pei6/IMeoNOxHZsVI7FyPmtXAe2egXSc
|
||||||
|
iQMYlD8nlYBDAOC0JjGrU5fPxWKKjT9J3Aa2qdKjS3Op7lJoUtT8TUdGB0ePsNmi
|
||||||
|
LF3FaTxETspZyNLyt7iY8kRvLV4zfVAbE0UOlfnVCbQr2vIsVU0=
|
||||||
|
=Rr+7
|
||||||
|
-----END PGP SIGNATURE-----
|
@ -1,16 +0,0 @@
|
|||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQIzBAABCAAdFiEE8f1XsqXpyNthgIbGbM3lj+QeKP8FAmPuL/wACgkQbM3lj+Qe
|
|
||||||
KP9Y0g/+O1eW+RJt6f+XrEW8bIK8cnJhdBTZ80ptwvFV2UA9Jr1IW+HAZIRZd2kq
|
|
||||||
wqHpFqsP4vyvPiOnOHKYfftdRJQj66tS589gy8f4A+RWUlnKYEo0M392FpWEdKFR
|
|
||||||
1lhcH/2ySw/RghsmtkTJqo9LykBVE6T9KVspzm2GFvi5JvvaMMChG8OaHeLVen/B
|
|
||||||
+mhJGFyQdhucjDNguU+py0gxIw1jcgsohdV7UaH+TcCR1xYZ4rweWiGauiLKIYKT
|
|
||||||
KFOQWC+jCw6sZ6lRdvGMwQvQ2OdoOT7w75vOCJ6NgIwDYTIsxcAQwQ5KiAAg1Cln
|
|
||||||
vlD4SOwB3yTzCXDyM137Y0TIKpRHTa9itDFs93Y2PrBFm/U7ZWzI2B7L2nXCdiZG
|
|
||||||
4PBv1TzWlKR+egIppP2Jpty5RATJvOn5WgW033JdChuc3s4ACzO2TlURfSDtDM3I
|
|
||||||
53nMslgt77JrLfw06Ree5R1oMVT6xOGrVerRhlGQtvCIBgqMbMd6kXDJyx2t6fsV
|
|
||||||
rmvnuzQ786NEr0XBoec2ANUI9U2iuqvp/XzAZ4xkq7rUmZ7f924U/Z1j55t4Z91F
|
|
||||||
SzY8gK9yOmabPiXwf9cGLV/duTU3TUUYX69OXgugStsbQkA+likmIvSx7caCz21t
|
|
||||||
JnhpSkJqRfeVVrYcUpGpZAI4rY75A8WwSV/2OMht0yd8x57asHc=
|
|
||||||
=AR0r
|
|
||||||
-----END PGP SIGNATURE-----
|
|
Loading…
Reference in new issue