WPS ER: Add more details to wps_er_pbc failure returns

Indicate the reason for the failure when wps_er_pbc is rejected.
This commit is contained in:
Jouni Malinen 2010-10-25 21:59:25 +03:00 committed by Jouni Malinen
parent 669f322d0e
commit ed159ad41b
2 changed files with 18 additions and 3 deletions

View file

@ -1455,7 +1455,7 @@ int wps_er_pbc(struct wps_er *er, const u8 *uuid)
if (wps_registrar_pbc_overlap(er->wps->registrar, NULL, NULL)) {
wpa_printf(MSG_DEBUG, "WPS ER: PBC overlap - do not start PBC "
"mode");
return -1;
return -2;
}
ap = wps_er_ap_get(er, NULL, uuid);
@ -1469,7 +1469,12 @@ int wps_er_pbc(struct wps_er *er, const u8 *uuid)
}
}
if (sta == NULL)
return -1; /* Unknown UUID */
return -3; /* Unknown UUID */
}
if (ap->ap_settings == NULL) {
wpa_printf(MSG_DEBUG, "WPS ER: AP settings not known");
return -4;
}
er->set_sel_reg_uuid_filter = uuid;

View file

@ -2809,7 +2809,17 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_ctrl_iface_wps_er_pin(wpa_s, buf + 11))
reply_len = -1;
} else if (os_strncmp(buf, "WPS_ER_PBC ", 11) == 0) {
if (wpas_wps_er_pbc(wpa_s, buf + 11))
int ret = wpas_wps_er_pbc(wpa_s, buf + 11);
if (ret == -2) {
os_memcpy(reply, "FAIL-PBC-OVERLAP\n", 17);
reply_len = 17;
} else if (ret == -3) {
os_memcpy(reply, "FAIL-UNKNOWN-UUID\n", 18);
reply_len = 18;
} else if (ret == -4) {
os_memcpy(reply, "FAIL-NO-AP-SETTINGS\n", 20);
reply_len = 20;
} else if (ret)
reply_len = -1;
} else if (os_strncmp(buf, "WPS_ER_LEARN ", 13) == 0) {
if (wpa_supplicant_ctrl_iface_wps_er_learn(wpa_s, buf + 13))