From ee7a5611c932d7c9252349421c39adec2195223a Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Fri, 15 Mar 2024 17:50:31 +0000 Subject: [PATCH] Call hostapd function to set pairwise ciphers. --- src/common/service/NetRemoteService.cxx | 3 +-- src/linux/wifi/core/AccessPointControllerLinux.cxx | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/service/NetRemoteService.cxx b/src/common/service/NetRemoteService.cxx index 0317b143..79145a2f 100644 --- a/src/common/service/NetRemoteService.cxx +++ b/src/common/service/NetRemoteService.cxx @@ -723,8 +723,7 @@ NetRemoteService::WifiAccessPointSetPairwiseCipherSuitesImpl(std::string_view ac } // Set the cipher suites. - operationStatus.Code = AccessPointOperationStatusCode::OperationNotSupported; - // TODO: operationStatus = accessPointController->SetCipherSuites(std::move(ieee80211CipherSuites)); + operationStatus = accessPointController->SetPairwiseCipherSuites(std::move(ieee80211CipherSuites)); if (!operationStatus.Succeeded()) { wifiOperationStatus.set_code(ToDot11AccessPointOperationStatusCode(operationStatus.Code)); wifiOperationStatus.set_message(std::format("Failed to set cipher suites for access point {} - {}", accessPointId, operationStatus.ToString())); diff --git a/src/linux/wifi/core/AccessPointControllerLinux.cxx b/src/linux/wifi/core/AccessPointControllerLinux.cxx index 1f2f5933..b40e0b45 100644 --- a/src/linux/wifi/core/AccessPointControllerLinux.cxx +++ b/src/linux/wifi/core/AccessPointControllerLinux.cxx @@ -281,7 +281,7 @@ AccessPointControllerLinux::SetAuthenticationAlgorithms(std::vector> pairwiseCipherSuites) noexcept +AccessPointControllerLinux::SetPairwiseCipherSuites(std::unordered_map> pairwiseCipherSuites) noexcept { AccessPointOperationStatus status{ GetInterfaceName() }; const AccessPointOperationStatusLogOnExit logStatusOnExit(&status); @@ -295,7 +295,13 @@ AccessPointControllerLinux::SetPairwiseCipherSuites([[maybe_unused]] std::unorde auto pairwiseCipherSuitesHostapd = Ieee80211CipherSuitesToWpaCipherSuites(pairwiseCipherSuites); - // TODO + try { + m_hostapd.SetPairwiseCipherSuites(pairwiseCipherSuitesHostapd, EnforceConfigurationChange::Now); + } catch (const Wpa::HostapdException& e) { + status.Code = AccessPointOperationStatusCode::InternalError; + status.Details = std::format("failed to set pairwise cipher suites - {}", e.what()); + return status; + } status.Code = AccessPointOperationStatusCode::Succeeded; return status;