From: Jouni Malinen Date: Thu, 17 Mar 2011 16:04:56 +0000 (+0200) Subject: WPS: Add more debug information to PBC session overlap check X-Git-Tag: hostap-1-bp~474 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2b3c6bc9c4e757f3d0d30841132b125a869c5f5;p=thirdparty%2Fhostap.git WPS: Add more debug information to PBC session overlap check --- diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index de6439634..58a17ad7d 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -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; }