Commit Graph

36 Commits

Author SHA1 Message Date
Marcel Holtmann 152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
James Prestwood 9ec87acccf mpdu: expose mmpdu_header_len 2019-10-21 16:50:42 -05:00
Andrew Zaborowski 5a40c49c44 mpdu: Validate action frame minimum length
Action frames must at least have the Category byte
2019-07-08 13:42:22 -05:00
Denis Kenzior 8f9ed66bdd mpdu: Rework validate_mgmt_ies
802.11 mandates that IEs inside management frames are presented in a
given order.  However, in the real world, many APs seem to ignore the
rules and send their IEs in seemingly arbitrary order, especially when
it comes to VENDOR tags.  Change this function to no longer be strict in
enforcing the order.

Also, drop checking of rules specific to Probe Responses.  These will
have to be handled separately (most likely by the AP module) since
802.11-2016, Section 11.1.4.3.5 essentially allows just about anything.
2019-04-05 16:31:26 -05:00
Denis Kenzior 83af5b0170 mpdu: Drop unused argument 2019-04-05 16:29:59 -05:00
James Prestwood 8f3627646a mpdu: add auth algorithms for FILS 2019-04-05 12:07:37 -05:00
Denis Kenzior 995cbc7ad3 mpdu: relax IE ordering requirements 2019-02-07 10:44:09 -06:00
Denis Kenzior 30cf1aa376 mpdu: Fix buffer overflow reported by asan
==25412==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000421ab0 at pc 0x000000402faf bp 0x7fffffffdb00 sp 0x7fffffffdaf0
READ of size 4 at 0x000000421ab0 thread T0
    #0 0x402fae in validate_mgmt_ies src/mpdu.c:128
    #1 0x403ce8 in validate_probe_request_mmpdu src/mpdu.c:370
    #2 0x404ef2 in validate_mgmt_mpdu src/mpdu.c:662
    #3 0x405166 in mpdu_validate src/mpdu.c:706
    #4 0x402529 in ie_order_test unit/test-mpdu.c:156
    #5 0x418f49 in l_test_run ell/test.c:83
    #6 0x402715 in main unit/test-mpdu.c:171
    #7 0x7ffff5d43ed9 in __libc_start_main (/lib64/libc.so.6+0x20ed9)
    #8 0x4019a9 in _start (/home/denkenz/iwd-master/unit/test-mpdu+0x4019a9)
2019-01-11 11:43:21 -06:00
Marcel Holtmann 785be02ee5 mpdu: Use full include path local includes 2018-10-26 21:28:10 +02:00
Andrew Zaborowski 6418a23fd5 mpdu: Refactor Authentication frame validation
Validate the IE order for some of the cases.  For other cases, as with
the Disassociation, Deauthentication and Action frame types in section
9.3 it's not even clear from the spec the fields are expected to be IEs
(in fact for Action frame we know they aren't).  For the Shared Key
authentication type drop the union with the contents as they can be
easier parsed as an IE sequence.  For SAE we are not expecting an IE
sequence apparently so this is where the union could come useful but
let's leave that until we want to support SAE.
2017-09-22 12:18:06 -05:00
Andrew Zaborowski 736f611974 mpdu: Validate IE order for most frame subtypes
Check the IE order for each frame type where we'd just do the body
minimum length check until now (and not always correctly).  We do not
try to validate the contents of any IEs (may be doable for some) or the
minimum mandatory IEs presence.  This is because which IEs are required
depend on the contents of other fields in the frame, on the
authentication state and STA config and even contents of a request frame
which we're validating the response to.  Frame handlers have to do this
work anyway.
2017-09-22 12:12:06 -05:00
Andrew Zaborowski 58a7032ed9 mpdu: Don't report Action frames as invalid
Declare the two missing frame subtype enum values for Action frames,
assume Action frames are valid.  Once we have specific validation code
for any Action frames elsewhere, we can move it to mpdu_validate, but
right don't try to validate the frame body as there are many subtypes
and we don't use any of them except Neighbor Reports which are actually
really simple.
2017-09-22 12:06:02 -05:00
Denis Kenzior 023ba1ea32 mpdu: Fix error
src/mpdu.c: In function ‘mpdu_validate’:
src/mpdu.c:180:9: error: ‘mmpdu’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   mmpdu = (const struct mmpdu_header *) mmpdu;
         ^
2017-08-31 18:23:47 -05:00
Andrew Zaborowski 303683c89f mpdu: Refactor mpdu structs
Refactor management frame structures to take into account optional
presence of some parts of the header:
 * drop the single structure for management header and body since
   the body offset is variable.
 * add mmpdu_get_body to locate the start of frame body.
 * drop the union of different management frame type bodies.
 * prefix names specific to management frames with "mmpdu" instead
   of "mpdu" including any enums based on 802.11-2012 section 8.4.
 * move the FC field to the mmpdu_header structure.
2017-08-31 15:11:30 -05:00
Denis Kenzior 5247695d56 mpdu: fix transaction_sequence byte-ordering
transaction_sequence was not being considered in host CPU byte order
2015-01-22 12:41:10 -06:00
Denis Kenzior e60b814dc8 mpdu: algorithm was not swapped to host byte-order 2015-01-22 12:41:10 -06:00
Tomasz Bursztyka e02f02fa69 mpdu: Change the validation function signature
What comes in is a frame, and let's set it to uint8_t pointer, which is
semantically better than unsigned char.

Also, returning the cast pointer instead of a boolean is easier to
use as there won't be any need to perform the cast ourselves afterward
2015-01-22 12:14:47 -06:00
Tomasz Bursztyka 3d5fe2fddd mpdu: Validate beacon mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame
2015-01-21 14:31:26 -06:00
Tomasz Bursztyka 9ce1745ede mpdu: Validate timing advertisement mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame
2015-01-21 14:30:51 -06:00
Tomasz Bursztyka 8078f18c35 mpdu: Validate probe response mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame
2015-01-21 14:30:12 -06:00
Tomasz Bursztyka cc1cc64843 mpdu: Validate probe request mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame
2015-01-21 14:29:39 -06:00
Tomasz Bursztyka 142a6a8a0c mpdu: Validate reassociation response mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame
2015-01-21 14:29:05 -06:00
Tomasz Bursztyka efcaefc5dd mpdu: Validate reassociation request mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame.
2015-01-21 14:28:21 -06:00
Tomasz Bursztyka 8353ac445d mpdu: Validate association response mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame.
2015-01-21 14:28:14 -06:00
Tomasz Bursztyka 5c9f1db01f mpdu: Validate association request mpdu subtype
We do not currently validate the IEs that are following until the end
of the frame.
2015-01-21 14:28:07 -06:00
Tomasz Bursztyka d1c29daa24 mpdu: Validate disassociation mpdu subtype
These own a reason code which is currently the only interesting
information to handle. Let's skip the vendor specific ones for now.
2015-01-21 14:27:59 -06:00
Tomasz Bursztyka e106033fce mpdu: Validate ATIM mpdu subtype
ATIM management frames have an empty body.
2015-01-21 14:27:38 -06:00
Denis Kenzior c3aef948db mpdu: Update offset for authentication frames
Offset was not updated properly when validating authentication frames
2015-01-21 14:25:07 -06:00
Denis Kenzior b22f93203c mpdu: Rework to a zero-copy based framework 2014-12-17 17:44:44 -06:00
Denis Kenzior d7b6a36db8 mpdu: Rework structure definitions
The current setup was not endian safe
2014-12-17 16:22:06 -06:00
Denis Kenzior 3ef0ff1e1a mpdu: Fix invalid read
The cast was being done incorrectly resulting in invalid values being
obtained
2014-12-17 16:21:05 -06:00
Denis Kenzior ca742bb95d mpdu: Fix style 2014-12-16 16:57:30 -06:00
Denis Kenzior b0af0177ac mpdu: Replace for loop with memcpy 2014-12-16 14:26:33 -06:00
Denis Kenzior 61a44dd485 mpdu: Fix style 2014-12-16 14:23:36 -06:00
Denis Kenzior 6a011f0d92 mpdu: Simplify checks 2014-12-16 14:22:13 -06:00
Tomasz Bursztyka 805619fc9d core: Add the preliminary logic to parse 802.11 MPDUs
It currently focuses on parsing management frames, and specifically its
authentication and deauthentication frames.
2014-12-16 10:53:20 -06:00