]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add more debug information to PBC session overlap check
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 17 Mar 2011 16:04:56 +0000 (18:04 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 17 Mar 2011 16:04:56 +0000 (18:04 +0200)
src/wps/wps_registrar.c

index de64396348cde06353e5bfb5cfca2cde6bb7b11a..58a17ad7d65876161de75567025f8a89801b1ef1 100644 (file)
@@ -346,23 +346,40 @@ int wps_registrar_pbc_overlap(struct wps_registrar *reg,
 
        os_get_time(&now);
 
+       wpa_printf(MSG_DEBUG, "WPS: Checking active PBC sessions for overlap");
+
+       if (uuid_e) {
+               wpa_printf(MSG_DEBUG, "WPS: Add one for the requested UUID");
+               wpa_hexdump(MSG_DEBUG, "WPS: Requested UUID",
+                           uuid_e, WPS_UUID_LEN);
+               count++;
+       }
+
        for (pbc = reg->pbc_sessions; pbc; pbc = pbc->next) {
-               if (now.sec > pbc->timestamp.sec + WPS_PBC_WALK_TIME)
+               wpa_printf(MSG_DEBUG, "WPS: Consider PBC session with " MACSTR,
+                          MAC2STR(pbc->addr));
+               wpa_hexdump(MSG_DEBUG, "WPS: UUID-E",
+                           pbc->uuid_e, WPS_UUID_LEN);
+               if (now.sec > pbc->timestamp.sec + WPS_PBC_WALK_TIME) {
+                       wpa_printf(MSG_DEBUG, "WPS: PBC walk time has "
+                                  "expired");
                        break;
+               }
                if (first &&
-                   os_memcmp(pbc->uuid_e, first->uuid_e, WPS_UUID_LEN) == 0)
+                   os_memcmp(pbc->uuid_e, first->uuid_e, WPS_UUID_LEN) == 0) {
+                       wpa_printf(MSG_DEBUG, "WPS: Same Enrollee");
                        continue; /* same Enrollee */
+               }
                if (uuid_e == NULL ||
-                   os_memcmp(uuid_e, pbc->uuid_e, WPS_UUID_LEN))
+                   os_memcmp(uuid_e, pbc->uuid_e, WPS_UUID_LEN)) {
+                       wpa_printf(MSG_DEBUG, "WPS: New Enrollee");
                        count++;
+               }
                if (first == NULL)
                        first = pbc;
        }
 
-       if (uuid_e &&
-           (first == NULL ||
-            os_memcmp(uuid_e, first->uuid_e, WPS_UUID_LEN) != 0))
-               count++;
+       wpa_printf(MSG_DEBUG, "WPS: %u active PBC session(s) found", count);
 
        return count > 1 ? 1 : 0;
 }