Merge changes from topic "update_mac_addr_netdev_state_change"
* changes:
Fix for SAE connection failure due to SAE frame drop
Revert "Add update of mac address to supplicant"
Revert "Fix defining FEATURE_UPDATE_STA_MAC_ADDR"
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 2d33810..eb7c392 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5970,8 +5970,31 @@
} else {
if (os_get_random((u8 *) &r, sizeof(r)) < 0)
return -1;
- freq = 5180 + (r % 4) * 20;
- if (!p2p_supported_freq_go(wpa_s->global->p2p, freq)) {
+
+ /*
+ * most of 5G channels are DFS, only operating class 115 and 124
+ * are available possibly, randomly pick a start to check them.
+ */
+ int possible_5g_freqs[] = {
+ /* operating class 115 */
+ 5180, 5200, 5220, 5240,
+ /* operating class 124 */
+ 5745, 5765, 5785, 5805,
+ };
+ int possible_5g_freqs_num =
+ sizeof(possible_5g_freqs)/sizeof(possible_5g_freqs[0]);
+
+ int i;
+ for (i = 0; i < possible_5g_freqs_num; i++, r++) {
+ if (p2p_supported_freq_go(
+ wpa_s->global->p2p,
+ possible_5g_freqs[r % possible_5g_freqs_num])) {
+ freq = possible_5g_freqs[r % possible_5g_freqs_num];
+ break;
+ }
+ }
+
+ if (i >= possible_5g_freqs_num) {
wpa_printf(MSG_DEBUG, "P2P: Could not select "
"5 GHz channel for P2P group");
return -1;