P2P: Do no process Probe Request with P2P wildcard SSID in WPS
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 18 Jul 2010 21:30:24 +0000 (14:30 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:16 +0000 (07:17 -0700)
The Probe Request frames used in P2P Device Discovery should not be
processed by the WPS implementation.

src/ap/wps_hostapd.c
src/wps/wps.h
src/wps/wps_registrar.c

index c01554d..188ad4c 100644 (file)
@@ -826,13 +826,22 @@ static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
        }
 
        if (wpabuf_len(wps_ie) > 0) {
-               wps_registrar_probe_req_rx(hapd->wps->registrar, addr, wps_ie);
+               int p2p_wildcard = 0;
+#ifdef CONFIG_P2P
+               if (elems.ssid && elems.ssid_len == P2P_WILDCARD_SSID_LEN &&
+                   os_memcmp(elems.ssid, P2P_WILDCARD_SSID,
+                             P2P_WILDCARD_SSID_LEN) == 0)
+                       p2p_wildcard = 1;
+#endif /* CONFIG_P2P */
+               wps_registrar_probe_req_rx(hapd->wps->registrar, addr, wps_ie,
+                                          p2p_wildcard);
 #ifdef CONFIG_WPS_UPNP
                /* FIX: what exactly should be included in the WLANEvent?
                 * WPS attributes? Full ProbeReq frame? */
-               upnp_wps_device_send_wlan_event(hapd->wps_upnp, addr,
-                                               UPNP_WPS_WLANEVENT_TYPE_PROBE,
-                                               wps_ie);
+               if (!p2p_wildcard)
+                       upnp_wps_device_send_wlan_event(
+                               hapd->wps_upnp, addr,
+                               UPNP_WPS_WLANEVENT_TYPE_PROBE, wps_ie);
 #endif /* CONFIG_WPS_UPNP */
        }
 
index 432dcc5..3f61189 100644 (file)
@@ -719,7 +719,8 @@ int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid);
 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
 int wps_registrar_button_pushed(struct wps_registrar *reg);
 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
-                               const struct wpabuf *wps_data);
+                               const struct wpabuf *wps_data,
+                               int p2p_wildcard);
 int wps_registrar_update_ie(struct wps_registrar *reg);
 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr,
                           char *buf, size_t buflen);
index 03023b0..6c47967 100644 (file)
@@ -876,7 +876,8 @@ static void wps_registrar_pin_completed(struct wps_registrar *reg)
  * situation with other WPS APs.
  */
 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
-                               const struct wpabuf *wps_data)
+                               const struct wpabuf *wps_data,
+                               int p2p_wildcard)
 {
        struct wps_parse_attr attr;
 
@@ -900,7 +901,7 @@ void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
        }
 
        if (reg->enrollee_seen_cb && attr.uuid_e &&
-           attr.primary_dev_type && attr.request_type) {
+           attr.primary_dev_type && attr.request_type && !p2p_wildcard) {
                char *dev_name = NULL;
                if (attr.dev_name) {
                        dev_name = os_zalloc(attr.dev_name_len + 1);