From 80f29a72dbaaa70cc510441bf3d23ca432575e99 Mon Sep 17 00:00:00 2001 From: Jorik Cronenberg Date: Mon, 29 Jan 2024 16:27:57 +0100 Subject: [PATCH 1/2] Add wireless hidden property to network model --- rust/agama-dbus-server/src/network/model.rs | 1 + rust/agama-dbus-server/src/network/nm/dbus.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/rust/agama-dbus-server/src/network/model.rs b/rust/agama-dbus-server/src/network/model.rs index 67fbbb2484..98de6914fc 100644 --- a/rust/agama-dbus-server/src/network/model.rs +++ b/rust/agama-dbus-server/src/network/model.rs @@ -744,6 +744,7 @@ pub struct WirelessConfig { pub channel: Option, pub bssid: Option, pub wep_security: Option, + pub hidden: bool, } impl TryFrom for WirelessConfig { diff --git a/rust/agama-dbus-server/src/network/nm/dbus.rs b/rust/agama-dbus-server/src/network/nm/dbus.rs index 9d0655f54d..e0d68be160 100644 --- a/rust/agama-dbus-server/src/network/nm/dbus.rs +++ b/rust/agama-dbus-server/src/network/nm/dbus.rs @@ -326,6 +326,7 @@ fn wireless_config_to_dbus<'a>( ("mode", Value::new(config.mode.to_string())), ("ssid", Value::new(config.ssid.to_vec())), ("assigned-mac-address", Value::new(mac_address.to_string())), + ("hidden", Value::new(config.hidden)), ]); if let Some(band) = &config.band { @@ -726,6 +727,9 @@ fn wireless_config_from_dbus(conn: &OwnedNestedHash) -> Option { *bssid.get(5)?, )); } + if let Some(hidden) = wireless.get("hidden") { + wireless_config.hidden = *hidden.downcast_ref::()?; + } if let Some(security) = conn.get(WIRELESS_SECURITY_KEY) { let key_mgmt: &str = security.get("key-mgmt")?.downcast_ref()?; @@ -1001,6 +1005,7 @@ mod test { "bssid".to_string(), Value::new(vec![18_u8, 52_u8, 86_u8, 120_u8, 154_u8, 188_u8]).to_owned(), ), + ("hidden".to_string(), Value::new(false).to_owned()), ]); let security_section = HashMap::from([ @@ -1032,6 +1037,7 @@ mod test { wireless.bssid, Some(macaddr::MacAddr6::from_str("12:34:56:78:9A:BC").unwrap()) ); + assert!(!wireless.hidden); let wep_security = wireless.wep_security.as_ref().unwrap(); assert_eq!(wep_security.wep_key_type, WEPKeyType::Key); assert_eq!(wep_security.auth_alg, WEPAuthAlg::Open); @@ -1082,6 +1088,7 @@ mod test { "hello".to_string(), ], }), + hidden: true, ..Default::default() }; let mut wireless = build_base_connection(); @@ -1120,6 +1127,9 @@ mod test { .collect(); assert_eq!(bssid, vec![18, 52, 86, 120, 154, 188]); + let hidden: bool = *wireless.get("hidden").unwrap().downcast_ref().unwrap(); + assert!(hidden); + let security = wireless_dbus.get(WIRELESS_SECURITY_KEY).unwrap(); let key_mgmt: &str = security.get("key-mgmt").unwrap().downcast_ref().unwrap(); assert_eq!(key_mgmt, "wpa-psk"); From 97841f4d63ecbf2df2c9dab8b8c371d1317cbe66 Mon Sep 17 00:00:00 2001 From: Jorik Cronenberg Date: Mon, 29 Jan 2024 16:44:16 +0100 Subject: [PATCH 2/2] Update agama-cli.changes --- rust/package/agama-cli.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/package/agama-cli.changes b/rust/package/agama-cli.changes index 1a2521ca72..d4e1f812b8 100644 --- a/rust/package/agama-cli.changes +++ b/rust/package/agama-cli.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jan 29 15:37:56 UTC 2024 - Jorik Cronenberg + +- Add hidden property for wireless in network model + (gh#openSUSE/agama#1024). + ------------------------------------------------------------------- Mon Jan 29 10:22:49 UTC 2024 - Jorik Cronenberg