]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Indicate if BIGTK has been set in STATUS output
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 11 Jul 2024 20:14:02 +0000 (23:14 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 11 Jul 2024 20:14:02 +0000 (23:14 +0300)
The new "bigtk_set=1" entry in the control interface STATUS command
output indicates that a BIGTK has been successfully configured. This
shows that beacon protection has been enabled for the current
association.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant_i.h
wpa_supplicant/wpas_glue.c

index acc6ab52400b3e1007ab56d860857eb94cb51bc1..f939583c49117d319c4b6c650e39f29e334365d8 100644 (file)
@@ -2575,6 +2575,13 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
                pos += ret;
        }
 
+       if (wpa_s->bigtk_set) {
+               ret = os_snprintf(pos, end - pos, "bigtk_set=1\n");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+
 #ifdef ANDROID
        /*
         * Allow using the STATUS command with default behavior, say for debug,
index e8b7eea1169e90448be863246aa521c70944c1e6..49917f7aaf7233edd6b8f43d21f0de9e5da4d7c8 100644 (file)
@@ -434,6 +434,7 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
 #endif /* CONFIG_SME */
 
        wpa_s->ssid_verified = false;
+       wpa_s->bigtk_set = false;
 }
 
 
@@ -3371,6 +3372,7 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
 
        wpa_dbg(wpa_s, MSG_DEBUG, "Association info event");
        wpa_s->ssid_verified = false;
+       wpa_s->bigtk_set = false;
 #ifdef CONFIG_SAE
 #ifdef CONFIG_SME
        /* SAE H2E binds the SSID into PT and that verifies the SSID
index 13406881de7e1d7a7eebb73baa207b8d6e352e5a..6ebd1846704f86d6793523bfd59f38ae152824d5 100644 (file)
@@ -1611,6 +1611,7 @@ struct wpa_supplicant {
 #endif /* CONFIG_NAN_USD */
 
        bool ssid_verified;
+       bool bigtk_set;
 };
 
 
index 9b68d07c6a6fa00641a17b41582aac27447f765b..5199f950bb478d0b289792cfdc258e2fa8016e92 100644 (file)
@@ -534,6 +534,8 @@ static int wpa_supplicant_set_key(void *_wpa_s, int link_id, enum wpa_alg alg,
                                  enum key_flag key_flag)
 {
        struct wpa_supplicant *wpa_s = _wpa_s;
+       int ret;
+
        if (alg == WPA_ALG_TKIP && key_idx == 0 && key_len == 32) {
                /* Clear the MIC error counter when setting a new PTK. */
                wpa_s->mic_errors_seen = 0;
@@ -556,8 +558,14 @@ static int wpa_supplicant_set_key(void *_wpa_s, int link_id, enum wpa_alg alg,
                wpa_s->last_tk_len = key_len;
        }
 #endif /* CONFIG_TESTING_OPTIONS */
-       return wpa_drv_set_key(wpa_s, link_id, alg, addr, key_idx, set_tx, seq,
-                              seq_len, key, key_len, key_flag);
+
+       ret = wpa_drv_set_key(wpa_s, link_id, alg, addr, key_idx, set_tx, seq,
+                             seq_len, key, key_len, key_flag);
+       if (ret == 0 && (key_idx == 6 || key_idx == 7) &&
+           alg != WPA_ALG_NONE && key_len > 0)
+               wpa_s->bigtk_set = true;
+
+       return ret;
 }