WPS: Add MAC address to validation error message for Probe Request
[libeap.git] / src / ap / wps_hostapd.c
index 6b7c492..f1ad1df 100644 (file)
@@ -529,6 +529,23 @@ static const u8 * get_own_uuid(struct hostapd_iface *iface)
 }
 
 
+static int count_interface_cb(struct hostapd_iface *iface, void *ctx)
+{
+       int *count= ctx;
+       (*count)++;
+       return 0;
+}
+
+
+static int interface_count(struct hostapd_iface *iface)
+{
+       int count = 0;
+       iface->for_each_interface(iface->interfaces, count_interface_cb,
+                                 &count);
+       return count;
+}
+
+
 int hostapd_init_wps(struct hostapd_data *hapd,
                     struct hostapd_bss_config *conf)
 {
@@ -688,10 +705,13 @@ int hostapd_init_wps(struct hostapd_data *hapd,
                conf->skip_cred_build;
        if (conf->ssid.security_policy == SECURITY_STATIC_WEP)
                cfg.static_wep_only = 1;
+       cfg.dualband = interface_count(hapd->iface) > 1;
+       if (cfg.dualband)
+               wpa_printf(MSG_DEBUG, "WPS: Dualband AP");
 
        wps->registrar = wps_registrar_init(wps, &cfg);
        if (wps->registrar == NULL) {
-               printf("Failed to initialize WPS Registrar\n");
+               wpa_printf(MSG_ERROR, "Failed to initialize WPS Registrar");
                os_free(wps->network_key);
                os_free(wps);
                return -1;
@@ -861,7 +881,7 @@ static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
        wps_ie = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA);
        if (wps_ie == NULL)
                return 0;
-       if (wps_validate_probe_req(wps_ie) < 0) {
+       if (wps_validate_probe_req(wps_ie, addr) < 0) {
                wpabuf_free(wps_ie);
                return 0;
        }