wpa_s AP: Deliver EVENT_RX_PROBE_REQ events to AP processing

This is needed to allows WPS PBC session overlap detection to work
with drivers that process Probe Request frames internally. This
code is is run in hostapd, but the wpa_supplicant AP mode did not
have call to the hostapd_probe_req_rx() function even though it
registered handlers for hostapd Probe Request RX callbacks.
This commit is contained in:
Jouni Malinen 2011-02-08 14:32:35 +02:00 committed by Jouni Malinen
parent d601247ca9
commit e67b55fb11
3 changed files with 37 additions and 24 deletions

View file

@ -247,6 +247,25 @@ void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
} }
int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
const u8 *ie, size_t ie_len)
{
size_t i;
int ret = 0;
if (sa)
random_add_randomness(sa, ETH_ALEN);
for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
sa, ie, ie_len) > 0) {
ret = 1;
break;
}
}
return ret;
}
#ifdef HOSTAPD #ifdef HOSTAPD
#ifdef NEED_AP_MLME #ifdef NEED_AP_MLME
@ -386,25 +405,6 @@ static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
#endif /* NEED_AP_MLME */ #endif /* NEED_AP_MLME */
static int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
const u8 *ie, size_t ie_len)
{
size_t i;
int ret = 0;
if (sa)
random_add_randomness(sa, ETH_ALEN);
for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
sa, ie, ie_len) > 0) {
ret = 1;
break;
}
}
return ret;
}
static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr) static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
{ {
struct sta_info *sta = ap_get_sta(hapd, addr); struct sta_info *sta = ap_get_sta(hapd, addr);

View file

@ -252,5 +252,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
const u8 *ie, size_t ielen); const u8 *ie, size_t ielen);
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr); void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr); void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
const u8 *ie, size_t ie_len);
#endif /* HOSTAPD_H */ #endif /* HOSTAPD_H */

View file

@ -1949,6 +1949,22 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->rx_action.category, data->rx_action.category,
data->rx_action.data, data->rx_action.data,
data->rx_action.len, data->rx_action.freq); data->rx_action.len, data->rx_action.freq);
#endif /* CONFIG_P2P */
break;
case EVENT_RX_PROBE_REQ:
#ifdef CONFIG_AP
if (wpa_s->ap_iface) {
hostapd_probe_req_rx(wpa_s->ap_iface->bss[0],
data->rx_probe_req.sa,
data->rx_probe_req.ie,
data->rx_probe_req.ie_len);
break;
}
#endif /* CONFIG_AP */
#ifdef CONFIG_P2P
wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa,
data->rx_probe_req.ie,
data->rx_probe_req.ie_len);
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
break; break;
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
@ -1961,11 +1977,6 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
wpas_p2p_cancel_remain_on_channel_cb( wpas_p2p_cancel_remain_on_channel_cb(
wpa_s, data->remain_on_channel.freq); wpa_s, data->remain_on_channel.freq);
break; break;
case EVENT_RX_PROBE_REQ:
wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa,
data->rx_probe_req.ie,
data->rx_probe_req.ie_len);
break;
case EVENT_P2P_DEV_FOUND: case EVENT_P2P_DEV_FOUND:
wpas_dev_found(wpa_s, data->p2p_dev_found.addr, wpas_dev_found(wpa_s, data->p2p_dev_found.addr,
data->p2p_dev_found.dev_addr, data->p2p_dev_found.dev_addr,