P2P: Notify the IP address of the connected P2P Client
When wpa_supplicant assigns the IP address (WFA EAPOL IP address allocation feature), the assigned IP address of the P2P Client on the GO side is notified in the AP-STA-CONNECTED event. So to obtain the IP info to external programs, modify the STA authorized event to include the the assigned IP address of the P2P Client. Test: Establish P2P connection and verified from the logs that the P2P Client IP address is notified. Signed-off-by: Sunil Ravi <sunilravi@google.com>
This commit is contained in:
parent
b18d957593
commit
dbcf9ff156
5 changed files with 17 additions and 11 deletions
|
@ -293,7 +293,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);
|
||||
|
|
|
@ -1433,6 +1433,7 @@ void ap_sta_set_authorized_event(struct hostapd_data *hapd,
|
|||
u8 addr[ETH_ALEN];
|
||||
u8 ip_addr_buf[4];
|
||||
#endif /* CONFIG_P2P */
|
||||
const u8 *ip_ptr = NULL;
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
if (hapd->p2p_group == NULL) {
|
||||
|
@ -1449,10 +1450,6 @@ void ap_sta_set_authorized_event(struct hostapd_data *hapd,
|
|||
#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;
|
||||
|
@ -1469,6 +1466,7 @@ void ap_sta_set_authorized_event(struct hostapd_data *hapd,
|
|||
" 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 */
|
||||
|
||||
|
@ -1508,6 +1506,11 @@ void ap_sta_set_authorized_event(struct hostapd_data *hapd,
|
|||
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)
|
||||
|
|
|
@ -868,9 +868,10 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -776,7 +776,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);
|
||||
|
@ -820,10 +820,11 @@ 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);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,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 *dev_addr, int new_device);
|
||||
|
|
Loading…
Reference in a new issue