]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS ER: Add more details to wps_er_pbc failure returns
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 25 Oct 2010 18:59:25 +0000 (21:59 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 25 Oct 2010 18:59:25 +0000 (21:59 +0300)
Indicate the reason for the failure when wps_er_pbc is rejected.

src/wps/wps_er.c
wpa_supplicant/ctrl_iface.c

index df556722d71c4ed8bcf68f590d9791ceb7657e2a..0d0100d0cd905b7d708b9c3ca2f6df74987cefe4 100644 (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;
index a67eb36edb3815a84dff6471a631f16d9901a623..8a2395abdb33ec3d79d75adc2158ae4cfe325e74 100644 (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))