]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Calculate defragmented FTE length during IE parsing
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 25 Aug 2023 19:08:44 +0000 (22:08 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 28 Aug 2023 10:25:07 +0000 (13:25 +0300)
Get rid of the warning about unrecognized Fragment element when FTE is
fragmented and make the total length of the FTE itself and the following
Fragment elements available. For now, use a separate variable for the
total length to avoid confusing existing callers.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index a8f16b3d114cd890f2e14b11140b5a8f6106274e..d603f2633ac6f68edf9d7367c6bc96513259f99e 100644 (file)
@@ -421,6 +421,7 @@ static ParseRes __ieee802_11_parse_elems(const u8 *start, size_t len,
        for_each_element(elem, start, len) {
                u8 id = elem->id, elen = elem->datalen;
                const u8 *pos = elem->data;
+               size_t *total_len = NULL;
 
                if (id == WLAN_EID_FRAGMENT && elems->num_frag_elems > 0) {
                        elems->num_frag_elems--;
@@ -504,6 +505,8 @@ static ParseRes __ieee802_11_parse_elems(const u8 *start, size_t len,
                                break;
                        elems->ftie = pos;
                        elems->ftie_len = elen;
+                       elems->fte_defrag_len = elen;
+                       total_len = &elems->fte_defrag_len;
                        break;
                case WLAN_EID_TIMEOUT_INTERVAL:
                        if (elen != 5)
@@ -649,6 +652,12 @@ static ParseRes __ieee802_11_parse_elems(const u8 *start, size_t len,
                                   id, elen);
                        break;
                }
+
+               if (elen == 255 && total_len)
+                       *total_len += ieee802_11_fragments_length(
+                               elems, pos + elen,
+                               (start + len) - (pos + elen));
+
        }
 
        if (!for_each_element_completed(elem, start, len)) {
index 785fe608a4c6091dc1d34d319e7db98d29066809..f8cede008485a2f036db35a30471e72818aaaceb 100644 (file)
@@ -174,6 +174,8 @@ struct ieee802_11_elems {
 
        struct mb_ies_info mb_ies;
 
+       size_t fte_defrag_len;
+
        /*
         * The number of fragment elements to be skipped after a known
         * fragmented element.