aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-05-12 10:08:23 -0700
committerRoshan Pius <rpius@google.com>2017-05-12 10:11:02 -0700
commita336364feab03acce35fb512810add0e2d7389b8 (patch)
tree2f7170bdb1dd8b1c614d557186cf58b0ad2c95c1
parente9f688243cb408e68f3e60f827cf66deacf8e985 (diff)
downloadwpa_supplicant_8-a336364feab03acce35fb512810add0e2d7389b8.tar.gz
wpa_supplicant(hidl): Reset disallowed frequencies
setDisallowedFrequencies should reset existing disallowed frequencies configured, if the incoming |ranges| is empty. Bug: 38246261 Test: Manual tests. Change-Id: Id5060634ab710b0398b5abf0865da88aaa975708
-rw-r--r--wpa_supplicant/hidl/p2p_iface.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/wpa_supplicant/hidl/p2p_iface.cpp b/wpa_supplicant/hidl/p2p_iface.cpp
index 195c6b95..1dddb340 100644
--- a/wpa_supplicant/hidl/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/p2p_iface.cpp
@@ -856,21 +856,22 @@ SupplicantStatus P2pIface::setListenChannelInternal(
SupplicantStatus P2pIface::setDisallowedFrequenciesInternal(
const std::vector<FreqRange>& ranges)
{
- if (ranges.size() == 0) {
- return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
- }
struct wpa_supplicant* wpa_s = retrieveIfacePtr();
using DestT = struct wpa_freq_range_list::wpa_freq_range;
- DestT* freq_ranges =
- static_cast<DestT*>(os_malloc(sizeof(DestT) * ranges.size()));
- if (!freq_ranges) {
- return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
- }
- uint32_t i = 0;
- for (const auto& range : ranges) {
- freq_ranges[i].min = range.min;
- freq_ranges[i].max = range.max;
- i++;
+ DestT* freq_ranges = nullptr;
+ // Empty ranges is used to enable all frequencies.
+ if (ranges.size() != 0) {
+ freq_ranges =
+ static_cast<DestT*>(os_malloc(sizeof(DestT) * ranges.size()));
+ if (!freq_ranges) {
+ return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
+ }
+ uint32_t i = 0;
+ for (const auto& range : ranges) {
+ freq_ranges[i].min = range.min;
+ freq_ranges[i].max = range.max;
+ i++;
+ }
}
os_free(wpa_s->global->p2p_disallow_freq.range);