PMKSA: Flush AP/mesh PMKSA cache by PMKSA_FLUSH command
[mech_eap.git] / src / ap / ctrl_iface_ap.c
index 72ed9ff..317b238 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Control interface for shared AP commands
- * Copyright (c) 2004-2013, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -10,7 +10,9 @@
 
 #include "utils/common.h"
 #include "common/ieee802_11_defs.h"
+#include "common/sae.h"
 #include "eapol_auth/eapol_auth_sm.h"
+#include "fst/fst_ctrl_iface.h"
 #include "hostapd.h"
 #include "ieee802_1x.h"
 #include "wpa_auth.h"
@@ -20,6 +22,7 @@
 #include "p2p_hostapd.h"
 #include "ctrl_iface_ap.h"
 #include "ap_drv_ops.h"
+#include "mbo_ap.h"
 
 
 static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
@@ -33,7 +36,7 @@ static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
                return 0;
 
        ret = os_snprintf(buf, buflen, "rx_packets=%lu\ntx_packets=%lu\n"
-                         "rx_bytes=%lu\ntx_bytes=%lu\n",
+                         "rx_bytes=%llu\ntx_bytes=%llu\n",
                          data.rx_packets, data.tx_packets,
                          data.rx_bytes, data.tx_bytes);
        if (os_snprintf_error(buflen, ret))
@@ -143,6 +146,35 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
        len += hostapd_get_sta_tx_rx(hapd, sta, buf + len, buflen - len);
        len += hostapd_get_sta_conn_time(sta, buf + len, buflen - len);
 
+#ifdef CONFIG_SAE
+       if (sta->sae && sta->sae->state == SAE_ACCEPTED) {
+               res = os_snprintf(buf + len, buflen - len, "sae_group=%d\n",
+                                 sta->sae->group);
+               if (!os_snprintf_error(buflen - len, res))
+                       len += res;
+       }
+#endif /* CONFIG_SAE */
+
+       if (sta->vlan_id > 0) {
+               res = os_snprintf(buf + len, buflen - len, "vlan_id=%d\n",
+                                 sta->vlan_id);
+               if (!os_snprintf_error(buflen - len, res))
+                       len += res;
+       }
+
+       res = mbo_ap_get_info(sta, buf + len, buflen - len);
+       if (res >= 0)
+               len += res;
+
+       if (sta->supp_op_classes &&
+           buflen - len > (unsigned) (17 + 2 * sta->supp_op_classes[0])) {
+               len += os_snprintf(buf + len, buflen - len, "supp_op_classes=");
+               len += wpa_snprintf_hex(buf + len, buflen - len,
+                                       sta->supp_op_classes + 1,
+                                       sta->supp_op_classes[0]);
+               len += os_snprintf(buf + len, buflen - len, "\n");
+       }
+
        return len;
 }
 
@@ -189,7 +221,10 @@ int hostapd_ctrl_iface_sta(struct hostapd_data *hapd, const char *txtaddr,
                return -1;
        }
 
-       return hostapd_ctrl_iface_sta_mib(hapd, sta, buf, buflen);
+       ret = hostapd_ctrl_iface_sta_mib(hapd, sta, buf, buflen);
+       ret += fst_ctrl_iface_mb_info(addr, buf + ret, buflen - ret);
+
+       return ret;
 }
 
 
@@ -527,3 +562,22 @@ int hostapd_parse_csa_settings(const char *pos,
 
        return 0;
 }
+
+
+int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
+{
+       return hostapd_drv_stop_ap(hapd);
+}
+
+
+int hostapd_ctrl_iface_pmksa_list(struct hostapd_data *hapd, char *buf,
+                                 size_t len)
+{
+       return wpa_auth_pmksa_list(hapd->wpa_auth, buf, len);
+}
+
+
+void hostapd_ctrl_iface_pmksa_flush(struct hostapd_data *hapd)
+{
+       wpa_auth_pmksa_flush(hapd->wpa_auth);
+}