WPS UPnP: Throttle WLANEvent notifications to 5 per second
[libeap.git] / hostapd / ctrl_iface.c
index 1886b77..af83b8d 100644 (file)
@@ -519,7 +519,7 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
                return pos - buf;
        pos += ret;
 
-       if (hapd->conf->wps_state &&
+       if (hapd->conf->wps_state && hapd->conf->wpa &&
            hapd->conf->ssid.wpa_passphrase) {
                ret = os_snprintf(pos, end - pos, "passphrase=%s\n",
                                  hapd->conf->ssid.wpa_passphrase);
@@ -528,7 +528,8 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
                pos += ret;
        }
 
-       if (hapd->conf->wps_state && hapd->conf->ssid.wpa_psk &&
+       if (hapd->conf->wps_state && hapd->conf->wpa &&
+           hapd->conf->ssid.wpa_psk &&
            hapd->conf->ssid.wpa_psk->group) {
                char hex[PMK_LEN * 2 + 1];
                wpa_snprintf_hex(hex, sizeof(hex),
@@ -593,12 +594,13 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
                pos += ret;
        }
 
-       if (hapd->conf->wpa_group == WPA_CIPHER_CCMP) {
+       if (hapd->conf->wpa && hapd->conf->wpa_group == WPA_CIPHER_CCMP) {
                ret = os_snprintf(pos, end - pos, "group_cipher=CCMP\n");
                if (ret < 0 || ret >= end - pos)
                        return pos - buf;
                pos += ret;
-       } else if (hapd->conf->wpa_group == WPA_CIPHER_TKIP) {
+       } else if (hapd->conf->wpa &&
+                  hapd->conf->wpa_group == WPA_CIPHER_TKIP) {
                ret = os_snprintf(pos, end - pos, "group_cipher=TKIP\n");
                if (ret < 0 || ret >= end - pos)
                        return pos - buf;
@@ -710,6 +712,7 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
        char *reply;
        const int reply_size = 4096;
        int reply_len;
+       int level = MSG_DEBUG;
 
        res = recvfrom(sock, buf, sizeof(buf) - 1, 0,
                       (struct sockaddr *) &from, &fromlen);
@@ -718,7 +721,9 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
                return;
        }
        buf[res] = '\0';
-       wpa_hexdump_ascii(MSG_DEBUG, "RX ctrl_iface", (u8 *) buf, res);
+       if (os_strcmp(buf, "PING") == 0)
+               level = MSG_EXCESSIVE;
+       wpa_hexdump_ascii(level, "RX ctrl_iface", (u8 *) buf, res);
 
        reply = os_malloc(reply_size);
        if (reply == NULL) {