Commit Graph

71 Commits

Author SHA1 Message Date
Rosen Penev a47609acbe iwd: remove unnecessary semicolons
Found with clang's -Wextra-semi-stmt
2020-04-08 21:02:15 -05:00
Andrew Zaborowski 264ab685ba ie: Add ie_tlv_extract_wfd_payload 2020-03-20 10:21:04 -05:00
Andrew Zaborowski 9ff1c4da3a cleanup: Remove extra empty lines 2020-03-17 15:35:22 -05:00
Torstein Husebø 759dbdd37f treewide: fix typos 2020-01-21 16:03:28 -06:00
Marcel Holtmann 152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
James Prestwood 6b8f566498 ie: reorder ie_parse_osen to fix uninitialized value
RSNE_ADVANCE could result in a jump to the done label where info would
be copied without being initialized.
2019-10-16 21:25:41 -05:00
James Prestwood 7b1e1497b7 ie: fix uninitialized rx/tx_nss values 2019-10-16 18:02:49 -05:00
Denis Kenzior 0c7751485d ie: Always include RSN Capabilities bytes 2019-09-11 15:28:10 -05:00
Denis Kenzior 8a0c148368 ie: Handle WPA1 elements with Capability fields 2019-09-05 21:13:10 -05:00
Henrik Stokseth 008fd6c87a ie: Fix WPA1 element parsing
The memset was done after setting the defaults when it should have been
done before.
2019-09-05 20:53:57 -05:00
James Prestwood 6088c06507 ie: add parser/builder for hotspot indication element
The parser fully parses the IE and returns the version, Domain ID,
and PPS MO ID. This is meant to be used with an IE in scan results.

The builder only takes the version number, and assumes DGAF disabled,
and no Domain ID or PPS MO ID.
2019-07-24 00:13:27 -05:00
James Prestwood 090ac03100 ie: expose vendor OUIs
In the same fashion as the WSC WFA OUI, ie.[ch] will now expose the
other vendor OUIs to avoid duplication across multiple files in IWD
as well as used in iwmon.
2019-07-15 12:42:22 -05:00
James Prestwood 8bcb8e870e ie: fix incorrect length check for hotspot indication
The length check was incorrectly assuming that PPS MO ID or
ANQP Domain ID would be present in the IE. Both these are optional
and without then the minimum length is 5 bytes, not 7.
2019-07-12 18:51:57 -05:00
James Prestwood ac933ad966 ie: add parsing/building for roaming consortium
Parses up to 3 (the max) roaming consortium OIs out of the roaming
consortium IE. If more OIs are available via ANQP the 'num_anqp_out'
value will be set to indicate how many more OIs are available.

Builds according to the hotspot 2.0 spec using the vendor specific
IE.
2019-07-12 14:02:18 -05:00
Andrew Zaborowski 3bd265e02f ie: Add ie_tlv_encapsulate_p2p_payload 2019-07-08 13:41:18 -05:00
Andrew Zaborowski 5cb07ff116 ie: Add ie_tlv_extract_p2p_payload 2019-07-08 13:37:47 -05:00
James Prestwood b09dbcd5ac ie: add parser/builder to handle OSEN
The OSEN AKM is nearly identical to the RSN IE, but differs slightly.
For one, OSEN is encapsulated into the vendor specific IE, and includes
the WFA OUI before the 'normal' RSN elements. OSEN also does not include
a WPA version, since its not technically WPA/WPA2.

Some of the RSN parsing was made common so both RSN/OSEN parsing could
use it.
2019-06-10 18:03:10 -05:00
James Prestwood 5d3b37e2e4 ie: add is_ie_wfa_ie
This checks if an IE tagged as vendor specific is a WiFi-Alliance
OUI. This is similar to how is_ie_wpa_ie works.
2019-06-07 16:15:09 -05:00
James Prestwood 2e0fed3d77 ie: add IE_RSN_AKM_SUITE_OSEN 2019-06-07 16:15:07 -05:00
James Prestwood 1accf534dc ie: allow 24 byte FTE MIC
FT over FILS-SHA384 uses a 24 byte FT MIC rather than the 16 byte MIC
used for all other AKMs. This change allows both the FT builder/parser
to handle both lengths of MIC. The mic length is now passed directly
into ie_parse_fast_bss_transition and ie_build_fast_bss_transition
2019-05-23 15:23:08 -05:00
James Prestwood d2e7d47c84 ie: fix ie_tlv_builder semantics
The TLV builder APIs were not very intuative, and in some (or all)
cases required access to the builder structure directly, either to
set the TLV buffer or to get the buffer at the end.

This change adds a new API, ie_tlv_builder_set_data, which both sets
the length for the current TLV and copies the TLV data in one go.
This will avoid the need for memcpy(ie_tlv_builder_get_data(...),...)

ie_tlv_builder_finalize was also changed to return a pointer to the
start of the build buffer. This will eliminate the need to access
builder.tlv after building the TLVs.

ie_tlv_builder_init was changed to take an optional buffer to hold
the TLV data. Passing NULL/0 will build the TLV in the internal
buffer. Passing in a pointer and length will build into the passed
in buffer.
2019-04-23 12:56:20 -05:00
James Prestwood a2e711faf4 ie: crypto: add FILS AKMs
ie_rsn_info had to be updated to allow for 32 bit AKM values rather than
16 bit.
2019-04-04 16:11:07 -05:00
James Prestwood 62748e567d ie: remove 80+80 column in vht_width_map
For simplicity 160Mhz and 80+80Mhz were grouped together when
parsing the VHT capabilities, but the 80+80 bits were left in
vht_widht_map. This could cause an overflow when getting the
width map.
2019-03-22 17:48:43 -05:00
James Prestwood 49b02907a8 ie: scan: use VHT rates in scan ranking
This adds support for parsing the VHT IE, which allows a BSS supporting
VHT (80211ac) to be ranked higher than a BSS supporting only HT/basic
rates. Now, with basic/HT/VHT parsing we can calculate the theoretical
maximum data rate for all three and rank the BSS based on that.
2019-02-25 15:07:41 -06:00
James Prestwood ad2bf340a4 ie: scan: use HT rates in scan ranking
This adds HT IE parsing and data rate calculation for HT (80211n)
rates. Now, a BSS supporting HT rates will be ranked higher than
a basic rate BSS, assuming the RSSI is at an acceptable level.
2019-02-25 11:52:58 -06:00
James Prestwood 5ce6e173ba ie: make rate_rssi_map const 2019-02-25 11:47:54 -06:00
James Prestwood 7d7fcff03b ie: scan: take into account RSSI when parsing data rate
The spec dictates RSSI thresholds for different modulation schemes, which
correlate to different data rates. Until now were were ranking a BSS with
only looking at its advertised data rate, which may not even be possible
if the RSSI does not meet the threshold.

Now, RSSI is taken into consideration and the data rate returned from
parsing (Ext) Supported Rates IE(s) will reflect that.
2019-02-22 17:44:06 -06:00
James Prestwood 3293bd9933 ie: add OWE AKM type
Added a new AKM suite, IE_RSN_AKM_SUITE_OWE.
2018-11-16 16:59:45 -06:00
Patrik Flykt 7ec8fd6776 ie: Fix up broken Access Point with too many rates added
According to the specification, Supported rates IE is supposed
to have a maximum length of eight rate bytes. In the wild an
Access Point is found to add 12 bytes of data instead of placing
excess rate bytes in an Extended Rates IE.

BSS: len 480
    BSSID 44:39:C4:XX:XX:XX
    Probe Response: true
    TSF: 0 (0x0000000000000000)
    IEs: len 188
...
        Supported rates:
            1.0(B) 2.0(B) 5.5(B) 6.0(B) 9.0 11.0(B) 12.0(B) 18.0 Mbit/s
            24.0(B) 36.0 48.0 54.0 Mbit/s
            82 84 8b 8c 12 96 98 24 b0 48 60 6c              .......$.H`l
        DSSS parameter set: channel 3
            03
...

Any following IEs decode nicely, thus it seems that we can relax
Supported Rates IE length handling to support this thermostat.
2018-11-05 12:07:22 -06:00
Marcel Holtmann 23a7fafec6 ie: Use full include path for local includes 2018-10-26 21:26:17 +02:00
Denis Kenzior 46a797043a ie: Add AKMs from 802.11-2016 2018-07-19 11:09:08 -05:00
Denis Kenzior c4a2654703 ie: Split RSN & WPA akm suite builders 2018-07-19 10:56:46 -05:00
Denis Kenzior 438af4aebc ie: Don't fail RSNE parsing with unknown AKMs 2018-07-19 10:36:18 -05:00
Andrew Zaborowski 025d8dad44 ie: Allow building an empty IE sequence in ie_tlv_builder_finalize
Since we use the special 0xffff value in the builder code, check that
the tag is not 0xffff in ie_tlv_builder_finalize before writing the
header.  This is for consistency, not for a specific use case.
2017-09-22 11:59:06 -05:00
Andrew Zaborowski 5d8cb6260f ie: Handle Extended Element IDs
Make parsing TLVs using Extended Element IDs easier by returning the
extended tag value as listed in enum ie_type instead of just the 255
value, and not returning the pointer to the extended tag as the IE data
and instead the pointer to the next byte after the extended ID.
2017-09-22 11:55:47 -05:00
Andrew Zaborowski b344d27c56 ie: Fix Supported Rates length check
Supported Rates IEs can be 1-8 bytes, not only 8 byte long, according to
802.11-2012 8.4.2.3.
2017-08-15 13:57:27 -05:00
Andrew Zaborowski 9ceca7a521 ie: Parse GTK and IGTK subelements in FTE
Parse the contents of the GTK and IGTK subelements in an FT IE instead
of working with buffers containing the whole subelement.  Some more
validation of the subelement contents.  Drop support for GTK / IGTK when
building the FTE (unused).
2017-02-01 10:02:14 -06:00
Andrew Zaborowski 1b99521e98 ie: Implement ie_parse_neighbor_report 2016-11-03 09:59:49 -05:00
Andrew Zaborowski e4c168cc3b ie: Fast BSS Transition IE utilities 2016-10-29 22:53:14 -05:00
Andrew Zaborowski b20f1a2d50 ie: Mobility Domain IE utilities 2016-10-28 11:28:21 -05:00
Andrew Zaborowski 955c88a64a ie: Consistently set group_management_cipher
RSNE_ADVANCE may return and if it is before the assignment of
info.group_management_cipher, that assignment will be dependent on where
the RSNE ends.
2016-09-05 23:10:29 -05:00
Andrew Zaborowski 316752c5e4 ie: Error in tlv_iter_next if no space to length byte
When parsing the EAPoL-Key key data field we don't strip the 0xdd /
0x00 padding from the decrypted data so there may be trailing padding
after the IE sequence and valgrind will report an invalid read of the
length byte.  Same thing may happen if we're sent garbage.
2016-09-05 23:00:01 -05:00
Denis Kenzior 8261dab46b ie: Add ie_tlv_encapsulate_wsc_payload 2015-09-10 22:30:43 -05:00
Denis Kenzior c2aa596dd4 ie: Tweak function signature 2015-09-10 22:29:58 -05:00
Denis Kenzior 3442736869 ie: add ie_tlv_extract_wsc_payload 2015-07-09 14:20:10 -05:00
Denis Kenzior 7cded805ce ie: Add [extended] supported rates parser 2015-06-10 16:28:12 -05:00
Denis Kenzior baa97b13e9 ie: Add BSS Load parser 2015-06-10 10:39:33 -05:00
Denis Kenzior d4cdd74ae0 ie: Add ie_rsn_cipher_suite_to_cipher 2015-05-21 20:58:42 -05:00
Denis Kenzior 29a89d2a8b ie: There can be only one group_cipher
So the use of & operation is unneeded.  A more correct way is to use the
equals operator.
2015-03-16 12:12:59 -05:00
Denis Kenzior 8c172f4ec1 ie: Group comments together with relevant code 2015-03-16 12:10:43 -05:00