p2p: return FAILURE_ARGS_INVALID if MAC randomization is not supported
Bug: 135247522
Test: atest VtsHalWifiSupplicantP2pV1_2TargetTest
Change-Id: I7b2875a2eab33c85859f80774c7946011ce5c947
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
index 7dddee9..ada7ee6 100644
--- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
@@ -1750,6 +1750,14 @@
bool currentEnabledState = !!wpa_s->conf->p2p_device_random_mac_addr;
u8 *addr = NULL;
+ // A dedicated p2p device is not managed by supplicant,
+ // supplicant could not change its MAC address.
+ if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) {
+ wpa_printf(MSG_ERROR,
+ "Dedicated P2P device don't support MAC randomization");
+ return {SupplicantStatusCode::FAILURE_ARGS_INVALID, "NotSupported"};
+ }
+
// The same state, no change is needed.
if (currentEnabledState == enable) {
wpa_printf(MSG_DEBUG, "The random MAC is %s already.",