WPS ER: Use PBC overlap detection
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 22 Jul 2010 02:19:53 +0000 (19:19 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 13:07:49 +0000 (06:07 -0700)
ER should follow same rules as internal Registrar in an AP for
session overlap detection.

src/wps/wps_er.c
src/wps/wps_i.h
src/wps/wps_registrar.c

index c1ed6b4..3c6d77a 100644 (file)
@@ -763,6 +763,7 @@ static void wps_er_process_wlanevent_probe_req(struct wps_er_ap *ap,
        }
 
        wps_er_add_sta_data(ap, addr, &attr, 1);
+       wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg);
 }
 
 
@@ -1398,6 +1399,12 @@ int wps_er_pbc(struct wps_er *er, const u8 *uuid)
        if (er == NULL || er->wps == NULL)
                return -1;
 
+       if (wps_registrar_pbc_overlap(er->wps->registrar, NULL, NULL)) {
+               wpa_printf(MSG_DEBUG, "WPS ER: PBC overlap - do not start PBC "
+                          "mode");
+               return -1;
+       }
+
        /*
         * TODO: Should enable PBC mode only in a single AP based on which AP
         * the Enrollee (uuid) is using. Now, we may end up enabling multiple
index 5a3246e..ee13428 100644 (file)
@@ -278,6 +278,8 @@ int wps_device_store(struct wps_registrar *reg,
                     struct wps_device_data *dev, const u8 *uuid);
 void wps_registrar_selected_registrar_changed(struct wps_registrar *reg);
 int wps_build_authorized_macs(struct wps_registrar *reg, struct wpabuf *msg);
+int wps_registrar_pbc_overlap(struct wps_registrar *reg,
+                             const u8 *addr, const u8 *uuid_e);
 
 /* ndef.c */
 struct wpabuf * ndef_parse_wifi(struct wpabuf *buf);
index 050b388..e9c6c52 100644 (file)
@@ -313,8 +313,8 @@ static void wps_registrar_remove_pbc_session(struct wps_registrar *reg,
 }
 
 
-static int wps_registrar_pbc_overlap(struct wps_registrar *reg,
-                                    const u8 *addr, const u8 *uuid_e)
+int wps_registrar_pbc_overlap(struct wps_registrar *reg,
+                             const u8 *addr, const u8 *uuid_e)
 {
        int count = 0;
        struct wps_pbc_session *pbc;