]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Indicate if PMF was negotiated for the connection
authorJouni Malinen <j@w1.fi>
Sat, 24 Nov 2012 20:45:17 +0000 (22:45 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 24 Nov 2012 20:45:17 +0000 (22:45 +0200)
Add pmf=1/2 to wpa_supplicant STATUS command output to indicate that PMF
was negotiated for the connect (1 = optional in this BSS, 2 = required
in this BSS).

Signed-hostap: Jouni Malinen <j@w1.fi>

src/rsn_supp/wpa.c

index caf18fd22bbf9d81f3cc40df9442206853dd6788..eb1b1d95e1ef2a4bba0c7eea04600b34a524460c 100644 (file)
@@ -2376,6 +2376,22 @@ int wpa_sm_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
        if (ret < 0 || ret >= end - pos)
                return pos - buf;
        pos += ret;
+
+       if (sm->mfp != NO_MGMT_FRAME_PROTECTION && sm->ap_rsn_ie) {
+               struct wpa_ie_data rsn;
+               if (wpa_parse_wpa_ie_rsn(sm->ap_rsn_ie, sm->ap_rsn_ie_len, &rsn)
+                   >= 0 &&
+                   rsn.capabilities & (WPA_CAPABILITY_MFPR |
+                                       WPA_CAPABILITY_MFPC)) {
+                       ret = os_snprintf(pos, end - pos, "pmf=%d\n",
+                                         (rsn.capabilities &
+                                          WPA_CAPABILITY_MFPR) ? 2 : 1);
+                       if (ret < 0 || ret >= end - pos)
+                               return pos - buf;
+                       pos += ret;
+               }
+       }
+
        return pos - buf;
 }