diff --git a/internal/platform/implementation/linux/wifi_medium.cc b/internal/platform/implementation/linux/wifi_medium.cc index cc7d734c..4309404f 100644 --- a/internal/platform/implementation/linux/wifi_medium.cc +++ b/internal/platform/implementation/linux/wifi_medium.cc @@ -207,14 +207,14 @@ NetworkManagerWifiMedium::SearchBySSID(absl::string_view ssid, return ap; } -static inline std::pair AuthAlgAndKeyMgmt( - api::WifiAuthType auth_type) { +static inline std::pair, std::string> +AuthAlgAndKeyMgmt(api::WifiAuthType auth_type) { switch (auth_type) { case api::WifiAuthType::kUnknown: case api::WifiAuthType::kOpen: return {"open", "none"}; case api::WifiAuthType::kWpaPsk: - return {"shared", "wpa-psk"}; + return {std::nullopt, "wpa-psk"}; case api::WifiAuthType::kWep: return {"none", "wep"}; } @@ -267,12 +267,14 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork( {"assigned-mac-address", "random"}, }}, {"802-11-wireless-security", - std::map{{"auth-alg", auth_alg}, - {"key-mgmt", key_mgmt}}}}; + std::map{{"key-mgmt", key_mgmt}}}}; if (!password.empty()) { connection_settings["802-11-wireless-security"]["psk"] = std::string(password); } + if (auth_alg.has_value()) { + connection_settings["802-11-wireless-security"]["auth-alg"] = *auth_alg; + } sdbus::ObjectPath connection_path, active_conn_path; try { @@ -310,6 +312,7 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork( return api::WifiConnectionStatus::kAuthFailure; } + NEARBY_LOGS(INFO) << __func__ << ": Activated connection " << connection_path; return api::WifiConnectionStatus::kConnected; }