diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index c585fb926..ff4cc59ae 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -873,11 +873,14 @@ static void wps_registrar_pbc_timeout(void *eloop_ctx, void *timeout_ctx) * @reg: Registrar data from wps_registrar_init() * @p2p_dev_addr: Limit allowed PBC devices to the specified P2P device, %NULL * indicates no such filtering - * Returns: 0 on success, -1 on failure + * Returns: 0 on success, -1 on failure, -2 on session overlap * * This function is called on an AP when a push button is pushed to activate * PBC mode. The PBC mode will be stopped after walk time (2 minutes) timeout - * or when a PBC registration is completed. + * or when a PBC registration is completed. If more than one Enrollee in active + * PBC mode has been detected during the monitor time (previous 2 minutes), the + * PBC mode is not actived and -2 is returned to indicate session overlap. This + * is skipped if a specific Enrollee is selected. */ int wps_registrar_button_pushed(struct wps_registrar *reg, const u8 *p2p_dev_addr) @@ -887,7 +890,7 @@ int wps_registrar_button_pushed(struct wps_registrar *reg, wpa_printf(MSG_DEBUG, "WPS: PBC overlap - do not start PBC " "mode"); wps_pbc_overlap_event(reg->wps); - return -1; + return -2; } wpa_printf(MSG_DEBUG, "WPS: Button pushed - PBC mode started"); reg->force_pbc_overlap = 0; diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index ed9a7666a..9f0611580 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2929,10 +2929,18 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, #endif /* CONFIG_IEEE80211R */ #ifdef CONFIG_WPS } else if (os_strcmp(buf, "WPS_PBC") == 0) { - if (wpa_supplicant_ctrl_iface_wps_pbc(wpa_s, NULL)) + int res = wpa_supplicant_ctrl_iface_wps_pbc(wpa_s, NULL); + if (res == -2) { + os_memcpy(reply, "FAIL-PBC-OVERLAP\n", 17); + reply_len = 17; + } else if (res) reply_len = -1; } else if (os_strncmp(buf, "WPS_PBC ", 8) == 0) { - if (wpa_supplicant_ctrl_iface_wps_pbc(wpa_s, buf + 8)) + int res = wpa_supplicant_ctrl_iface_wps_pbc(wpa_s, buf + 8); + if (res == -2) { + os_memcpy(reply, "FAIL-PBC-OVERLAP\n", 17); + reply_len = 17; + } else if (res) reply_len = -1; } else if (os_strncmp(buf, "WPS_PIN ", 8) == 0) { reply_len = wpa_supplicant_ctrl_iface_wps_pin(wpa_s, buf + 8,