tests: AP tracking STA taxonomy
[mech_eap.git] / wlantest / sta.c
index 4b5d16d..1268b8a 100644 (file)
@@ -1,15 +1,9 @@
 /*
  * STA list
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2010-2015, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #include "utils/includes.h"
@@ -88,6 +82,14 @@ void sta_update_assoc(struct wlantest_sta *sta, struct ieee802_11_elems *elems)
                elems->rsn_ie = NULL;
        }
 
+       if (elems->osen && !bss->osenie[0]) {
+               wpa_printf(MSG_INFO, "OSEN IE included in Association Request "
+                          "frame from " MACSTR " even though BSS does not "
+                          "use OSEN - ignore IE",
+                          MAC2STR(sta->addr));
+               elems->osen = NULL;
+       }
+
        if (elems->wpa_ie && elems->rsn_ie) {
                wpa_printf(MSG_INFO, "Both WPA IE and RSN IE included in "
                           "Association Request frame from " MACSTR,
@@ -114,6 +116,15 @@ void sta_update_assoc(struct wlantest_sta *sta, struct ieee802_11_elems *elems)
                        wpa_printf(MSG_INFO, "Failed to parse WPA IE from "
                                   MACSTR, MAC2STR(sta->addr));
                }
+       } else if (elems->osen) {
+               wpa_hexdump(MSG_DEBUG, "OSEN IE", elems->osen - 2,
+                           elems->osen_len + 2);
+               os_memcpy(sta->osenie, elems->osen - 2, elems->osen_len + 2);
+               sta->proto = WPA_PROTO_OSEN;
+               sta->pairwise_cipher = WPA_CIPHER_CCMP;
+               sta->key_mgmt = WPA_KEY_MGMT_OSEN;
+               sta->rsn_capab = 0;
+               goto skip_rsn_wpa;
        } else {
                sta->rsnie[0] = 0;
                sta->proto = 0;
@@ -157,18 +168,24 @@ void sta_update_assoc(struct wlantest_sta *sta, struct ieee802_11_elems *elems)
 
 skip_rsn_wpa:
        wpa_printf(MSG_INFO, "STA " MACSTR
-                  " proto=%s%s%s"
-                  "pairwise=%s%s%s%s"
-                  "key_mgmt=%s%s%s%s%s%s%s%s"
+                  " proto=%s%s%s%s"
+                  "pairwise=%s%s%s%s%s%s%s"
+                  "key_mgmt=%s%s%s%s%s%s%s%s%s%s%s"
                   "rsn_capab=%s%s%s%s%s",
                   MAC2STR(sta->addr),
                   sta->proto == 0 ? "OPEN " : "",
                   sta->proto & WPA_PROTO_WPA ? "WPA " : "",
                   sta->proto & WPA_PROTO_RSN ? "WPA2 " : "",
+                  sta->proto & WPA_PROTO_OSEN ? "OSEN " : "",
                   sta->pairwise_cipher == 0 ? "N/A " : "",
                   sta->pairwise_cipher & WPA_CIPHER_NONE ? "NONE " : "",
                   sta->pairwise_cipher & WPA_CIPHER_TKIP ? "TKIP " : "",
                   sta->pairwise_cipher & WPA_CIPHER_CCMP ? "CCMP " : "",
+                  bss->pairwise_cipher & WPA_CIPHER_CCMP_256 ? "CCMP-256 " :
+                  "",
+                  bss->pairwise_cipher & WPA_CIPHER_GCMP ? "GCMP " : "",
+                  bss->pairwise_cipher & WPA_CIPHER_GCMP_256 ? "GCMP-256 " :
+                  "",
                   sta->key_mgmt == 0 ? "N/A " : "",
                   sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X ? "EAP " : "",
                   sta->key_mgmt & WPA_KEY_MGMT_PSK ? "PSK " : "",
@@ -179,6 +196,11 @@ skip_rsn_wpa:
                   "EAP-SHA256 " : "",
                   sta->key_mgmt & WPA_KEY_MGMT_PSK_SHA256 ?
                   "PSK-SHA256 " : "",
+                  sta->key_mgmt & WPA_KEY_MGMT_OSEN ? "OSEN " : "",
+                  sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B ?
+                  "EAP-SUITE-B " : "",
+                  sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 ?
+                  "EAP-SUITE-B-192 " : "",
                   sta->rsn_capab & WPA_CAPABILITY_PREAUTH ? "PREAUTH " : "",
                   sta->rsn_capab & WPA_CAPABILITY_NO_PAIRWISE ?
                   "NO_PAIRWISE " : "",