]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_s AP: Deliver EVENT_RX_PROBE_REQ events to AP processing
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 8 Feb 2011 12:32:35 +0000 (14:32 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 8 Feb 2011 12:32:35 +0000 (14:32 +0200)
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.

src/ap/drv_callbacks.c
src/ap/hostapd.h
wpa_supplicant/events.c

index c1fdba6b987dfb70bf46d36ec47bf37d1585970c..c1557a1aff548478619152669200930f07ff56e1 100644 (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 NEED_AP_MLME
@@ -386,25 +405,6 @@ static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
 #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)
 {
        struct sta_info *sta = ap_get_sta(hapd, addr);
index 8d2dc2031b1fe7dd340068a9bdae7d339b91e06b..470bfe92f86aa03d6be1eeb13371a4b5a8bdc689 100644 (file)
@@ -252,5 +252,7 @@ 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);
 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 */
index a2556c693c6cd334f308a5e5853487a84c11b8f3..e8735e6b5304bf8cac8d04124282a56f087b8964 100644 (file)
@@ -1949,6 +1949,22 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                                   data->rx_action.category,
                                   data->rx_action.data,
                                   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 */
                break;
 #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(
                        wpa_s, data->remain_on_channel.freq);
                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:
                wpas_dev_found(wpa_s, data->p2p_dev_found.addr,
                               data->p2p_dev_found.dev_addr,