P2P: Stop connection attempt on PBC session overlap
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 7 Sep 2010 10:42:55 +0000 (13:42 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 10 Sep 2010 17:30:25 +0000 (10:30 -0700)
The overlap condition cannot disappear before group formation timeout
hits, so there is no point in continuing in this case and failure can
be indicated immediately.

wpa_supplicant/events.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index 0fad8f7..8bc05bd 100644 (file)
@@ -623,6 +623,10 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
        if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
                wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
                        "PBC session overlap");
+#ifdef CONFIG_P2P
+               if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1)
+                       return;
+#endif /* CONFIG_P2P */
                wpa_supplicant_req_new_scan(wpa_s, 10, 0);
                return;
        }
index d86fa04..be6c339 100644 (file)
@@ -3535,3 +3535,16 @@ static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s)
                break;
        }
 }
+
+
+int wpas_p2p_notif_pbc_overlap(struct wpa_supplicant *wpa_s)
+{
+       if (wpa_s->p2p_group_interface != P2P_GROUP_INTERFACE_CLIENT &&
+           !wpa_s->p2p_in_provisioning)
+               return 0; /* not P2P client operation */
+
+       wpa_printf(MSG_DEBUG, "P2P: Terminate connection due to WPS PBC "
+                  "session overlap");
+       wpas_group_formation_completed(wpa_s, 0);
+       return 1;
+}
index c4c00ed..363293a 100644 (file)
@@ -112,5 +112,6 @@ int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
 int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled);
 void wpas_p2p_notif_connected(struct wpa_supplicant *wpa_s);
 void wpas_p2p_notif_disconnected(struct wpa_supplicant *wpa_s);
+int wpas_p2p_notif_pbc_overlap(struct wpa_supplicant *wpa_s);
 
 #endif /* P2P_SUPPLICANT_H */