mech_eap.git
9 years agoproxyarp: Use C library header files and CONFIG_IPV6
Jouni Malinen [Tue, 25 Nov 2014 14:58:21 +0000 (16:58 +0200)]
proxyarp: Use C library header files and CONFIG_IPV6

This replaces the use of Linux kernel header files (linux/ip.h,
linux/udp.h, linux/ipv6.h, and linux/icmpv6.h) with equivalent header
files from C library. In addition, ndisc_snoop.c is now built
conditionally on CONFIG_IPV6=y so that it is easier to handle hostapd
builds with toolchains that do not support IPv6 even if Hotspot 2.0 is
enabled in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSAE: Fix Anti-Clogging Token request frame format
Masashi Honma [Tue, 25 Nov 2014 02:04:41 +0000 (11:04 +0900)]
SAE: Fix Anti-Clogging Token request frame format

This commit inserts Finite Cyclic Group to Anti-Clogging Token request
frame because IEEE Std 802.11-2012, Table 8-29 says "Finite Cyclic Group
is present if Status is zero or 76".

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
9 years agomesh: Fix SAE anti-clogging functionality for mesh
Masashi Honma [Tue, 25 Nov 2014 02:04:40 +0000 (11:04 +0900)]
mesh: Fix SAE anti-clogging functionality for mesh

The mesh anti-clogging functionality is implemented partially. This
patch fixes to parse anti-clogging request frame and use anti-clogging
token.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
9 years agotests: Clear sae_groups to default value in forgotten cases
Jouni Malinen [Tue, 25 Nov 2014 13:19:19 +0000 (15:19 +0200)]
tests: Clear sae_groups to default value in forgotten cases

It was possible for some of the SAE test cases (e.g., ap_ft_sae) to fail
if they were run after the sae_groups test case that left the SAE group
configuration to a value that is not enabled by default. Fix this by
clearing sae_groups setting in the couple of test cases that were not
yet doing this.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WPA2-PSK with RADIUS for passphrase
Jouni Malinen [Mon, 24 Nov 2014 23:28:34 +0000 (01:28 +0200)]
tests: WPA2-PSK with RADIUS for passphrase

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSME: Fix a sign-compare warning
Jouni Malinen [Mon, 24 Nov 2014 23:07:16 +0000 (01:07 +0200)]
SME: Fix a sign-compare warning

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WNM BSS TM Req with non-global operating class table
Jouni Malinen [Mon, 24 Nov 2014 08:58:33 +0000 (10:58 +0200)]
tests: WNM BSS TM Req with non-global operating class table

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use country code, if available, to help in channel mapping
Jouni Malinen [Mon, 24 Nov 2014 08:57:38 +0000 (10:57 +0200)]
WNM: Use country code, if available, to help in channel mapping

The country code from the current AP needs to be used in
ieee80211_chan_to_freq() to support cases where non-global operating
class table is used.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPA: Use more explicit WPA/RSN selector count validation
Jouni Malinen [Sun, 23 Nov 2014 19:08:13 +0000 (21:08 +0200)]
WPA: Use more explicit WPA/RSN selector count validation

Some static analyzers had problems understanding "left < count * len"
(CID 62855, CID 62856), so convert this to equivalent "count > left /
len" (len here is fixed to 4, so this can be done efficiently).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS: Add explicit message length limit of 50000 bytes
Jouni Malinen [Sun, 23 Nov 2014 18:57:34 +0000 (20:57 +0200)]
WPS: Add explicit message length limit of 50000 bytes

Previously, this was implicitly limited by the 16-bit length field to
65535. This resulted in unhelpful static analyzer warnings (CID 62868).
Add an explicit (but pretty arbitrary) limit of 50000 bytes to avoid
this. The actual WSC messages are significantly shorter in practice, but
there is no specific protocol limit, so 50000 is as good as any limit to
use here.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPeerKey: Clean up EAPOL-Key Key Data processing on AP
Jouni Malinen [Sun, 23 Nov 2014 18:51:26 +0000 (20:51 +0200)]
PeerKey: Clean up EAPOL-Key Key Data processing on AP

This extends the earlier PeerKey station side design to be used on the
AP side as well by passing pointer and already validated length from the
caller rather than parsing the length again from the frame buffer. This
avoids false warnings from static analyzer (CID 62870, CID 62871,
CID 62872).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-IKEv2: Make proposal_len validation clearer
Jouni Malinen [Sun, 23 Nov 2014 18:39:52 +0000 (20:39 +0200)]
EAP-IKEv2: Make proposal_len validation clearer

Some static analyzers seem to have issues understanding "pos +
proposal_len > end" style validation, so convert this to "proposal_len >
end - pos" to make this more obvious to be bounds checking for
proposal_len. (CID 62874)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Make PAC file A_ID parser easier to analyze
Jouni Malinen [Sun, 23 Nov 2014 18:36:17 +0000 (20:36 +0200)]
EAP-FAST: Make PAC file A_ID parser easier to analyze

Some static analyzers seem to have issues with "pos + len > end"
validation (CID 62875), so convert this to "len > end - pos" to make it
more obvious that len is validated against its bounds.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Clean up binary PAC file parser validation steps
Jouni Malinen [Sun, 23 Nov 2014 18:31:08 +0000 (20:31 +0200)]
EAP-FAST: Clean up binary PAC file parser validation steps

This was too difficult for some static analyzers (CID 62876). In
addition, the pac_info_len assignment should really have explicitly
validated that there is room for the two octet length field instead of
trusting the following validation step to handle both this and the
actual pac_info_len bounds checking.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoradiotap: Initialize all members in ieee80211_radiotap_iterator_init()
Jouni Malinen [Sun, 23 Nov 2014 18:23:35 +0000 (20:23 +0200)]
radiotap: Initialize all members in ieee80211_radiotap_iterator_init()

_next_ns_data could look like it would be used uninitialized in
ieee80211_radiotap_iterator_next() to static analyzers. Avoid
unnecessary reports by explicitly initializing all variables in struct
ieee80211_radiotap_iterator. (CID 62878)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoGAS: Clean up Query Response length validation
Jouni Malinen [Sun, 23 Nov 2014 18:13:09 +0000 (20:13 +0200)]
GAS: Clean up Query Response length validation

Previous version was correct, but apparently too complex for some static
analyzers. (CID 68119)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0: Clarify OSU Server URI length validation
Jouni Malinen [Sun, 23 Nov 2014 18:04:29 +0000 (20:04 +0200)]
HS 2.0: Clarify OSU Server URI length validation

The previous version was valid, but apparently too complex for some
static analyzers. Use a local variable for uri_len and explicitly
compare it against the remaining buffer length. (CID 68121)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0: More explicit hs20_osu_icon_fetch() length validation
Jouni Malinen [Sun, 23 Nov 2014 16:55:06 +0000 (18:55 +0200)]
HS 2.0: More explicit hs20_osu_icon_fetch() length validation

The previous version was fine, but too much for some static analyzers to
understand as proper bounds checking. (CID 68122)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Make p2p_parse_p2p_ie() validation steps easier to analyze
Jouni Malinen [Sun, 23 Nov 2014 16:51:16 +0000 (18:51 +0200)]
P2P: Make p2p_parse_p2p_ie() validation steps easier to analyze

Validation was fine, but a bit too complex for some static analyzers to
understand. (CID 68125)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoUse more explicit num_pmkid validation in RSN IE parsing
Jouni Malinen [Sun, 23 Nov 2014 16:43:59 +0000 (18:43 +0200)]
Use more explicit num_pmkid validation in RSN IE parsing

Static analyzers may not have understood the bounds checking on
data->num_pmkid. Use a local, temporary variable and validate that that
value is within length limits before assining this to data->num_pmkid to
make this clearer. (CID 62857, CID 68126)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPCSC: Use clearer file TLV length validation step
Jouni Malinen [Sun, 23 Nov 2014 16:32:04 +0000 (18:32 +0200)]
PCSC: Use clearer file TLV length validation step

This makes it easier for static analyzer to confirm that the length
field bounds are checked. WPA_GET_BE16() is also used instead of
explicit byte-swapping operations in this file. (CID 68129)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use a clearer validation step for key_len_total
Jouni Malinen [Sun, 23 Nov 2014 16:04:02 +0000 (18:04 +0200)]
WNM: Use a clearer validation step for key_len_total

The previous one based on pointer arithmetic was apparently too much for
some static analyzers (CID 68130).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTLS client: Check DH parameters using a local variable
Jouni Malinen [Sun, 23 Nov 2014 15:48:34 +0000 (17:48 +0200)]
TLS client: Check DH parameters using a local variable

Use a temporary, local variable to check the DH parameters received from
the server before assigning the length to the struct tlsv1_client
variables. This will hopefully make it easier for static analyzers to
figure out that there is bounds checking for the value. (CID 72699)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoInterworking: Clearer ANQP element length validation
Jouni Malinen [Sun, 23 Nov 2014 15:13:47 +0000 (17:13 +0200)]
Interworking: Clearer ANQP element length validation

The upper bound for the element length was already verified, but that
was not apparently noticed by a static analyzer (CID 68128).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS client: Print a clear debug log entry if socket is not available
Jouni Malinen [Sun, 23 Nov 2014 15:06:24 +0000 (17:06 +0200)]
RADIUS client: Print a clear debug log entry if socket is not available

It could have been possible to select a socket that is not open
(sel_sock == -1) and try to use that in socket operations. This would
fail with potentially confusing error messages. Make this clearer by
printing a clear debug log entry on socket not being available.
(CID 72696)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoIKEv2: Use a bit clearer payload header validation step
Jouni Malinen [Sun, 23 Nov 2014 14:37:16 +0000 (16:37 +0200)]
IKEv2: Use a bit clearer payload header validation step

It looks like the "pos + plen > end" case was not clear enough for a
static analyzer to figure out that plen was being verified to not go
beyond the buffer. (CID 72687)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Print debug message if Action frame sending fails
Jouni Malinen [Sun, 23 Nov 2014 14:13:50 +0000 (16:13 +0200)]
WNM: Print debug message if Action frame sending fails

This makes wpa_drv_send_action() return value checking more consistent
(CID 75390).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: NEIGHBOR_REP_REQUEST failure cases
Jouni Malinen [Sat, 22 Nov 2014 19:49:45 +0000 (21:49 +0200)]
tests: NEIGHBOR_REP_REQUEST failure cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowpa_supplicant: Handle link measurement requests
Andrei Otcheretianski [Wed, 5 Nov 2014 08:42:56 +0000 (03:42 -0500)]
wpa_supplicant: Handle link measurement requests

Send link measurement response when a request is received. Advertise
only RCPI, computing it from the RSSI of the request. The TX power field
is left to be filled by the driver. All other fields are not published.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
9 years agonl80211: Register Link Measurement Request Action frame
Andrei Otcheretianski [Wed, 5 Nov 2014 08:42:55 +0000 (03:42 -0500)]
nl80211: Register Link Measurement Request Action frame

Add link measurement request to registration of Action frames to be
handled by wpa_supplicant if the driver supports TX power value
insertation.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
9 years agowpa_cli: Add optional ssid to neighbor report request
Assaf Krauss [Wed, 5 Nov 2014 08:42:54 +0000 (03:42 -0500)]
wpa_cli: Add optional ssid to neighbor report request

Add optional 'ssid' parameter to command "neighbor_rep_request".

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add an option to specify SSID in neighbor report requests
Assaf Krauss [Wed, 5 Nov 2014 08:42:53 +0000 (03:42 -0500)]
wpa_supplicant: Add an option to specify SSID in neighbor report requests

Allow supplying an SSID for the SSID IE. If not supplied, no SSID IE is
sent, and the request implies the current SSID.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_cli: Add neighbor_rep_request command
Assaf Krauss [Wed, 5 Nov 2014 08:42:52 +0000 (03:42 -0500)]
wpa_cli: Add neighbor_rep_request command

Add neighbor_rep_request command to send a Neighbor Report Request
to the associated AP.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add NEIGHBOR_REP_REQUEST command to the control interface
Assaf Krauss [Wed, 5 Nov 2014 08:42:51 +0000 (03:42 -0500)]
wpa_supplicant: Add NEIGHBOR_REP_REQUEST command to the control interface

Add NEIGHBOR_REP_REQUEST command to the wpa_supplicant ctrl_iface.
This command triggers the sending of a Neighbor Report Request to the
associated AP.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add support for Neighbor Report
Assaf Krauss [Wed, 5 Nov 2014 08:42:50 +0000 (03:42 -0500)]
wpa_supplicant: Add support for Neighbor Report

Add the ability to send a Neighbor Report Request (part of
RRM). Requester is then notified once the report arrives.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agonl80211: Register Neighbor Report Response Action frame
Assaf Krauss [Wed, 5 Nov 2014 08:42:49 +0000 (03:42 -0500)]
nl80211: Register Neighbor Report Response Action frame

Add Neighbor Report Response Action frame to registration of Action
frames to be handled by wpa_supplicant.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agoSME: Add RRM support to association request
Assaf Krauss [Wed, 5 Nov 2014 08:42:48 +0000 (03:42 -0500)]
SME: Add RRM support to association request

In case the AP we are associating with advertises support for RRM,
advertise our own RRM support in the (Re)Association Request frame. This
is done by adding an RRM Capabilities IE. The underlying driver is
expected to further add a Power Capabilities IE to the request, and set
the Radio Measurement flag in the Capability Info field. At this point
the RRM Capabilities IE advertises no measurement support.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Store driver's RRM capabilities
Assaf Krauss [Wed, 5 Nov 2014 08:42:47 +0000 (03:42 -0500)]
wpa_supplicant: Store driver's RRM capabilities

Store the RRM capability flags reported by the underlying driver.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agonl80211: Populate RRM flags in nl80211 driver
Assaf Krauss [Wed, 5 Nov 2014 08:42:46 +0000 (03:42 -0500)]
nl80211: Populate RRM flags in nl80211 driver

Set the RRM capability flags, based on the capabilities reported
by the underlying driver.

In addition, upon connection, notify the underlying driver regarding
RRM support.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agodriver: Add RRM-related definitions to driver interface
Assaf Krauss [Wed, 5 Nov 2014 08:42:45 +0000 (03:42 -0500)]
driver: Add RRM-related definitions to driver interface

Add definitions for RRM (Radio Resource Measurement) support:
1. Flags that specify the RRM capabilities of the underlying driver
2. Flag for RRM in Capability Info field in Management frames
3. Indication in association parameters regarding an RRM connection

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agotests: BSS Transition Management
Jouni Malinen [Sat, 22 Nov 2014 11:38:29 +0000 (13:38 +0200)]
tests: BSS Transition Management

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use recent scan results on BSS transition request
Jouni Malinen [Sat, 22 Nov 2014 18:12:12 +0000 (20:12 +0200)]
WNM: Use recent scan results on BSS transition request

If the last scans are recent (for now, less than ten seconds old), use
them instead of triggering a new scan when a BSS Transition Management
Request frame is received. As a fallback, allow a new scan to be
triggered if no matches were found.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Optimize BSS transition management scans
Jouni Malinen [Sat, 22 Nov 2014 17:50:16 +0000 (19:50 +0200)]
WNM: Optimize BSS transition management scans

When the list of preferred transition candidates is received, use the
identified channels to optimize the following scan so that no time is
wasted on other channels.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd generic operating class and channel to frequency function
Jouni Malinen [Sat, 22 Nov 2014 17:48:08 +0000 (19:48 +0200)]
Add generic operating class and channel to frequency function

ieee80211_chan_to_freq() is a generic function that replaces and extends
the previous P2P-specific p2p_channel_to_freq(). The new function
supports both the global operating class table as well as the additional
US, EU, JP, and CN operating class tables.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix a typo in function name
Jouni Malinen [Sat, 22 Nov 2014 16:30:16 +0000 (18:30 +0200)]
tests: Fix a typo in function name

except_ack() was supposed to be verifying that the frame was ACK'ed,
i.e., it was really supposed to be called expect_ack().

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix wnm_bss_tm_req status code expectation
Jouni Malinen [Sat, 22 Nov 2014 16:28:22 +0000 (18:28 +0200)]
tests: Fix wnm_bss_tm_req status code expectation

The implementation of WNM BSS transition management was extended to be
able to return a reject status code based on whether a matching entry is
found. The test case wnm_bss_tm_req was trying to enforce a different
status code to be used here based on old implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Move transition candidate list processing to normal scan
Jouni Malinen [Sat, 22 Nov 2014 16:04:21 +0000 (18:04 +0200)]
WNM: Move transition candidate list processing to normal scan

This makes it easier to optimize transition request processing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Fix TM candidate freeing if multiple requests are processed
Jouni Malinen [Sat, 22 Nov 2014 15:28:04 +0000 (17:28 +0200)]
WNM: Fix TM candidate freeing if multiple requests are processed

The previously cached candidate list needs to be free properly through a
call to wnm_deallocate_memory() to ensure all subelements gets freed.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Allow BSS transition request in same ESS even if RSSI is worse
Jouni Malinen [Sat, 22 Nov 2014 15:01:26 +0000 (17:01 +0200)]
WNM: Allow BSS transition request in same ESS even if RSSI is worse

This allows an AP to steer us to another BSS within the ESS even if that
results in reduced signal strength as long as the signal strength with
the target BSS is expected to provide some connectivity.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Mark wnm_scan_response() static
Jouni Malinen [Sat, 22 Nov 2014 14:37:40 +0000 (16:37 +0200)]
WNM: Mark wnm_scan_response() static

This function is not used outside wnm_sta.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Order BSS transmission candidate entries based on preference
Jouni Malinen [Sat, 22 Nov 2014 14:33:57 +0000 (16:33 +0200)]
WNM: Order BSS transmission candidate entries based on preference

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Simplify how candidate subelements are stored
Jouni Malinen [Sat, 22 Nov 2014 13:37:27 +0000 (15:37 +0200)]
WNM: Simplify how candidate subelements are stored

There is no need to use a separately allocated data structures for this.
A bitfield indicating which information is present and variables within
struct neighbor_report are simpler to use and more efficient.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Calculate valid-until time for transition candidate list
Jouni Malinen [Sat, 22 Nov 2014 11:54:08 +0000 (13:54 +0200)]
WNM: Calculate valid-until time for transition candidate list

This is of more use than the raw validity interval (number of beacon
intervals) that was recorded previously.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Convert BSSID Info into a u32
Jouni Malinen [Sat, 22 Nov 2014 11:43:17 +0000 (13:43 +0200)]
WNM: Convert BSSID Info into a u32

This is more convenient to use than u8 array.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Debug print WNM BSS Transition Candidate List
Jouni Malinen [Sat, 22 Nov 2014 11:38:11 +0000 (13:38 +0200)]
WNM: Debug print WNM BSS Transition Candidate List

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd BSS-TM-RESP ctrl_iface event
Jouni Malinen [Sat, 22 Nov 2014 10:02:09 +0000 (12:02 +0200)]
Add BSS-TM-RESP ctrl_iface event

This event allows external monitors to track STA response to BSS
Transition Management Request.

BSS-TM-RESP <STA addr> status_code=<#> bss_termination_delay=<#>
[target_bssid=<BSSID>]

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd BSS_TM_REQ command to send BSS Transition Management Request
Jouni Malinen [Sat, 22 Nov 2014 09:31:03 +0000 (11:31 +0200)]
Add BSS_TM_REQ command to send BSS Transition Management Request

hostapd control interface can now be used to request transmission of a
BSS Transition Management Request frame to a specified station.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Authenticator processing for various EAPOL-Key key info values
Jouni Malinen [Fri, 21 Nov 2014 22:49:25 +0000 (00:49 +0200)]
tests: Authenticator processing for various EAPOL-Key key info values

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPA EAPOL 4-way handshake protocol testing
Jouni Malinen [Fri, 21 Nov 2014 22:34:20 +0000 (00:34 +0200)]
tests: WPA EAPOL 4-way handshake protocol testing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPA2 EAPOL-Key with incorrect type
Jouni Malinen [Fri, 21 Nov 2014 22:16:41 +0000 (00:16 +0200)]
tests: WPA2 EAPOL-Key with incorrect type

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd names for assigned QCA nl80211 vendor subcmds
Jouni Malinen [Fri, 21 Nov 2014 19:46:01 +0000 (21:46 +0200)]
Add names for assigned QCA nl80211 vendor subcmds

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Authenticator 4-way handshake protocol testing
Jouni Malinen [Fri, 21 Nov 2014 18:06:33 +0000 (20:06 +0200)]
tests: Authenticator 4-way handshake protocol testing

This implements minimal RSN 4-way handshake Supplicant in Python and
uses that to test hostapd Authenticator implementation in various
possible protocol sequencies.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAP: Extend EAPOL-Key msg 1/4 retry workaround for changing SNonce
Jouni Malinen [Fri, 21 Nov 2014 15:02:00 +0000 (17:02 +0200)]
AP: Extend EAPOL-Key msg 1/4 retry workaround for changing SNonce

If the 4-way handshake ends up having to retransmit the EAPOL-Key
message 1/4 due to a timeout on waiting for the response, it is possible
for the Supplicant to change SNonce between the first and second
EAPOL-Key message 2/4. This is not really desirable due to extra
complexities it causes on the Authenticator side, but some deployed
stations are doing this.

This message sequence looks like this:
AP->STA: EAPOL-Key 1/4 (replay counter 1, ANonce)
AP->STA: EAPOL-Key 1/4 (replay counter 2, ANonce)
STA->AP: EAPOL-Key 2/4 (replay counter 1, SNonce 1)
AP->STA: EAPOL-Key 3/4 (replay counter 3, ANonce)
STA->AP: EAPOL-Key 2/4 (replay counter 2, SNonce 2)
followed by either:
STA->AP: EAPOL-Key 4/4 (replay counter 3 using PTK from SNonce 1)
or:
AP->STA: EAPOL-Key 3/4 (replay counter 4, ANonce)
STA->AP: EAPOL-Key 4/4 (replay counter 4, using PTK from SNonce 2)

Previously, Authenticator implementation was able to handle the cases
where SNonce 1 and SNonce 2 were identifical (i.e., Supplicant did not
update SNonce which is the wpa_supplicant behavior) and where PTK
derived using SNonce 2 was used in EAPOL-Key 4/4. However, the case of
using PTK from SNonce 1 was rejected ("WPA: received EAPOL-Key 4/4
Pairwise with unexpected replay counter" since EAPOL-Key 3/4 TX and
following second EAPOL-Key 2/4 invalidated the Replay Counter that was
used previously with the first SNonce).

This commit extends the AP/Authenticator workaround to keep both SNonce
values in memory if two EAPOL-Key 2/4 messages are received with
different SNonce values. The following EAPOL-Key 4/4 message is then
accepted whether the MIC has been calculated with the latest SNonce (the
previously existing behavior) or with the earlier SNonce (the new
extension). This makes 4-way handshake more robust with stations that
update SNonce for each transmitted EAPOL-Key 2/4 message in cases where
EAPOL-Key message 1/4 needs to be retransmitted.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoPrint EAPOL-Key Replay Counter in Authenticator debug log
Jouni Malinen [Fri, 21 Nov 2014 13:35:19 +0000 (15:35 +0200)]
Print EAPOL-Key Replay Counter in Authenticator debug log

This makes it easier to debug issues relared to EAPOL-Key
retransmissions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoReserve QCA vendor specific nl80211 commands 53
Jouni Malinen [Thu, 20 Nov 2014 18:36:59 +0000 (20:36 +0200)]
Reserve QCA vendor specific nl80211 commands 53

These is reserved for QCA use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Mesh HT mode
Jason Mobarak [Mon, 1 Sep 2014 04:23:36 +0000 (00:23 -0400)]
tests: Mesh HT mode

Change the mesh tests to check for the presence of HT in the scan
results.

[original implementation by Chun-Yeow Yeoh <yeohchunyeow@gmail.com>]
[some fixes by Masashi Honma <masashi.honma@gmail.com>]
Signed-off-by: Ashok Nagarajan <ashok.dragon@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
9 years agotests: Add test_wpas_mesh test cases
Javier Lopez [Mon, 1 Sep 2014 04:23:35 +0000 (00:23 -0400)]
tests: Add test_wpas_mesh test cases

This wpa_supplicant tests include basic tests for:

- Mesh scan
- Mesh group add/remove
- Mesh peer connected/disconnected
- Add/Set/Remove to test mesh mode network
- Open mesh connectivity test
- Secure mesh connectivity test
- no_auto_peer

Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
[no_auto_peer test by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Javier Lopez <jlopex@gmail.com>
9 years agoAdd examples of new mesh options into wpa_supplicant.conf
Thomas Pedersen [Mon, 1 Sep 2014 04:23:34 +0000 (00:23 -0400)]
Add examples of new mesh options into wpa_supplicant.conf

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-off-by: Thomas Pedersen <thomas@noack.us>
9 years agonl80211: Do not try to change STA capability on NL80211_CMD_SET_STATION
Jouni Malinen [Thu, 20 Nov 2014 14:25:00 +0000 (16:25 +0200)]
nl80211: Do not try to change STA capability on NL80211_CMD_SET_STATION

cfg80211 will reject any of these attributes regardless of whether the
values actually change or not when NL80211_CMD_SET_STATION is used for
something else than TDLS. This path is hit at least when setting up
mesh, so filter out the attributes from NL80211_CMD_SET_STATION to match
the rules in cfg80211.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix regression in START line total count
Jouni Malinen [Wed, 19 Nov 2014 20:02:08 +0000 (22:02 +0200)]
tests: Fix regression in START line total count

The previous changes to enable stdin control broke the previous case of
showing the total number of test cases in the START lines. Fix that by
using a separate variable for the total number of test casess instead of
using length of the list of remaining test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WEP Shared Key index change without deauth
Jouni Malinen [Wed, 19 Nov 2014 15:57:49 +0000 (17:57 +0200)]
tests: WEP Shared Key index change without deauth

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WEP with non-zero key index
Jouni Malinen [Wed, 19 Nov 2014 15:37:54 +0000 (17:37 +0200)]
tests: WEP with non-zero key index

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P_FIND continuing after GO Negotiation failure
Jouni Malinen [Wed, 19 Nov 2014 14:08:34 +0000 (16:08 +0200)]
tests: P2P_FIND continuing after GO Negotiation failure

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Do not change P2P state on GO Neg failure if it is P2P_SEARCH
Rashmi Ramanna [Mon, 17 Nov 2014 10:37:24 +0000 (16:07 +0530)]
P2P: Do not change P2P state on GO Neg failure if it is P2P_SEARCH

Changing the P2P state to P2P_IDLE on GO Negotiation Failure would stop
the previously issued P2P_FIND operation without notifying the upper
layers. Leave the search operation running if in P2P_SEARCH state to
avoid unexpected behavior in case the upper layers issued a new P2P_FIND
while waiting for GO Negotiation to complete.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAP: Add support for multicast-to-unicast conversion for DGAF Disable
Kyeyoon Park [Mon, 3 Nov 2014 22:10:24 +0000 (14:10 -0800)]
AP: Add support for multicast-to-unicast conversion for DGAF Disable

When DGAF Disable is on, perform multicast-to-unicast for DHCP packets
and Router Advertisement packets. This is a requirement for Hotspot 2.0.

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: Add Neighbor Discovery snooping mechanism for Proxy ARP
Kyeyoon Park [Sat, 1 Nov 2014 06:33:41 +0000 (23:33 -0700)]
AP: Add Neighbor Discovery snooping mechanism for Proxy ARP

This commit establishes the infrastructure, and handles the Neighbor
Solicitation and Neighbor Advertisement frames. This will be extended
in the future to handle other frames.

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: Add multicast-to-unicast conversion send for "x_snoop"
Kyeyoon Park [Sat, 1 Nov 2014 05:15:19 +0000 (22:15 -0700)]
AP: Add multicast-to-unicast conversion send for "x_snoop"

Multicast-to-unicast conversion send will be needed in various part of
Proxy ARP and DGAF Disable.

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: Extend the BSS bridge neighbor entry management to support IPv6
Kyeyoon Park [Thu, 6 Nov 2014 00:15:46 +0000 (16:15 -0800)]
AP: Extend the BSS bridge neighbor entry management to support IPv6

This allows adding/deleting an IPv6 neighbor entry to/from the bridge,
to which the BSS belongs. This commit adds the needed functionality in
driver_nl80211.c for the Linux bridge implementation. In theory, this
could be shared with multiple Linux driver interfaces, but for now, only
the main nl80211 interface is supported.

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agol2_packet: Add support for NDISC packet filter in l2_packet_linux
Kyeyoon Park [Thu, 6 Nov 2014 00:14:24 +0000 (16:14 -0800)]
l2_packet: Add support for NDISC packet filter in l2_packet_linux

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: Convert "dhcp_snoop" to use the generic "x_snoop"
Kyeyoon Park [Sat, 1 Nov 2014 01:18:35 +0000 (18:18 -0700)]
AP: Convert "dhcp_snoop" to use the generic "x_snoop"

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: Add a generic "x_snoop" infrastructure for Proxy ARP
Kyeyoon Park [Sat, 1 Nov 2014 01:18:35 +0000 (18:18 -0700)]
AP: Add a generic "x_snoop" infrastructure for Proxy ARP

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agotests: Move parallel-vm.py test control to the host
Jouni Malinen [Wed, 19 Nov 2014 00:03:39 +0000 (02:03 +0200)]
tests: Move parallel-vm.py test control to the host

This allows all VMs to be used at the end of a test sequence by
assigning test cases to VMs based on which VM is available for a new
test case rather than splitting the full task at the beginning and
potentially getting stuck with the last VM running long test cases for
significantly longer than another VM that gets shorter duration tests
assigned to it.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add run-tests.py -i to control execution from stdin
Jouni Malinen [Wed, 19 Nov 2014 00:01:27 +0000 (02:01 +0200)]
tests: Add run-tests.py -i to control execution from stdin

The new -i command line argument can be used to control test case
execution from stdin to run-tests.py and vm-run.sh. This can be used,
e.g., to run multiple repeated test sequences in a virtual machine
without havign to restart the VM between each iteration.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Allow run-tests.py to be run from the vm directory
Jouni Malinen [Tue, 18 Nov 2014 22:41:45 +0000 (00:41 +0200)]
tests: Allow run-tests.py to be run from the vm directory

Some of the paths in run-tests.py are hardcoded and could not handle
tests/hwsim/vm as the working directory. Modify the design enough to
allow ../run-tests.py -L to be used from the vm directory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make run-tests.py process test case selection arguments
Jouni Malinen [Tue, 18 Nov 2014 22:34:36 +0000 (00:34 +0200)]
tests: Make run-tests.py process test case selection arguments

This allows a list of matching test cases to be produced without having
to run the test cases. Previously, -L output included all defined test
cases regardless of what else was included on the command line.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAP: Drop retransmitted auth/assoc/action frames
Ilan Peer [Wed, 5 Nov 2014 08:50:34 +0000 (03:50 -0500)]
AP: Drop retransmitted auth/assoc/action frames

It is possible that a station device might miss an ACK for an
authentication, association, or action frame, and thus retransmit the
same frame although the frame is already being processed in the stack.
While the duplicated frame should really be dropped in the kernel or
firmware code where duplicate detection is implemented for data frames,
it is possible that pre-association cases are not fully addressed (which
is the case at least with mac80211 today) and the frame may be delivered
to upper layer stack.

In such a case, the local AP will process the retransmitted frame although
it has already handled the request, which might cause the station to get
confused and as a result disconnect from the AP, blacklist it, etc.

To avoid such a case, save the sequence control of the last processed
management frame and in case of retransmissions drop them.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agoEAP-pwd: Remove unnecessary OpenSSL EVP_sha256() registration
Jouni Malinen [Sun, 16 Nov 2014 23:20:10 +0000 (01:20 +0200)]
EAP-pwd: Remove unnecessary OpenSSL EVP_sha256() registration

This gets registered in tls_openssl.c from tls_init(), so there is no
need for EAP-pwd implementation to register explicitly. This avoids some
corner cases where OpenSSL resources do not get fully freed on exit.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoDFS: Fix hostapd operation without hw_mode driver data
Jouni Malinen [Sun, 16 Nov 2014 23:14:35 +0000 (01:14 +0200)]
DFS: Fix hostapd operation without hw_mode driver data

If DFS implementation was built in, some configurations with drivers
that do not provide mode information could end up dereferencing a NULL
pointer. Fix this by skipping DFS operations in such cases since not
having information about modes and channels means that hostapd could not
perform DFS anyway (i.e., either this is not a wireless driver or the
driver takes care of DFS internally).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix hostapd operation without hw_mode driver data
Jouni Malinen [Sun, 16 Nov 2014 23:08:04 +0000 (01:08 +0200)]
Fix hostapd operation without hw_mode driver data

Commit 7f0303d5b0bb425f3e7318a7016b55ba9e67f9de ('hostapd: Verify VHT
160/80+80 MHz driver support') added couple of hapd->iface->current_mode
dereferences of which the one in hostapd_set_freq() can be hit with some
configuration files when using driver wrappers that do not have hw_mode
data, i.e., when current_mode is NULL. This could result in segmentation
fault when trying to use driver=wired. Fix this by checking that
current_mode is not NULL before dereferencing it to get vht_capab.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowired: Fix deinit path to unregister eloop read_sock
Jouni Malinen [Sun, 16 Nov 2014 22:57:15 +0000 (00:57 +0200)]
wired: Fix deinit path to unregister eloop read_sock

The previous version was leaving behind registered eloop socket
instances.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Report kernel panic clearly in parallel-vm.py
Jouni Malinen [Sun, 16 Nov 2014 20:34:54 +0000 (22:34 +0200)]
tests: Report kernel panic clearly in parallel-vm.py

Previously, it was possible for a kernel panic to be missed since the
only sign of it in stdout was reduced number of passed test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Use a single timestamp in all vm-run.sh instances
Jouni Malinen [Sun, 16 Nov 2014 20:24:18 +0000 (22:24 +0200)]
tests: Use a single timestamp in all vm-run.sh instances

This avoids possible mismatches in directory and log file timestamps if
the UNIX timestamp (seconds) changes during the startup sequence.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add wpa_supplicant WMM-AC test
Eliad Peller [Wed, 22 Oct 2014 12:04:04 +0000 (08:04 -0400)]
tests: Add wpa_supplicant WMM-AC test

Add basic wpa_supplicant tests for WMM-AC TSPEC addition/deletion.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agoWMM AC: Notify driver before sending DelTS
Johannes Berg [Wed, 22 Oct 2014 12:04:03 +0000 (08:04 -0400)]
WMM AC: Notify driver before sending DelTS

Switch the stop and sending DelTS to avoid sending data packets
for the session after the DelTS, which is otherwise possible.

This also helps the mac80211 implementation as it requires stopping the
traffic flow before sending the DelTS as it may modify the AC parameters
for the affected queue, and that may in turn affect management frames.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agoWMM AC: Add wmm_ac_status control interface command
Moshe Benji [Wed, 22 Oct 2014 12:04:02 +0000 (08:04 -0400)]
WMM AC: Add wmm_ac_status control interface command

This wmm_ac_status command will show the current status for WMM AC.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agoAdd wpa_scnprintf() helper function
Moshe Benji [Wed, 22 Oct 2014 12:04:02 +0000 (08:04 -0400)]
Add wpa_scnprintf() helper function

This provides a simpler version of snprintf that doesn't require further
error checks.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agonl80211: Implement add_ts/del_ts ops
Moshe Benji [Wed, 22 Oct 2014 12:04:01 +0000 (08:04 -0400)]
nl80211: Implement add_ts/del_ts ops

Add ops to notify about TSPECs to add/remove. Additionally, subscribe to
ADDTS/DELTS Action frames to be able to process WMM AC Action frames.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agowpa_cli: WMM_AC_ADDTS and WMM_AC_DELTS commands
Moshe Benji [Wed, 22 Oct 2014 12:04:00 +0000 (08:04 -0400)]
wpa_cli: WMM_AC_ADDTS and WMM_AC_DELTS commands

wmm_ac_addts command will add (or update) a traffic stream and
wmm_ac_delts command will delete an existing traffic stream.

Each of the above commands will call its corresponding
ctrl_iface command.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agoctrl_iface: Add wmm_ac_addts and wmm_ac_delts commands
Moshe Benji [Wed, 22 Oct 2014 12:03:59 +0000 (08:03 -0400)]
ctrl_iface: Add wmm_ac_addts and wmm_ac_delts commands

wmm_ac_addts command will add (or update) a traffic stream and
wmm_ac_delts command will delete an existing traffic stream.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agoAdd str_token() function
Eliad Peller [Wed, 22 Oct 2014 12:03:58 +0000 (08:03 -0400)]
Add str_token() function

Add helper function to get the next token from a string.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>