Passive Client Taxonomy
[mech_eap.git] / hostapd / ctrl_iface.c
index db9e0b0..d7db4a7 100644 (file)
@@ -1591,8 +1591,8 @@ static u16 ipv4_hdr_checksum(const void *buf, size_t len)
 #define HWSIM_PACKETLEN 1500
 #define HWSIM_IP_LEN (HWSIM_PACKETLEN - sizeof(struct ether_header))
 
-void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf,
-                         size_t len)
+static void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf,
+                                size_t len)
 {
        struct hostapd_data *hapd = ctx;
        const struct ether_header *eth;
@@ -2040,6 +2040,9 @@ static int hostapd_ctrl_iface_track_sta_list(struct hostapd_data *hapd,
        struct hostapd_sta_info *info;
        struct os_reltime now;
 
+       if (!iface->num_sta_seen)
+               return 0;
+
        sta_track_expire(iface, 0);
 
        pos = buf;
@@ -2078,7 +2081,7 @@ static int hostapd_ctrl_iface_req_lci(struct hostapd_data *hapd,
 }
 
 
-int hostapd_ctrl_iface_req_range(struct hostapd_data *hapd, char *cmd)
+static int hostapd_ctrl_iface_req_range(struct hostapd_data *hapd, char *cmd)
 {
        u8 addr[ETH_ALEN];
        char *token, *context = NULL;
@@ -2254,6 +2257,34 @@ static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
 }
 
 
+static int hostapd_ctrl_driver_flags(struct hostapd_iface *iface, char *buf,
+                                    size_t buflen)
+{
+       int ret, i;
+       char *pos, *end;
+
+       ret = os_snprintf(buf, buflen, "%016llX:\n",
+                         (long long unsigned) iface->drv_flags);
+       if (os_snprintf_error(buflen, ret))
+               return -1;
+
+       pos = buf + ret;
+       end = buf + buflen;
+
+       for (i = 0; i < 64; i++) {
+               if (iface->drv_flags & (1LLU << i)) {
+                       ret = os_snprintf(pos, end - pos, "%s\n",
+                                         driver_flag_to_string(1LLU << i));
+                       if (os_snprintf_error(end - pos, ret))
+                               return -1;
+                       pos += ret;
+               }
+       }
+
+       return pos - buf;
+}
+
+
 static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                              char *buf, char *reply,
                                              int reply_size,
@@ -2336,6 +2367,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
        } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
                if (hostapd_ctrl_iface_disassociate(hapd, buf + 13))
                        reply_len = -1;
+#ifdef CONFIG_TAXONOMY
+       } else if (os_strncmp(buf, "SIGNATURE ", 10) == 0) {
+               reply_len = hostapd_ctrl_iface_signature(hapd, buf + 10,
+                                                        reply, reply_size);
+#endif /* CONFIG_TAXONOMY */
        } else if (os_strncmp(buf, "POLL_STA ", 9) == 0) {
                if (hostapd_ctrl_iface_poll_sta(hapd, buf + 9))
                        reply_len = -1;
@@ -2510,6 +2546,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
        } else if (os_strncmp(buf, "REQ_RANGE ", 10) == 0) {
                if (hostapd_ctrl_iface_req_range(hapd, buf + 10))
                        reply_len = -1;
+       } else if (os_strcmp(buf, "DRIVER_FLAGS") == 0) {
+               reply_len = hostapd_ctrl_driver_flags(hapd->iface, reply,
+                                                     reply_size);
        } else {
                os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
                reply_len = 16;