]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Indicate wifi_generation in wpa_supplicant STATUS output
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Feb 2019 20:24:16 +0000 (22:24 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 15 Feb 2019 00:09:41 +0000 (02:09 +0200)
This adds a wifi_generation=4/5/6 line to the STATUS output if the
driver reports (Re)Association Request frame and (Re)Association
Response frame information elements in the association or connection
event. Only the generations 4 (HT = 802.11n), 5 (VHT = 802.11ac), and 6
(HE = 802.11ax) are reported.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant_i.h

index a0db9e42f658ca9f1f1950aeea5d72e458cc2fc4..89c5d45e79670d2d34324ec4d30582b59ee13fe2 100644 (file)
@@ -2118,6 +2118,18 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
                        pos += ret;
                }
 
+               if (wpa_s->connection_set &&
+                   (wpa_s->connection_ht || wpa_s->connection_vht ||
+                    wpa_s->connection_he)) {
+                       ret = os_snprintf(pos, end - pos,
+                                         "wifi_generation=%u\n",
+                                         wpa_s->connection_he ? 6 :
+                                         (wpa_s->connection_vht ? 5 : 4));
+                       if (os_snprintf_error(end - pos, ret))
+                               return pos - buf;
+                       pos += ret;
+               }
+
 #ifdef CONFIG_AP
                if (wpa_s->ap_iface) {
                        pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
index 638a9ab038083b5d8ba2ca80e26a4cdf482b81b0..0e483ec1c0e56c13f9a6b7fc933789191df9a20b 100644 (file)
@@ -2409,6 +2409,26 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
                wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz",
                        data->assoc_info.freq);
 
+       wpa_s->connection_set = 0;
+       if (data->assoc_info.req_ies && data->assoc_info.resp_ies) {
+               struct ieee802_11_elems req_elems, resp_elems;
+
+               if (ieee802_11_parse_elems(data->assoc_info.req_ies,
+                                          data->assoc_info.req_ies_len,
+                                          &req_elems, 0) != ParseFailed &&
+                   ieee802_11_parse_elems(data->assoc_info.resp_ies,
+                                          data->assoc_info.resp_ies_len,
+                                          &resp_elems, 0) != ParseFailed) {
+                       wpa_s->connection_set = 1;
+                       wpa_s->connection_ht = req_elems.ht_capabilities &&
+                               resp_elems.ht_capabilities;
+                       wpa_s->connection_vht = req_elems.vht_capabilities &&
+                               resp_elems.vht_capabilities;
+                       wpa_s->connection_he = req_elems.he_capabilities &&
+                               resp_elems.he_capabilities;
+               }
+       }
+
        p = data->assoc_info.req_ies;
        l = data->assoc_info.req_ies_len;
 
index ee581e75657f791ec1f0ee5d24cbb2125d01d45f..760849a163ec59e2395a8afd76b471732134b225 100644 (file)
@@ -751,6 +751,10 @@ struct wpa_supplicant {
        unsigned int wnmsleep_used:1;
        unsigned int owe_transition_select:1;
        unsigned int owe_transition_search:1;
+       unsigned int connection_set:1;
+       unsigned int connection_ht:1;
+       unsigned int connection_vht:1;
+       unsigned int connection_he:1;
 
        struct os_reltime last_mac_addr_change;
        int last_mac_addr_style;