Use generic driver event notification for AP mode assoc/disassoc
This commit is contained in:
parent
a8e0505bf0
commit
1d041bec84
11 changed files with 148 additions and 71 deletions
|
@ -397,6 +397,19 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||||
data->eapol_rx.data,
|
data->eapol_rx.data,
|
||||||
data->eapol_rx.data_len);
|
data->eapol_rx.data_len);
|
||||||
break;
|
break;
|
||||||
|
case EVENT_ASSOC:
|
||||||
|
hostapd_notif_assoc(hapd, data->assoc_info.addr,
|
||||||
|
data->assoc_info.req_ies,
|
||||||
|
data->assoc_info.req_ies_len);
|
||||||
|
break;
|
||||||
|
case EVENT_DISASSOC:
|
||||||
|
if (data)
|
||||||
|
hostapd_notif_disassoc(hapd, data->disassoc_info.addr);
|
||||||
|
break;
|
||||||
|
case EVENT_DEAUTH:
|
||||||
|
if (data)
|
||||||
|
hostapd_notif_disassoc(hapd, data->deauth_info.addr);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
|
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -260,4 +260,9 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
|
||||||
void *ctx);
|
void *ctx);
|
||||||
void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
|
void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
|
||||||
|
|
||||||
|
/* drv_callbacks.c (TODO: move to somewhere else?) */
|
||||||
|
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
||||||
|
const u8 *ie, size_t ielen);
|
||||||
|
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
||||||
|
|
||||||
#endif /* HOSTAPD_H */
|
#endif /* HOSTAPD_H */
|
||||||
|
|
|
@ -1651,6 +1651,7 @@ enum wpa_event_type {
|
||||||
* sending either of these frames to the current AP. If the driver
|
* sending either of these frames to the current AP. If the driver
|
||||||
* supports separate deauthentication event, EVENT_DISASSOC should only
|
* supports separate deauthentication event, EVENT_DISASSOC should only
|
||||||
* be used for disassociation and EVENT_DEAUTH for deauthentication.
|
* be used for disassociation and EVENT_DEAUTH for deauthentication.
|
||||||
|
* In AP mode, union wpa_event_data::disassoc_info is required.
|
||||||
*/
|
*/
|
||||||
EVENT_DISASSOC,
|
EVENT_DISASSOC,
|
||||||
|
|
||||||
|
@ -1778,6 +1779,7 @@ enum wpa_event_type {
|
||||||
* This event should be called when authentication is lost either due
|
* This event should be called when authentication is lost either due
|
||||||
* to receiving deauthenticate frame from the AP or when sending that
|
* to receiving deauthenticate frame from the AP or when sending that
|
||||||
* frame to the current AP.
|
* frame to the current AP.
|
||||||
|
* In AP mode, union wpa_event_data::deauth_info is required.
|
||||||
*/
|
*/
|
||||||
EVENT_DEAUTH,
|
EVENT_DEAUTH,
|
||||||
|
|
||||||
|
@ -1920,7 +1922,7 @@ union wpa_event_data {
|
||||||
* This should start with the first IE (fixed fields before IEs
|
* This should start with the first IE (fixed fields before IEs
|
||||||
* are not included).
|
* are not included).
|
||||||
*/
|
*/
|
||||||
u8 *req_ies;
|
const u8 *req_ies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* req_ies_len - Length of req_ies in bytes
|
* req_ies_len - Length of req_ies in bytes
|
||||||
|
@ -1938,7 +1940,7 @@ union wpa_event_data {
|
||||||
* This should start with the first IE (fixed fields before IEs
|
* This should start with the first IE (fixed fields before IEs
|
||||||
* are not included).
|
* are not included).
|
||||||
*/
|
*/
|
||||||
u8 *resp_ies;
|
const u8 *resp_ies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resp_ies_len - Length of resp_ies in bytes
|
* resp_ies_len - Length of resp_ies in bytes
|
||||||
|
@ -1961,7 +1963,7 @@ union wpa_event_data {
|
||||||
* This should start with the first IE (fixed fields before IEs
|
* This should start with the first IE (fixed fields before IEs
|
||||||
* are not included).
|
* are not included).
|
||||||
*/
|
*/
|
||||||
u8 *beacon_ies;
|
const u8 *beacon_ies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beacon_ies_len - Length of beacon_ies */
|
* beacon_ies_len - Length of beacon_ies */
|
||||||
|
@ -1971,8 +1973,33 @@ union wpa_event_data {
|
||||||
* freq - Frequency of the operational channel in MHz
|
* freq - Frequency of the operational channel in MHz
|
||||||
*/
|
*/
|
||||||
unsigned int freq;
|
unsigned int freq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* addr - Station address (for AP mode)
|
||||||
|
*/
|
||||||
|
const u8 *addr;
|
||||||
} assoc_info;
|
} assoc_info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct disassoc_info - Data for EVENT_DISASSOC events
|
||||||
|
*/
|
||||||
|
struct disassoc_info {
|
||||||
|
/**
|
||||||
|
* addr - Station address (for AP mode)
|
||||||
|
*/
|
||||||
|
const u8 *addr;
|
||||||
|
} disassoc_info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct deauth_info - Data for EVENT_DEAUTH events
|
||||||
|
*/
|
||||||
|
struct deauth_info {
|
||||||
|
/**
|
||||||
|
* addr - Station address (for AP mode)
|
||||||
|
*/
|
||||||
|
const u8 *addr;
|
||||||
|
} deauth_info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
|
* struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
|
||||||
*/
|
*/
|
||||||
|
@ -2253,10 +2280,29 @@ int wpa_scan_get_max_rate(const struct wpa_scan_res *res);
|
||||||
void wpa_scan_results_free(struct wpa_scan_results *res);
|
void wpa_scan_results_free(struct wpa_scan_results *res);
|
||||||
void wpa_scan_sort_results(struct wpa_scan_results *res);
|
void wpa_scan_sort_results(struct wpa_scan_results *res);
|
||||||
|
|
||||||
/* hostapd functions for driver wrappers */
|
|
||||||
|
|
||||||
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
/*
|
||||||
const u8 *ie, size_t ielen);
|
* The following inline functions are provided for convenience to simplify
|
||||||
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
* event indication for some of the common events.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
|
||||||
|
size_t ielen)
|
||||||
|
{
|
||||||
|
union wpa_event_data event;
|
||||||
|
os_memset(&event, 0, sizeof(event));
|
||||||
|
event.assoc_info.req_ies = ie;
|
||||||
|
event.assoc_info.req_ies_len = ielen;
|
||||||
|
event.assoc_info.addr = addr;
|
||||||
|
wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void drv_event_disassoc(void *ctx, const u8 *addr)
|
||||||
|
{
|
||||||
|
union wpa_event_data event;
|
||||||
|
os_memset(&event, 0, sizeof(event));
|
||||||
|
event.disassoc_info.addr = addr;
|
||||||
|
wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* DRIVER_H */
|
#endif /* DRIVER_H */
|
||||||
|
|
|
@ -732,12 +732,12 @@ madwifi_set_ap_wps_ie(const char *ifname, void *priv,
|
||||||
#define madwifi_set_ap_wps_ie NULL
|
#define madwifi_set_ap_wps_ie NULL
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
static int
|
static void
|
||||||
madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = drv->hapd;
|
struct hostapd_data *hapd = drv->hapd;
|
||||||
struct ieee80211req_wpaie ie;
|
struct ieee80211req_wpaie ie;
|
||||||
int ielen = 0, res;
|
int ielen = 0;
|
||||||
u8 *iebuf = NULL;
|
u8 *iebuf = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -778,15 +778,13 @@ madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
ielen += 2;
|
ielen += 2;
|
||||||
|
|
||||||
no_ie:
|
no_ie:
|
||||||
res = hostapd_notif_assoc(hapd, addr, iebuf, ielen);
|
drv_event_assoc(hapd, addr, iebuf, ielen);
|
||||||
|
|
||||||
if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) {
|
if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) {
|
||||||
/* Cached accounting data is not valid anymore. */
|
/* Cached accounting data is not valid anymore. */
|
||||||
memset(drv->acct_mac, 0, ETH_ALEN);
|
memset(drv->acct_mac, 0, ETH_ALEN);
|
||||||
memset(&drv->acct_data, 0, sizeof(drv->acct_data));
|
memset(&drv->acct_data, 0, sizeof(drv->acct_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -904,8 +902,8 @@ madwifi_wireless_event_wireless(struct madwifi_driver_data *drv,
|
||||||
|
|
||||||
switch (iwe->cmd) {
|
switch (iwe->cmd) {
|
||||||
case IWEVEXPIRED:
|
case IWEVEXPIRED:
|
||||||
hostapd_notif_disassoc(drv->hapd,
|
drv_event_disassoc(drv->hapd,
|
||||||
(u8 *) iwe->u.addr.sa_data);
|
(u8 *) iwe->u.addr.sa_data);
|
||||||
break;
|
break;
|
||||||
case IWEVREGISTERED:
|
case IWEVREGISTERED:
|
||||||
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
||||||
|
|
|
@ -233,7 +233,8 @@ static void wpa_driver_broadcom_event_receive(int sock, void *ctx,
|
||||||
int left;
|
int left;
|
||||||
wl_wpa_header_t *wwh;
|
wl_wpa_header_t *wwh;
|
||||||
union wpa_event_data data;
|
union wpa_event_data data;
|
||||||
|
u8 *resp_ies = NULL;
|
||||||
|
|
||||||
if ((left = recv(sock, buf, sizeof buf, 0)) < 0)
|
if ((left = recv(sock, buf, sizeof buf, 0)) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -257,21 +258,16 @@ static void wpa_driver_broadcom_event_receive(int sock, void *ctx,
|
||||||
wpa_printf(MSG_DEBUG, "BROADCOM: ASSOC MESSAGE (left: %d)",
|
wpa_printf(MSG_DEBUG, "BROADCOM: ASSOC MESSAGE (left: %d)",
|
||||||
left);
|
left);
|
||||||
if (left > 0) {
|
if (left > 0) {
|
||||||
data.assoc_info.resp_ies = os_malloc(left);
|
resp_ies = os_malloc(left);
|
||||||
if (data.assoc_info.resp_ies == NULL)
|
if (resp_ies == NULL)
|
||||||
return;
|
return;
|
||||||
os_memcpy(data.assoc_info.resp_ies,
|
os_memcpy(resp_ies, buf + WL_WPA_HEADER_LEN, left);
|
||||||
buf + WL_WPA_HEADER_LEN, left);
|
data.assoc_info.resp_ies = resp_ies;
|
||||||
data.assoc_info.resp_ies_len = left;
|
data.assoc_info.resp_ies_len = left;
|
||||||
wpa_hexdump(MSG_MSGDUMP, "BROADCOM: copying %d bytes "
|
|
||||||
"into resp_ies",
|
|
||||||
data.assoc_info.resp_ies, left);
|
|
||||||
}
|
}
|
||||||
/* data.assoc_info.req_ies = NULL; */
|
|
||||||
/* data.assoc_info.req_ies_len = 0; */
|
|
||||||
|
|
||||||
wpa_supplicant_event(ctx, EVENT_ASSOCINFO, &data);
|
wpa_supplicant_event(ctx, EVENT_ASSOC, &data);
|
||||||
wpa_supplicant_event(ctx, EVENT_ASSOC, NULL);
|
os_free(resp_ies);
|
||||||
break;
|
break;
|
||||||
case WLC_DISASSOC_MSG:
|
case WLC_DISASSOC_MSG:
|
||||||
wpa_printf(MSG_DEBUG, "BROADCOM: DISASSOC MESSAGE");
|
wpa_printf(MSG_DEBUG, "BROADCOM: DISASSOC MESSAGE");
|
||||||
|
@ -292,7 +288,6 @@ static void wpa_driver_broadcom_event_receive(int sock, void *ctx,
|
||||||
wwh->type);
|
wwh->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
os_free(data.assoc_info.resp_ies);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * wpa_driver_broadcom_init(void *ctx, const char *ifname)
|
static void * wpa_driver_broadcom_init(void *ctx, const char *ifname)
|
||||||
|
|
|
@ -569,7 +569,7 @@ bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||||
return set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme));
|
return set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = drv->hapd;
|
struct hostapd_data *hapd = drv->hapd;
|
||||||
|
@ -594,7 +594,7 @@ bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
ielen += 2;
|
ielen += 2;
|
||||||
|
|
||||||
no_ie:
|
no_ie:
|
||||||
return hostapd_notif_assoc(hapd, addr, iebuf, ielen);
|
drv_event_assoc(hapd, addr, iebuf, ielen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -634,7 +634,7 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
|
||||||
break;
|
break;
|
||||||
case RTM_IEEE80211_LEAVE:
|
case RTM_IEEE80211_LEAVE:
|
||||||
leave = (struct ieee80211_leave_event *) &ifan[1];
|
leave = (struct ieee80211_leave_event *) &ifan[1];
|
||||||
hostapd_notif_disassoc(drv->hapd, leave->iev_addr);
|
drv_event_notif_disassoc(drv->hapd, leave->iev_addr);
|
||||||
break;
|
break;
|
||||||
case RTM_IEEE80211_JOIN:
|
case RTM_IEEE80211_JOIN:
|
||||||
#ifdef RTM_IEEE80211_REJOIN
|
#ifdef RTM_IEEE80211_REJOIN
|
||||||
|
|
|
@ -835,12 +835,12 @@ madwifi_set_ap_wps_ie(const char *ifname, void *priv,
|
||||||
#define madwifi_set_ap_wps_ie NULL
|
#define madwifi_set_ap_wps_ie NULL
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
static int
|
static void
|
||||||
madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = drv->hapd;
|
struct hostapd_data *hapd = drv->hapd;
|
||||||
struct ieee80211req_wpaie ie;
|
struct ieee80211req_wpaie ie;
|
||||||
int ielen = 0, res;
|
int ielen = 0;
|
||||||
u8 *iebuf = NULL;
|
u8 *iebuf = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -879,15 +879,13 @@ madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
ielen += 2;
|
ielen += 2;
|
||||||
|
|
||||||
no_ie:
|
no_ie:
|
||||||
res = hostapd_notif_assoc(hapd, addr, iebuf, ielen);
|
drv_event_assoc(hapd, addr, iebuf, ielen);
|
||||||
|
|
||||||
if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) {
|
if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) {
|
||||||
/* Cached accounting data is not valid anymore. */
|
/* Cached accounting data is not valid anymore. */
|
||||||
memset(drv->acct_mac, 0, ETH_ALEN);
|
memset(drv->acct_mac, 0, ETH_ALEN);
|
||||||
memset(&drv->acct_data, 0, sizeof(drv->acct_data));
|
memset(&drv->acct_data, 0, sizeof(drv->acct_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -980,8 +978,8 @@ madwifi_wireless_event_wireless(struct madwifi_driver_data *drv,
|
||||||
|
|
||||||
switch (iwe->cmd) {
|
switch (iwe->cmd) {
|
||||||
case IWEVEXPIRED:
|
case IWEVEXPIRED:
|
||||||
hostapd_notif_disassoc(drv->hapd,
|
drv_event_disassoc(drv->hapd,
|
||||||
(u8 *) iwe->u.addr.sa_data);
|
(u8 *) iwe->u.addr.sa_data);
|
||||||
break;
|
break;
|
||||||
case IWEVREGISTERED:
|
case IWEVREGISTERED:
|
||||||
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
||||||
|
|
|
@ -452,6 +452,7 @@ wpa_driver_ralink_event_wireless_custom(struct wpa_driver_ralink_data *drv,
|
||||||
void *ctx, char *custom)
|
void *ctx, char *custom)
|
||||||
{
|
{
|
||||||
union wpa_event_data data;
|
union wpa_event_data data;
|
||||||
|
u8 *req_ies = NULL, *resp_ies = NULL;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
|
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
|
||||||
|
|
||||||
|
@ -480,12 +481,12 @@ wpa_driver_ralink_event_wireless_custom(struct wpa_driver_ralink_data *drv,
|
||||||
*/
|
*/
|
||||||
bytes = drv->assoc_req_ies_len;
|
bytes = drv->assoc_req_ies_len;
|
||||||
|
|
||||||
data.assoc_info.req_ies = os_malloc(bytes);
|
req_ies = os_malloc(bytes);
|
||||||
if (data.assoc_info.req_ies == NULL)
|
if (req_ies == NULL)
|
||||||
return;
|
return;
|
||||||
|
os_memcpy(req_ies, spos, bytes);
|
||||||
|
data.assoc_info.req_ies = req_ies;
|
||||||
data.assoc_info.req_ies_len = bytes;
|
data.assoc_info.req_ies_len = bytes;
|
||||||
os_memcpy(data.assoc_info.req_ies, spos, bytes);
|
|
||||||
|
|
||||||
/* skip the '\0' byte */
|
/* skip the '\0' byte */
|
||||||
spos += bytes + 1;
|
spos += bytes + 1;
|
||||||
|
@ -501,21 +502,20 @@ wpa_driver_ralink_event_wireless_custom(struct wpa_driver_ralink_data *drv,
|
||||||
if (!bytes)
|
if (!bytes)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
resp_ies = os_malloc(bytes);
|
||||||
data.assoc_info.resp_ies = os_malloc(bytes);
|
if (resp_ies == NULL)
|
||||||
if (data.assoc_info.resp_ies == NULL)
|
|
||||||
goto done;
|
goto done;
|
||||||
|
os_memcpy(resp_ies, spos, bytes);
|
||||||
|
data.assoc_info.resp_ies = resp_ies;
|
||||||
data.assoc_info.resp_ies_len = bytes;
|
data.assoc_info.resp_ies_len = bytes;
|
||||||
os_memcpy(data.assoc_info.resp_ies, spos, bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_supplicant_event(ctx, EVENT_ASSOCINFO, &data);
|
wpa_supplicant_event(ctx, EVENT_ASSOCINFO, &data);
|
||||||
|
|
||||||
/* free allocated memory */
|
|
||||||
done:
|
done:
|
||||||
os_free(data.assoc_info.resp_ies);
|
/* free allocated memory */
|
||||||
os_free(data.assoc_info.req_ies);
|
os_free(resp_ies);
|
||||||
|
os_free(req_ies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -622,10 +622,7 @@ static void test_driver_assoc(struct wpa_driver_test_data *drv,
|
||||||
sendto(drv->test_socket, cmd, strlen(cmd), 0,
|
sendto(drv->test_socket, cmd, strlen(cmd), 0,
|
||||||
(struct sockaddr *) from, fromlen);
|
(struct sockaddr *) from, fromlen);
|
||||||
|
|
||||||
#ifdef HOSTAPD
|
drv_event_assoc(bss->bss_ctx, cli->addr, ie, ielen);
|
||||||
if (hostapd_notif_assoc(bss->bss_ctx, cli->addr, ie, ielen) < 0)
|
|
||||||
wpa_printf(MSG_DEBUG, "test_driver: failed to add new STA");
|
|
||||||
#endif /* HOSTAPD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -638,9 +635,7 @@ static void test_driver_disassoc(struct wpa_driver_test_data *drv,
|
||||||
if (!cli)
|
if (!cli)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HOSTAPD
|
drv_event_disassoc(drv->ctx, cli->addr);
|
||||||
hostapd_notif_disassoc(drv->ctx, cli->addr);
|
|
||||||
#endif /* HOSTAPD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,7 @@ wpa_driver_wext_event_wireless_custom(void *ctx, char *custom)
|
||||||
} else if (os_strncmp(custom, "ASSOCINFO(ReqIEs=", 17) == 0) {
|
} else if (os_strncmp(custom, "ASSOCINFO(ReqIEs=", 17) == 0) {
|
||||||
char *spos;
|
char *spos;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
u8 *req_ies = NULL, *resp_ies = NULL;
|
||||||
|
|
||||||
spos = custom + 17;
|
spos = custom + 17;
|
||||||
|
|
||||||
|
@ -254,12 +255,12 @@ wpa_driver_wext_event_wireless_custom(void *ctx, char *custom)
|
||||||
return;
|
return;
|
||||||
bytes /= 2;
|
bytes /= 2;
|
||||||
|
|
||||||
data.assoc_info.req_ies = os_malloc(bytes);
|
req_ies = os_malloc(bytes);
|
||||||
if (data.assoc_info.req_ies == NULL)
|
if (req_ies == NULL)
|
||||||
return;
|
return;
|
||||||
|
hexstr2bin(spos, req_ies, bytes);
|
||||||
|
data.assoc_info.req_ies = req_ies;
|
||||||
data.assoc_info.req_ies_len = bytes;
|
data.assoc_info.req_ies_len = bytes;
|
||||||
hexstr2bin(spos, data.assoc_info.req_ies, bytes);
|
|
||||||
|
|
||||||
spos += bytes * 2;
|
spos += bytes * 2;
|
||||||
|
|
||||||
|
@ -274,19 +275,19 @@ wpa_driver_wext_event_wireless_custom(void *ctx, char *custom)
|
||||||
goto done;
|
goto done;
|
||||||
bytes /= 2;
|
bytes /= 2;
|
||||||
|
|
||||||
data.assoc_info.resp_ies = os_malloc(bytes);
|
resp_ies = os_malloc(bytes);
|
||||||
if (data.assoc_info.resp_ies == NULL)
|
if (resp_ies == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
hexstr2bin(spos, resp_ies, bytes);
|
||||||
|
data.assoc_info.resp_ies = resp_ies;
|
||||||
data.assoc_info.resp_ies_len = bytes;
|
data.assoc_info.resp_ies_len = bytes;
|
||||||
hexstr2bin(spos, data.assoc_info.resp_ies, bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_supplicant_event(ctx, EVENT_ASSOCINFO, &data);
|
wpa_supplicant_event(ctx, EVENT_ASSOCINFO, &data);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
os_free(data.assoc_info.resp_ies);
|
os_free(resp_ies);
|
||||||
os_free(data.assoc_info.req_ies);
|
os_free(req_ies);
|
||||||
#ifdef CONFIG_PEERKEY
|
#ifdef CONFIG_PEERKEY
|
||||||
} else if (os_strncmp(custom, "STKSTART.request=", 17) == 0) {
|
} else if (os_strncmp(custom, "STKSTART.request=", 17) == 0) {
|
||||||
if (hwaddr_aton(custom + 17, data.stkstart.peer)) {
|
if (hwaddr_aton(custom + 17, data.stkstart.peer)) {
|
||||||
|
@ -402,19 +403,19 @@ static void wpa_driver_wext_event_assoc_ies(struct wpa_driver_wext_data *drv)
|
||||||
os_memset(&data, 0, sizeof(data));
|
os_memset(&data, 0, sizeof(data));
|
||||||
if (drv->assoc_req_ies) {
|
if (drv->assoc_req_ies) {
|
||||||
data.assoc_info.req_ies = drv->assoc_req_ies;
|
data.assoc_info.req_ies = drv->assoc_req_ies;
|
||||||
drv->assoc_req_ies = NULL;
|
|
||||||
data.assoc_info.req_ies_len = drv->assoc_req_ies_len;
|
data.assoc_info.req_ies_len = drv->assoc_req_ies_len;
|
||||||
}
|
}
|
||||||
if (drv->assoc_resp_ies) {
|
if (drv->assoc_resp_ies) {
|
||||||
data.assoc_info.resp_ies = drv->assoc_resp_ies;
|
data.assoc_info.resp_ies = drv->assoc_resp_ies;
|
||||||
drv->assoc_resp_ies = NULL;
|
|
||||||
data.assoc_info.resp_ies_len = drv->assoc_resp_ies_len;
|
data.assoc_info.resp_ies_len = drv->assoc_resp_ies_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_supplicant_event(drv->ctx, EVENT_ASSOCINFO, &data);
|
wpa_supplicant_event(drv->ctx, EVENT_ASSOCINFO, &data);
|
||||||
|
|
||||||
os_free(data.assoc_info.req_ies);
|
os_free(drv->assoc_req_ies);
|
||||||
os_free(data.assoc_info.resp_ies);
|
drv->assoc_req_ies = NULL;
|
||||||
|
os_free(drv->assoc_resp_ies);
|
||||||
|
drv->assoc_resp_ies = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "rsn_supp/pmksa_cache.h"
|
#include "rsn_supp/pmksa_cache.h"
|
||||||
#include "common/wpa_ctrl.h"
|
#include "common/wpa_ctrl.h"
|
||||||
#include "eap_peer/eap.h"
|
#include "eap_peer/eap.h"
|
||||||
|
#include "ap/hostapd.h"
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
#include "common/ieee802_11_defs.h"
|
#include "common/ieee802_11_defs.h"
|
||||||
#include "blacklist.h"
|
#include "blacklist.h"
|
||||||
|
@ -1009,10 +1010,21 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
|
||||||
union wpa_event_data *data)
|
union wpa_event_data *data)
|
||||||
{
|
{
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
int ft_completed = wpa_ft_is_completed(wpa_s->wpa);
|
int ft_completed;
|
||||||
int bssid_changed;
|
int bssid_changed;
|
||||||
struct wpa_driver_capa capa;
|
struct wpa_driver_capa capa;
|
||||||
|
|
||||||
|
#ifdef CONFIG_AP
|
||||||
|
if (wpa_s->ap_iface) {
|
||||||
|
hostapd_notif_assoc(wpa_s->ap_iface->bss[0],
|
||||||
|
data->assoc_info.addr,
|
||||||
|
data->assoc_info.req_ies,
|
||||||
|
data->assoc_info.req_ies_len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_AP */
|
||||||
|
|
||||||
|
ft_completed = wpa_ft_is_completed(wpa_s->wpa);
|
||||||
if (data)
|
if (data)
|
||||||
wpa_supplicant_event_associnfo(wpa_s, data);
|
wpa_supplicant_event_associnfo(wpa_s, data);
|
||||||
|
|
||||||
|
@ -1425,10 +1437,24 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||||
wpa_supplicant_event_assoc(wpa_s, data);
|
wpa_supplicant_event_assoc(wpa_s, data);
|
||||||
break;
|
break;
|
||||||
case EVENT_DISASSOC:
|
case EVENT_DISASSOC:
|
||||||
|
#ifdef CONFIG_AP
|
||||||
|
if (wpa_s->ap_iface && data) {
|
||||||
|
hostapd_notif_disassoc(wpa_s->ap_iface->bss[0],
|
||||||
|
data->disassoc_info.addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_AP */
|
||||||
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
|
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
|
||||||
sme_event_disassoc(wpa_s, data);
|
sme_event_disassoc(wpa_s, data);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case EVENT_DEAUTH:
|
case EVENT_DEAUTH:
|
||||||
|
#ifdef CONFIG_AP
|
||||||
|
if (wpa_s->ap_iface && data) {
|
||||||
|
hostapd_notif_disassoc(wpa_s->ap_iface->bss[0],
|
||||||
|
data->deauth_info.addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_AP */
|
||||||
wpa_supplicant_event_disassoc(wpa_s);
|
wpa_supplicant_event_disassoc(wpa_s);
|
||||||
break;
|
break;
|
||||||
case EVENT_MICHAEL_MIC_FAILURE:
|
case EVENT_MICHAEL_MIC_FAILURE:
|
||||||
|
|
Loading…
Reference in a new issue