Notify the IP address of connected client
When the wpa_supplicant assigns the IP address
(WFA EAPOL IP address allocation feature),
the assigned IP address of the client on the GO side
is notified in the AP-STA-CONNECTED event.
So to obtain the IP info to framework , modified the
AIDL SupplicantP2pIfaceCallback#onStaAuthorized to
include group interface name and the assigned IP of client.
Bug: 291202830
Test: Establish P2P connection and verified from the logs that
the P2P Client IP address is received to framework via new
HAL API.
Change-Id: I5f9f9362d5942c9c29d5dbc020eb93ba7a69ba1a
diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp
index f221862..a6bf4a1 100644
--- a/wpa_supplicant/aidl/aidl.cpp
+++ b/wpa_supplicant/aidl/aidl.cpp
@@ -652,7 +652,8 @@
}
void wpas_aidl_notify_ap_sta_authorized(
- struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr)
+ struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr,
+ const u8 *ip)
{
if (!wpa_s || !sta)
return;
@@ -666,7 +667,7 @@
if (!aidl_manager)
return;
- aidl_manager->notifyApStaAuthorized(wpa_s, sta, p2p_dev_addr);
+ aidl_manager->notifyApStaAuthorized(wpa_s, sta, p2p_dev_addr, ip);
}
void wpas_aidl_notify_ap_sta_deauthorized(
diff --git a/wpa_supplicant/aidl/aidl.h b/wpa_supplicant/aidl/aidl.h
index dfe5c74..1638cf9 100644
--- a/wpa_supplicant/aidl/aidl.h
+++ b/wpa_supplicant/aidl/aidl.h
@@ -101,7 +101,7 @@
const u8 *tlvs, size_t tlvs_len);
void wpas_aidl_notify_ap_sta_authorized(
struct wpa_supplicant *wpa_s, const u8 *sta,
- const u8 *p2p_dev_addr);
+ const u8 *p2p_dev_addr, const u8 *ip);
void wpas_aidl_notify_ap_sta_deauthorized(
struct wpa_supplicant *wpa_s, const u8 *sta,
const u8 *p2p_dev_addr);
@@ -260,7 +260,8 @@
const u8 *tlvs, size_t tlvs_len)
{}
static void wpas_aidl_notify_ap_sta_authorized(
- struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr)
+ struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr,
+ const u8 *ip)
{}
static void wpas_aidl_notify_ap_sta_deauthorized(
struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr)
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index b3baf5b..add0ef7 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1603,19 +1603,30 @@
}
void AidlManager::notifyApStaAuthorized(
- struct wpa_supplicant *wpa_group_s, const u8 *sta, const u8 *p2p_dev_addr)
+ struct wpa_supplicant *wpa_group_s, const u8 *sta, const u8 *p2p_dev_addr,
+ const u8 *ip)
{
if (!wpa_group_s || !wpa_group_s->parent || !sta)
return;
wpa_supplicant *wpa_s = getTargetP2pIfaceForGroup(wpa_group_s);
if (!wpa_s)
return;
+
+ int aidl_ip = 0;
+ if (NULL != ip) {
+ os_memcpy(&aidl_ip, &ip[0], 4);
+ }
+
+ P2pPeerClientJoinedEventParams params;
+ params.groupInterfaceName = misc_utils::charBufToString(wpa_group_s->ifname);
+ params.clientInterfaceAddress = macAddrToArray(sta);
+ params.clientDeviceAddress = macAddrToArray(p2p_dev_addr);
+ params.clientIpAddress = aidl_ip;
callWithEachP2pIfaceCallback(
misc_utils::charBufToString(wpa_s->ifname),
std::bind(
- &ISupplicantP2pIfaceCallback::onStaAuthorized,
- std::placeholders::_1, macAddrToVec(sta),
- p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid));
+ &ISupplicantP2pIfaceCallback::onPeerClientJoined,
+ std::placeholders::_1, params));
}
void AidlManager::notifyApStaDeauthorized(
@@ -1627,12 +1638,15 @@
if (!wpa_s)
return;
+ P2pPeerClientDisconnectedEventParams params;
+ params.groupInterfaceName = misc_utils::charBufToString(wpa_group_s->ifname);
+ params.clientInterfaceAddress = macAddrToArray(sta);
+ params.clientDeviceAddress = macAddrToArray(p2p_dev_addr);
callWithEachP2pIfaceCallback(
misc_utils::charBufToString(wpa_s->ifname),
std::bind(
- &ISupplicantP2pIfaceCallback::onStaDeauthorized,
- std::placeholders::_1, macAddrToVec(sta),
- p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid));
+ &ISupplicantP2pIfaceCallback::onPeerClientDisconnected,
+ std::placeholders::_1, params));
}
void AidlManager::notifyExtRadioWorkStart(
diff --git a/wpa_supplicant/aidl/aidl_manager.h b/wpa_supplicant/aidl/aidl_manager.h
index 8f1f177..b237922 100644
--- a/wpa_supplicant/aidl/aidl_manager.h
+++ b/wpa_supplicant/aidl/aidl_manager.h
@@ -122,7 +122,7 @@
const u8 *tlvs, size_t tlvs_len);
void notifyApStaAuthorized(
struct wpa_supplicant *wpa_s, const u8 *sta,
- const u8 *p2p_dev_addr);
+ const u8 *p2p_dev_addr, const u8 *ip);
void notifyApStaDeauthorized(
struct wpa_supplicant *wpa_s, const u8 *sta,
const u8 *p2p_dev_addr);
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 9a2598b..62d2e90 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -856,9 +856,9 @@
static void ap_sta_authorized_cb(void *ctx, const u8 *mac_addr,
- int authorized, const u8 *p2p_dev_addr)
+ int authorized, const u8 *p2p_dev_addr, const u8 *ip)
{
- wpas_notify_sta_authorized(ctx, mac_addr, authorized, p2p_dev_addr);
+ wpas_notify_sta_authorized(ctx, mac_addr, authorized, p2p_dev_addr, ip);
}
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index c6e2dbe..c528ea5 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -863,7 +863,7 @@
static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *sta,
- const u8 *p2p_dev_addr)
+ const u8 *p2p_dev_addr, const u8 *ip)
{
#ifdef CONFIG_P2P
wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
@@ -882,7 +882,7 @@
/* Notify listeners a new station has been authorized */
wpas_dbus_signal_sta_authorized(wpa_s, sta);
- wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
+ wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr, ip);
}
@@ -902,7 +902,7 @@
/* Notify listeners a station has been deauthorized */
wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
- wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
+ wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
/* Unregister the station */
wpas_dbus_unregister_sta(wpa_s, sta);
}
@@ -910,10 +910,10 @@
void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *mac_addr, int authorized,
- const u8 *p2p_dev_addr)
+ const u8 *p2p_dev_addr, const u8 *ip)
{
if (authorized)
- wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
+ wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr, ip);
else
wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
}
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index c41aa6e..52db6e9 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -100,7 +100,7 @@
void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *mac_addr, int authorized,
- const u8 *p2p_dev_addr);
+ const u8 *p2p_dev_addr, const u8 *ip);
void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s);
void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
const u8 *addr, const struct p2p_peer_info *info,