Make IEEE 802.11 IE parser aware of P2P IE
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 18 Jul 2010 21:30:24 +0000 (14:30 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:16 +0000 (07:17 -0700)
This does not handle fragmented IEs and is only used to check quickly
whether the IE blob includes any P2P IE(s).

src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index dc88568..d9dfb70 100644 (file)
@@ -96,6 +96,22 @@ static int ieee802_11_parse_vendor_specific(const u8 *pos, size_t elen,
                }
                break;
 
+       case OUI_WFA:
+               switch (pos[3]) {
+               case P2P_OUI_TYPE:
+                       /* Wi-Fi Alliance - P2P IE */
+                       elems->p2p = pos;
+                       elems->p2p_len = elen;
+                       break;
+               default:
+                       wpa_printf(MSG_MSGDUMP, "Unknown WFA "
+                                  "information element ignored "
+                                  "(type=%d len=%lu)\n",
+                                  pos[3], (unsigned long) elen);
+                       return -1;
+               }
+               break;
+
        case OUI_BROADCOM:
                switch (pos[3]) {
                case VENDOR_HT_CAPAB_OUI_TYPE:
index 4a4f5a7..406c13a 100644 (file)
@@ -40,6 +40,7 @@ struct ieee802_11_elems {
        const u8 *ht_capabilities;
        const u8 *ht_operation;
        const u8 *vendor_ht_cap;
+       const u8 *p2p;
 
        u8 ssid_len;
        u8 supp_rates_len;
@@ -64,6 +65,7 @@ struct ieee802_11_elems {
        u8 ht_capabilities_len;
        u8 ht_operation_len;
        u8 vendor_ht_cap_len;
+       u8 p2p_len;
 };
 
 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;