aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Ravi <sunilravi@google.com>2023-11-10 21:24:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-11-10 21:24:27 +0000
commit76da14cd1b7bdf6ad88678b769b5b0824308591c (patch)
treea9b8e033e441c54d27f368a47f0b8fbc030a57fa
parent65fcf4ef83f48f378a87242145f9b04d9cb8a393 (diff)
parentd8128a2963d2aa60cb33762a793226e3e0d9eb52 (diff)
downloadwpa_supplicant_8-76da14cd1b7bdf6ad88678b769b5b0824308591c.tar.gz
Merge changes from topic "Supplicant_AIDL_interface_V3" into main
* changes: Notify the IP address of connected client Update supplicant service to use supplicant AIDL V3 interface.
-rw-r--r--hostapd/aidl/hostapd.cpp2
-rw-r--r--src/ap/hostapd.h3
-rw-r--r--src/ap/sta_info.c11
-rw-r--r--wpa_supplicant/Android.bp4
-rw-r--r--wpa_supplicant/Android.mk4
-rw-r--r--wpa_supplicant/aidl/Android.bp2
-rw-r--r--wpa_supplicant/aidl/aidl.cpp5
-rw-r--r--wpa_supplicant/aidl/aidl.h5
-rw-r--r--wpa_supplicant/aidl/aidl_manager.cpp28
-rw-r--r--wpa_supplicant/aidl/aidl_manager.h2
-rw-r--r--wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml2
-rw-r--r--wpa_supplicant/ap.c4
-rw-r--r--wpa_supplicant/notify.c10
-rw-r--r--wpa_supplicant/notify.h2
14 files changed, 52 insertions, 32 deletions
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index a0365404..ed77a823 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -788,7 +788,7 @@ void onAsyncSetupCompleteCb(void* ctx)
std::function<void(struct hostapd_data*, const u8 *mac_addr, int authorized,
const u8 *p2p_dev_addr)> on_sta_authorized_internal_callback;
void onAsyncStaAuthorizedCb(void* ctx, const u8 *mac_addr, int authorized,
- const u8 *p2p_dev_addr)
+ const u8 *p2p_dev_addr, const u8 *ip)
{
struct hostapd_data* iface_hapd = (struct hostapd_data*)ctx;
if (on_sta_authorized_internal_callback) {
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index b81da304..b9a67b9d 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -286,7 +286,8 @@ struct hostapd_data {
void *wps_event_cb_ctx;
void (*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);
void *sta_authorized_cb_ctx;
void (*setup_complete_cb)(void *ctx);
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 2fb6edf0..07100f24 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1279,6 +1279,7 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
u8 addr[ETH_ALEN];
u8 ip_addr_buf[4];
#endif /* CONFIG_P2P */
+ u8 *ip_ptr = NULL;
if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED))
return;
@@ -1305,10 +1306,6 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
#endif /* CONFIG_P2P */
os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
- if (hapd->sta_authorized_cb)
- hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
- sta->addr, authorized, dev_addr);
-
if (authorized) {
const u8 *dpp_pkhash;
const char *keyid;
@@ -1325,6 +1322,7 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
" ip_addr=%u.%u.%u.%u",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
+ ip_ptr = ip_addr_buf;
}
#endif /* CONFIG_P2P */
@@ -1364,6 +1362,11 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
AP_STA_DISCONNECTED "%s", buf);
}
+ if (hapd->sta_authorized_cb)
+ hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
+ sta->addr, authorized, dev_addr,
+ ip_ptr);
+
#ifdef CONFIG_FST
if (hapd->iface->fst) {
if (authorized)
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp
index 664c65cd..ca56d143 100644
--- a/wpa_supplicant/Android.bp
+++ b/wpa_supplicant/Android.bp
@@ -67,7 +67,7 @@ cc_defaults {
defaults: ["wpa_supplicant_cflags_defaults"],
srcs: [":wpa_supplicant_srcs"],
shared_libs: [
- "android.hardware.wifi.supplicant-V2-ndk",
+ "android.hardware.wifi.supplicant-V3-ndk",
"android.system.keystore2-V1-ndk",
"libbase",
"libbinder_ndk",
@@ -445,4 +445,4 @@ filegroup {
"wpa_supplicant.c",
"wps_supplicant.c",
],
-} \ No newline at end of file
+}
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index c3a7bc64..9f685220 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -1952,7 +1952,7 @@ ifeq ($(DBUS), y)
LOCAL_SHARED_LIBRARIES += libdbus
endif
ifeq ($(WPA_SUPPLICANT_USE_AIDL), y)
-LOCAL_SHARED_LIBRARIES += android.hardware.wifi.supplicant-V2-ndk
+LOCAL_SHARED_LIBRARIES += android.hardware.wifi.supplicant-V3-ndk
LOCAL_SHARED_LIBRARIES += android.system.keystore2-V1-ndk
LOCAL_SHARED_LIBRARIES += libutils libbase
LOCAL_SHARED_LIBRARIES += libbinder_ndk
@@ -2026,7 +2026,7 @@ LOCAL_SRC_FILES := \
aidl/sta_network.cpp \
aidl/supplicant.cpp
LOCAL_SHARED_LIBRARIES := \
- android.hardware.wifi.supplicant-V2-ndk \
+ android.hardware.wifi.supplicant-V3-ndk \
android.system.keystore2-V1-ndk \
libbinder_ndk \
libbase \
diff --git a/wpa_supplicant/aidl/Android.bp b/wpa_supplicant/aidl/Android.bp
index d7dcf972..481ad0b3 100644
--- a/wpa_supplicant/aidl/Android.bp
+++ b/wpa_supplicant/aidl/Android.bp
@@ -33,7 +33,7 @@ cc_library_static {
defaults: ["wpa_supplicant_cflags_defaults"],
soc_specific: true,
shared_libs: [
- "android.hardware.wifi.supplicant-V2-ndk",
+ "android.hardware.wifi.supplicant-V3-ndk",
"android.system.keystore2-V1-ndk",
"libbinder_ndk",
"libbase",
diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp
index f221862a..a6bf4a19 100644
--- a/wpa_supplicant/aidl/aidl.cpp
+++ b/wpa_supplicant/aidl/aidl.cpp
@@ -652,7 +652,8 @@ void wpas_aidl_notify_p2p_sd_response(
}
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 @@ void wpas_aidl_notify_ap_sta_authorized(
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 dfe5c745..1638cf9e 100644
--- a/wpa_supplicant/aidl/aidl.h
+++ b/wpa_supplicant/aidl/aidl.h
@@ -101,7 +101,7 @@ extern "C"
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 @@ static void wpas_aidl_notify_p2p_sd_response(
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 b3baf5b4..add0ef77 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1603,19 +1603,30 @@ void AidlManager::notifyP2pSdResponse(
}
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 @@ void AidlManager::notifyApStaDeauthorized(
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 8f1f1770..b237922c 100644
--- a/wpa_supplicant/aidl/aidl_manager.h
+++ b/wpa_supplicant/aidl/aidl_manager.h
@@ -122,7 +122,7 @@ public:
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/aidl/android.hardware.wifi.supplicant.xml b/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml
index b80daddf..37cc3af3 100644
--- a/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml
+++ b/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.wifi.supplicant</name>
- <version>2</version>
+ <version>3</version>
<fqname>ISupplicant/default</fqname>
</hal>
</manifest>
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 9a2598bd..62d2e901 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -856,9 +856,9 @@ static void ap_wps_event_cb(void *ctx, enum wps_event event,
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 c6e2dbe2..c528ea55 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -863,7 +863,7 @@ void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
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 @@ static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
/* 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 @@ static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
/* 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 @@ static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
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 c41aa6e1..52db6e94 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -100,7 +100,7 @@ void wpas_notify_resume(struct wpa_global *global);
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,