]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Notify WPS-M2D event on parent interface and handle PBC overlap
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 22 Feb 2011 10:20:16 +0000 (12:20 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 22 Feb 2011 10:20:16 +0000 (12:20 +0200)
GO may use M2D to notify that PBC overlap was detected if the GO was
configured to allow only a specific P2P Device to connect using PBC.
We need to report the M2D message on the parent interface if a
separate group interface is used. In addition, we can stop the P2P
operation if PBC overlap was indicated similarly to what we are
already doing in th case the overlap is detected locally.

wpa_supplicant/wps_supplicant.c

index d39d2cd714332a8a6ed1ccf9e53b8cb8e9e0ad15..94a60c765ad97e0d64822eabe16210dda0855c89 100644 (file)
@@ -404,6 +404,15 @@ static int wpa_supplicant_wps_cred(void *ctx,
 }
 
 
+#ifdef CONFIG_P2P
+static void wpas_wps_pbc_overlap_cb(void *eloop_ctx, void *timeout_ctx)
+{
+       struct wpa_supplicant *wpa_s = eloop_ctx;
+       wpas_p2p_notif_pbc_overlap(wpa_s);
+}
+#endif /* CONFIG_P2P */
+
+
 static void wpa_supplicant_wps_event_m2d(struct wpa_supplicant *wpa_s,
                                         struct wps_event_m2d *m2d)
 {
@@ -411,6 +420,21 @@ static void wpa_supplicant_wps_event_m2d(struct wpa_supplicant *wpa_s,
                "dev_password_id=%d config_error=%d",
                m2d->dev_password_id, m2d->config_error);
        wpas_notify_wps_event_m2d(wpa_s, m2d);
+#ifdef CONFIG_P2P
+       if (wpa_s->parent && wpa_s->parent != wpa_s) {
+               wpa_msg(wpa_s->parent, MSG_INFO, WPS_EVENT_M2D
+                       "dev_password_id=%d config_error=%d",
+                       m2d->dev_password_id, m2d->config_error);
+       }
+       if (m2d->config_error == WPS_CFG_MULTIPLE_PBC_DETECTED) {
+               /*
+                * Notify P2P from eloop timeout to avoid issues with the
+                * interface getting removed while processing a message.
+                */
+               eloop_register_timeout(0, 0, wpas_wps_pbc_overlap_cb, wpa_s,
+                                      NULL);
+       }
+#endif /* CONFIG_P2P */
 }