[PATCH] Skip WPS PBC overlap detection if P2P address is the same

Vitaly Wool vitalywool
Sat Dec 10 06:16:02 PST 2011


WPS overlap detection can detect false overlap if a P2P peer
changes UUID while authentication is ongoing. Changing UUID
is of course wrong but this is what some popular devices do
so we need to work it around in order to keep compatibility
with these devices. There already is a mechanism in WPS
registrar to skip overlap detection if P2P addresses of two
sessions match but it wasn't really triggered because the
address wasn't filled in in the caller function.

Let's fill in this address and also clean up WPS PBC sessions
on WSC process completion if UUID was changed.

Signed-hostap: Vitaly Wool<vitalywool at gmail.com>
---
  src/wps/wps_registrar.c         |   10 +++++++---
  wpa_supplicant/p2p_supplicant.c |    2 +-
  2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index 4a49197..eed29e2 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -310,13 +310,16 @@ static void wps_registrar_add_pbc_session(struct wps_registrar *reg,


  static void wps_registrar_remove_pbc_session(struct wps_registrar *reg,
-					     const u8 *uuid_e)
+					     const u8 *uuid_e,
+					     const u8 *p2p_dev_addr)
  {
  	struct wps_pbc_session *pbc, *prev = NULL, *tmp;

  	pbc = reg->pbc_sessions;
  	while (pbc) {
-		if (os_memcmp(pbc->uuid_e, uuid_e, WPS_UUID_LEN) == 0) {
+		if (os_memcmp(pbc->uuid_e, uuid_e, WPS_UUID_LEN) == 0 ||
+		    (!is_zero_ether_addr(reg->p2p_dev_addr)&&
+		     !os_memcmp(reg->p2p_dev_addr, p2p_dev_addr, ETH_ALEN))) {
  			if (prev)
  				prev->next = pbc->next;
  			else
@@ -3035,7 +3038,8 @@ static enum wps_process_res wps_process_wsc_done(struct wps_data *wps,

  	if (wps->pbc) {
  		wps_registrar_remove_pbc_session(wps->wps->registrar,
-						 wps->uuid_e);
+						 wps->uuid_e,
+						 wps->p2p_dev_addr);
  		wps_registrar_pbc_completed(wps->wps->registrar);
  	} else {
  		wps_registrar_pin_completed(wps->wps->registrar);
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index f3108c4..8c6978d 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -682,7 +682,7 @@ static void p2p_go_configured(void *ctx, void *data)
  	}
  	if (params->wps_method == WPS_PBC)
  		wpa_supplicant_ap_wps_pbc(wpa_s, params->peer_interface_addr,
-					  NULL);
+					  params->peer_device_addr);
  	else if (wpa_s->p2p_pin[0])
  		wpa_supplicant_ap_wps_pin(wpa_s, params->peer_interface_addr,
  					  wpa_s->p2p_pin, NULL, 0);
-- 
1.7.7.3






More information about the Hostap mailing list