Merge "[wpa_supplicant] Cumulative patch from commit 09a281e52"
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 5af8978..91a0a7e 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -1027,7 +1027,7 @@
iface_hapd->setup_complete_cb_ctx = iface_hapd;
iface_hapd->sta_authorized_cb = onAsyncStaAuthorizedCb;
iface_hapd->sta_authorized_cb_ctx = iface_hapd;
- wpa_msg_register_cb(onAsyncWpaEventCb);
+ wpa_msg_register_aidl_cb(onAsyncWpaEventCb);
if (hostapd_enable_iface(iface_hapd->iface) < 0) {
wpa_printf(
diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index a338a20..9875b0e 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -621,12 +621,17 @@
#ifndef CONFIG_NO_WPA_MSG
static wpa_msg_cb_func wpa_msg_cb = NULL;
+static wpa_msg_cb_func wpa_msg_aidl_cb = NULL;
void wpa_msg_register_cb(wpa_msg_cb_func func)
{
wpa_msg_cb = func;
}
+void wpa_msg_register_aidl_cb(wpa_msg_cb_func func)
+{
+ wpa_msg_aidl_cb = func;
+}
static wpa_msg_get_ifname_func wpa_msg_ifname_cb = NULL;
@@ -670,6 +675,8 @@
wpa_printf(level, "%s%s", prefix, buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
bin_clear_free(buf, buflen);
}
@@ -681,7 +688,7 @@
int buflen;
int len;
- if (!wpa_msg_cb)
+ if (!wpa_msg_cb && !wpa_msg_aidl_cb)
return;
va_start(ap, fmt);
@@ -697,7 +704,10 @@
va_start(ap, fmt);
len = vsnprintf(buf, buflen, fmt, ap);
va_end(ap);
- wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
+ if (wpa_msg_cb)
+ wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
bin_clear_free(buf, buflen);
}
@@ -725,6 +735,8 @@
wpa_printf(level, "%s", buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
bin_clear_free(buf, buflen);
}
@@ -736,7 +748,7 @@
int buflen;
int len;
- if (!wpa_msg_cb)
+ if (!wpa_msg_cb && !wpa_msg_aidl_cb)
return;
va_start(ap, fmt);
@@ -752,7 +764,10 @@
va_start(ap, fmt);
len = vsnprintf(buf, buflen, fmt, ap);
va_end(ap);
- wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
+ if (wpa_msg_cb)
+ wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
bin_clear_free(buf, buflen);
}
@@ -780,6 +795,9 @@
wpa_printf(level, "%s", buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, WPA_MSG_NO_GLOBAL, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_NO_GLOBAL, buf, len);
+
bin_clear_free(buf, buflen);
}
@@ -807,6 +825,8 @@
wpa_printf(level, "%s", buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, WPA_MSG_ONLY_GLOBAL, buf, len);
+ if (wpa_msg_aidl_cb)
+ wpa_msg_aidl_cb(ctx, level, WPA_MSG_ONLY_GLOBAL, buf, len);
os_free(buf);
}
diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h
index c6d5cc6..29fc48a 100644
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -167,6 +167,7 @@
#define wpa_msg_no_global(args...) do { } while (0)
#define wpa_msg_global_only(args...) do { } while (0)
#define wpa_msg_register_cb(f) do { } while (0)
+#define wpa_msg_register_aidl_cb(f) do { } while (0)
#define wpa_msg_register_ifname_cb(f) do { } while (0)
#else /* CONFIG_NO_WPA_MSG */
/**
@@ -274,7 +275,7 @@
* @func: Callback function (%NULL to unregister)
*/
void wpa_msg_register_cb(wpa_msg_cb_func func);
-
+void wpa_msg_register_aidl_cb(wpa_msg_cb_func func);
typedef const char * (*wpa_msg_get_ifname_func)(void *ctx);
void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func);
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index 06c4545..105fb8e 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -2018,11 +2018,16 @@
if (enable) {
wpa_s->conf->p2p_device_random_mac_addr = 1;
wpa_s->conf->p2p_interface_random_mac_addr = 1;
+ int status = wpas_p2p_mac_setup(wpa_s);
// restore config if it failed to set up MAC address.
- if (wpas_p2p_mac_setup(wpa_s) < 0) {
+ if (status < 0) {
wpa_s->conf->p2p_device_random_mac_addr = 0;
wpa_s->conf->p2p_interface_random_mac_addr = 0;
+ if (status == -ENOTSUP) {
+ return createStatusWithMsg(SupplicantStatusCode::FAILURE_UNSUPPORTED,
+ "Failed to set up MAC address, feature not supported.");
+ }
return createStatusWithMsg(SupplicantStatusCode::FAILURE_UNKNOWN,
"Failed to set up MAC address.");
}
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 4be0718..0e0937e 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1386,26 +1386,13 @@
is_6ghz_supported(wpa_s)) {
int i;
- /* Exclude 5 GHz channels from the full scan for P2P connection
+ /* Exclude 6 GHz channels from the full scan for P2P connection
* since the 6 GHz band is disabled for P2P uses. */
wpa_printf(MSG_DEBUG,
"P2P: 6 GHz disabled - update the scan frequency list");
- for (i = 0; i < wpa_s->hw.num_modes; i++) {
- if (wpa_s->hw.modes[i].num_channels == 0)
- continue;
- if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211G)
- wpa_add_scan_freqs_list(
- wpa_s, HOSTAPD_MODE_IEEE80211G,
- ¶ms, false);
- if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A)
- wpa_add_scan_freqs_list(
- wpa_s, HOSTAPD_MODE_IEEE80211A,
- ¶ms, false);
- if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211AD)
- wpa_add_scan_freqs_list(
- wpa_s, HOSTAPD_MODE_IEEE80211AD,
- ¶ms, false);
- }
+ wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, ¶ms, false);
+ wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, ¶ms, false);
+ wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211AD, ¶ms, false);
}
#endif /* CONFIG_P2P */