Skip to content

Commit

Permalink
Enable scan-ssid wireless network property for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jcronenberg committed Jan 30, 2024
1 parent ad396ec commit 5f7e26f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions rust/migrate-wicked/src/wireless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub struct Wireless {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct Network {
pub essid: String,
// #[serde(rename = "scan-ssid")]
// pub scan_ssid: bool,
#[serde(rename = "scan-ssid")]
pub scan_ssid: bool,
pub mode: WickedWirelessMode,
#[serde(rename = "wpa-psk")]
pub wpa_psk: Option<WpaPsk>,
Expand Down Expand Up @@ -114,6 +114,7 @@ impl TryFrom<&Network> for model::ConnectionConfig {
let settings = MIGRATION_SETTINGS.get().unwrap();
let mut config = model::WirelessConfig {
ssid: SSID(network.essid.as_bytes().to_vec()),
hidden: network.scan_ssid,
..Default::default()
};

Expand Down Expand Up @@ -194,6 +195,7 @@ mod tests {
networks: Some(vec![Network {
channel: Some(0),
essid: "testssid".to_string(),
scan_ssid: false,
mode: WickedWirelessMode::AP,
wpa_psk: None,
key_management: vec!["wpa-psk".to_string()],
Expand Down Expand Up @@ -235,6 +237,7 @@ mod tests {
wireless: Some(Wireless {
networks: Some(vec![Network {
essid: "testssid".to_string(),
scan_ssid: true,
mode: WickedWirelessMode::Infrastructure,
wpa_psk: Some(WpaPsk {
passphrase: "testpassword".to_string(),
Expand All @@ -259,6 +262,7 @@ mod tests {
panic!()
};
assert_eq!(wireless.ssid, SSID("testssid".as_bytes().to_vec()));
assert!(wireless.hidden);
assert_eq!(wireless.mode, model::WirelessMode::Infra);
assert_eq!(wireless.password, Some("testpassword".to_string()));
assert_eq!(wireless.security, model::SecurityProtocol::WPA2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface-name=wlan0
band=a
bssid=12:34:56:78:9A:BC
channel=100
hidden=true
mode=adhoc
ssid=example_ssid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type=wifi
interface-name=wlan0

[wifi]
hidden=true
mode=adhoc
ssid=example_ssid2

Expand Down
2 changes: 1 addition & 1 deletion rust/migrate-wicked/tests/wireless/wicked_xml/wireless.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<networks>
<network>
<essid>test</essid>
<scan-ssid>true</scan-ssid>
<scan-ssid>false</scan-ssid>
<mode>infrastructure</mode>
<access-point>12:34:56:78:9a:bc</access-point>
<key-management>none</key-management>
Expand Down

0 comments on commit 5f7e26f

Please sign in to comment.