New gpg public key and remove unused patches
Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
parent
85faae152b
commit
898940fd21
@ -1,124 +0,0 @@
|
||||
From 4fc0b3e09ad892e2b2da975b6786998729511ac6 Mon Sep 17 00:00:00 2001
|
||||
From: Gris Ge <fge@redhat.com>
|
||||
Date: Sun, 23 Apr 2023 17:37:00 +0800
|
||||
Subject: [PATCH 1/2] dep: Upgrade to nix 0.26.2
|
||||
|
||||
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||
---
|
||||
rust/src/lib/Cargo.toml | 2 +-
|
||||
rust/src/lib/nispor/hostname.rs | 15 ++++++++-------
|
||||
2 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/rust/src/lib/Cargo.toml b/rust/src/lib/Cargo.toml
|
||||
index 29fe4c34..1a4e96c4 100644
|
||||
--- a/rust/src/lib/Cargo.toml
|
||||
+++ b/rust/src/lib/Cargo.toml
|
||||
@@ -55,7 +55,7 @@ default-features = false
|
||||
features = ["derive"]
|
||||
|
||||
[dependencies.nix]
|
||||
-version = "0.24.1"
|
||||
+version = "0.26.2"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["feature", "hostname"]
|
||||
diff --git a/rust/src/lib/nispor/hostname.rs b/rust/src/lib/nispor/hostname.rs
|
||||
index 517bf7c7..b96fb3f3 100644
|
||||
--- a/rust/src/lib/nispor/hostname.rs
|
||||
+++ b/rust/src/lib/nispor/hostname.rs
|
||||
@@ -1,3 +1,5 @@
|
||||
+// SPDX-License-Identifier: Apache-2.0
|
||||
+
|
||||
use std::io::Read;
|
||||
|
||||
use crate::{ErrorKind, HostNameState, NmstateError};
|
||||
@@ -5,17 +7,16 @@ use crate::{ErrorKind, HostNameState, NmstateError};
|
||||
const HOST_NAME_MAX: usize = 64;
|
||||
|
||||
pub(crate) fn get_hostname_state() -> Option<HostNameState> {
|
||||
- let mut buffer = [0u8; HOST_NAME_MAX];
|
||||
- let running = match nix::unistd::gethostname(&mut buffer) {
|
||||
- Ok(hostname_cstr) => match hostname_cstr.to_str() {
|
||||
- Ok(h) => Some(h.to_string()),
|
||||
- Err(e) => {
|
||||
- log::error!("Failed to convert hostname to String: {}", e);
|
||||
+ let running = match nix::unistd::gethostname() {
|
||||
+ Ok(hostname_cstr) => match hostname_cstr.into_string() {
|
||||
+ Ok(h) => Some(h),
|
||||
+ Err(s) => {
|
||||
+ log::error!("Failed to convert hostname to String: {:?}", s);
|
||||
None
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
- log::error!("Failed to get hostname: {}", e);
|
||||
+ log::error!("Failed to get hostname {}", e);
|
||||
None
|
||||
}
|
||||
};
|
||||
--
|
||||
2.40.0
|
||||
|
||||
|
||||
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 2/2] 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
|
||||
|
@ -1,67 +0,0 @@
|
||||
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
|
||||
|
@ -15,9 +15,6 @@ Source3: %{url}/releases/download/v%{version}/%{srcname}-vendor-%{version
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2161128
|
||||
# but list Requires manually
|
||||
Patch1: 0001-Workaround-for-Fedora-rust-packaging.patch
|
||||
Patch2: 0002-fix_nix_deps.patch
|
||||
# https://github.com/coreos/fedora-coreos-tracker/issues/1480
|
||||
Patch3: 0003-Fix-error-when-DHCP-with-auto-IP-address-on-STP-e.patch
|
||||
BuildRequires: patchelf
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
|
2
sources
2
sources
@ -1,4 +1,4 @@
|
||||
SHA512 (nmstate-2.2.12.tar.gz) = ed4b786242a2273877d58be1495fd24c9a171b814e1b9de0363c6cd52d92cea8836ce9be81c2c5371d9f846e7192f83a53d0a0b7a2c85bf63b3a20035c9b8db3
|
||||
SHA512 (nmstate-2.2.12.tar.gz.asc) = 915228c73fb69c43cf53cd89547dcfa750d67a06e722c3664d0c6421bad2a9db38b02825042649a1cd3c20a48c2c5fb119eb8dfbfe36ba32115d1b387023a5b6
|
||||
SHA512 (nmstate.gpg) = 8c0188d64660757030772096b3e836f354dbf1f3591bebd1b588aa8abef9c2e37996904e6edb8ee8797afb57237f29dd942a2ceffd24dac50af9e898c0b48c97
|
||||
SHA512 (nmstate.gpg) = bfbf3620045f3c1f15eaf6877fd7407834a75d2650976f2327abd02ddb910aa34500f07a774dd17023c43dcba42a0ffc66f23cd6816fd9694acad2c5eed9e8d3
|
||||
SHA512 (nmstate-vendor-2.2.12.tar.xz) = 2dfae50d1ea44896570cd778615c165f0345e74f7ed07128364b82396db630a8811d9fd034f4d632bcafdb64b09345e35c5f3ecb48c997946a716a2c4498f0fe
|
||||
|
Loading…
Reference in New Issue
Block a user