WPS: Indicate PBC session overlap in wps_pbc return value

Use a specific return value, WPS-PBC-OVERLAP, to indicate a reason
for rejecting a wps_pbc command in wpa_supplicant AP mode if the
PBC mode cannot be started due to PBC session overlap having been
detected during monitor time.
This commit is contained in:
Chao-Wen Yang 2011-03-10 18:59:51 +02:00 committed by Jouni Malinen
parent 3cc002ff97
commit 3152ff421e
2 changed files with 16 additions and 5 deletions

View File

@ -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;

View File

@ -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,