From f3017d7e8dfd739bab466c79acfb784ca4cc012a Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Fri, 12 May 2017 17:32:07 -0700 Subject: P2P: Fix hidl service discovery request Check if the provided destination address is zero'd, and make it null. Supplicant was treating the zero address as a real address, and not broadcasting the service discovery request to devices. Bug: 38174469 Test: CTS Verifier service discovery requester Change-Id: Ifa9841e2c87f3e4e6f5201480fbf248cb0f97680 --- wpa_supplicant/hidl/1.0/p2p_iface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/hidl/1.0/p2p_iface.cpp b/wpa_supplicant/hidl/1.0/p2p_iface.cpp index 252266ba..1a63b2fb 100644 --- a/wpa_supplicant/hidl/1.0/p2p_iface.cpp +++ b/wpa_supplicant/hidl/1.0/p2p_iface.cpp @@ -985,8 +985,11 @@ std::pair P2pIface::requestServiceDiscoveryInternal( if (!query_buf) { return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}}; } + const uint8_t* dst_addr = is_zero_ether_addr(peer_address.data()) + ? nullptr + : peer_address.data(); uint64_t identifier = - wpas_p2p_sd_request(wpa_s, peer_address.data(), query_buf.get()); + wpas_p2p_sd_request(wpa_s, dst_addr, query_buf.get()); if (identifier == 0) { return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}}; } -- cgit v1.2.3 From 97a14f58e0e308f835e90b0d058a22b69041fa45 Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Thu, 18 May 2017 14:17:47 -0700 Subject: P2P: Fix HAL connect pin & go_intent params The HAL implementation code for the p2p iface was incorrectly passing down non-null pins and non-negative go_intent values when it should be. This unbreaks the CtsVerifier Group Join PIN test, and restores partial functionality to reinvoke. Bug: 38120750 Bug: 37715629 Test: CtsVerifier WifiDirect tests Change-Id: I380bd055b4b0c7cb3711b215bb44cacdb48ba58d --- wpa_supplicant/hidl/1.0/p2p_iface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/hidl/1.0/p2p_iface.cpp b/wpa_supplicant/hidl/1.0/p2p_iface.cpp index 252266ba..40b4b9cd 100644 --- a/wpa_supplicant/hidl/1.0/p2p_iface.cpp +++ b/wpa_supplicant/hidl/1.0/p2p_iface.cpp @@ -682,6 +682,7 @@ std::pair P2pIface::connectInternal( if (go_intent > 15) { return {{SupplicantStatusCode::FAILURE_ARGS_INVALID, ""}, {}}; } + int go_intent_signed = join_existing_group ? -1 : go_intent; p2p_wps_method wps_method = {}; switch (provision_method) { case WpsProvisionMethod::PBC: @@ -694,9 +695,10 @@ std::pair P2pIface::connectInternal( wps_method = WPS_PIN_KEYPAD; break; } + const char* pin = pre_selected_pin.length() > 0 ? pre_selected_pin.data() : nullptr; int new_pin = wpas_p2p_connect( - wpa_s, peer_address.data(), pre_selected_pin.data(), wps_method, - persistent, false, join_existing_group, false, go_intent, 0, 0, -1, + wpa_s, peer_address.data(), pin, wps_method, + persistent, false, join_existing_group, false, go_intent_signed, 0, 0, -1, false, false, false, VHT_CHANWIDTH_USE_HT, nullptr, 0); if (new_pin < 0) { return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}}; -- cgit v1.2.3