mech_eap.git
8 years agoFST: Clean up fst_group_update_ie()
Jouni Malinen [Fri, 17 Jul 2015 13:59:09 +0000 (16:59 +0300)]
FST: Clean up fst_group_update_ie()

None of the callers passed in cleaning_up == TRUE, so drop that unused
code path.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Move fst_mbie_get_peer_addr() into fst_group.c
Jouni Malinen [Fri, 17 Jul 2015 13:55:08 +0000 (16:55 +0300)]
FST: Move fst_mbie_get_peer_addr() into fst_group.c

There is no need for this function to be an inline function in a header
file since it is used only within fst_group.c.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Show FST IE update details in debug log
Jouni Malinen [Fri, 17 Jul 2015 13:25:09 +0000 (16:25 +0300)]
FST: Show FST IE update details in debug log

This makes it more convenient to debug FST IE updates.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Clear hostapd fst_ies on FST-DETACH to avoid use of freed memory
Jouni Malinen [Fri, 17 Jul 2015 13:24:11 +0000 (16:24 +0300)]
FST: Clear hostapd fst_ies on FST-DETACH to avoid use of freed memory

This is needed in the corner case of FST-DETACH being used without
stopping the AP instance.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Fix FST Action frame length validation
Jouni Malinen [Fri, 17 Jul 2015 10:00:17 +0000 (13:00 +0300)]
FST: Fix FST Action frame length validation

Commit 717333f4e4d027c69e7c1241dc124ef7d59a6c85 ('FST: Add the Fast
Session Transfer (FST) module') performed incorrect frame length
validation for Setup Request (did not remove 24+1 header from
consideration) and did not include payload validation for other FST
Action frames. Fix these by explicitly verifying that the payload of
these frames is sufficiently long before reading the values from there.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFT: Register RRB l2_packet only if FT-over-DS is enabled
Jouni Malinen [Thu, 16 Jul 2015 22:15:28 +0000 (01:15 +0300)]
FT: Register RRB l2_packet only if FT-over-DS is enabled

There is no need to waste resources for this packet socket if FT-over-DS
is disabled or when operating P2P GO or AP mode in wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDocument hostapd ft_over_ds configuration parameter
Jouni Malinen [Thu, 16 Jul 2015 22:13:07 +0000 (01:13 +0300)]
Document hostapd ft_over_ds configuration parameter

This had been forgotten from hostapd.conf.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WPA2-PSK-FT RRB protocol testing
Jouni Malinen [Thu, 16 Jul 2015 22:08:25 +0000 (01:08 +0300)]
tests: WPA2-PSK-FT RRB protocol testing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: hostapd global-to-local control interface redirection
Anton Nayshtut [Mon, 22 Jun 2015 08:27:13 +0000 (11:27 +0300)]
tests: hostapd global-to-local control interface redirection

This implements basic global-to-local control interface command
redirection tests.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add global to local control interface redirection
Anton Nayshtut [Thu, 16 Jul 2015 10:29:29 +0000 (13:29 +0300)]
hostapd: Add global to local control interface redirection

This patch implements global to local control interface redirection in
the same way as it's done for wpa_supplicant. Any global control
interface command beginning with "IFNAME=..." will be routed to the
corresponding local control interface handler.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add hostapd_ctrl_iface_receive_process()
Anton Nayshtut [Thu, 16 Jul 2015 10:19:49 +0000 (13:19 +0300)]
hostapd: Add hostapd_ctrl_iface_receive_process()

The newly introduced function will be used in followup commits to handle
requests redirected from the global control interface.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: wpa_supplicant ctrl_iface DUP_NETWORK (global)
Jouni Malinen [Thu, 16 Jul 2015 15:05:09 +0000 (18:05 +0300)]
tests: wpa_supplicant ctrl_iface DUP_NETWORK (global)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd global wpa_supplicant DUP_NETWORK command
Anton Nayshtut [Wed, 17 Jun 2015 13:15:39 +0000 (16:15 +0300)]
Add global wpa_supplicant DUP_NETWORK command

This command allows network variables to be copied from one network to
another when the networks belong to different radios. This is similar to
the per-interface DUP_NETWORK command. On the global control interface,
the command syntax is as follows:

DUP_NETWORK <src ifname> <dst ifname> <src network id> <dst network id> <variable name>

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Silence unnecessary get_driver_status() prints
Jouni Malinen [Thu, 16 Jul 2015 09:46:01 +0000 (12:46 +0300)]
tests: Silence unnecessary get_driver_status() prints

Commit 53606b105c6df3c2f3a154b055ac142d5c380251 ('tests: Wait for scan
to complete on all interfaces in reset()') added option of passing
ifname to get_driver_status(). This could result in FAIL-NO-IFNAME-MATCH
returns that get printed out in "Ignore unexpected status-driver line"
messages if the interface is not found. Check for this case to avoid
that unnecessary print.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST with RSN
Jouni Malinen [Tue, 9 Jun 2015 18:31:09 +0000 (21:31 +0300)]
tests: FST with RSN

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST AP setup failing due to OOM
Jouni Malinen [Tue, 9 Jun 2015 11:57:05 +0000 (14:57 +0300)]
tests: FST AP setup failing due to OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST control interface behavior
Jouni Malinen [Tue, 9 Jun 2015 09:19:47 +0000 (12:19 +0300)]
tests: FST control interface behavior

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Add FST module tests
Anton Nayshtut [Tue, 5 Aug 2014 15:25:59 +0000 (18:25 +0300)]
tests: Add FST module tests

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Testing support
Anton Nayshtut [Thu, 4 Dec 2014 17:20:56 +0000 (19:20 +0200)]
FST: Testing support

This patch introduces infrastructure needed for FST module tests.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Register for FST Action frames (STA)
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
nl80211: Register for FST Action frames (STA)

wpa_supplicant will process these Action frames for FST operations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: wpa_supplicant build rules
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: wpa_supplicant build rules

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: wpa_supplicant control interface
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: wpa_supplicant control interface

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Send FST Action frame for processing (wpa_supplicant)
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: Send FST Action frame for processing (wpa_supplicant)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Integration into wpa_supplicant
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: Integration into wpa_supplicant

This commit integrates the FST into the wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: wpa_supplicant [FST] flag for BSS in scan results
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: wpa_supplicant [FST] flag for BSS in scan results

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: wpa_supplicant configuration parameters
Anton Nayshtut [Sun, 16 Nov 2014 15:28:53 +0000 (17:28 +0200)]
FST: wpa_supplicant configuration parameters

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Do not prune STAs belonging to the same FST
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Do not prune STAs belonging to the same FST

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Add hostapd_cli fst command
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Add hostapd_cli fst command

This can be used to issue FST-MANAGER control interface commands.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Add build rules for hostapd
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Add build rules for hostapd

This patch integrates the FST into the hostapd.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Add FST IEs into AP mode management frames
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Add FST IEs into AP mode management frames

This adds the FST IEs received from the FST module into Beacon, Probe
Response, and (Re)Association Response frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Send FST Action frames to AP mode processing
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Send FST Action frames to AP mode processing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: hostapd control interface
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: hostapd control interface

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Integration into hostapd
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Integration into hostapd

This commit integrates the FST into the hostapd.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Store MB IEs from (Re)Association Request
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: Store MB IEs from (Re)Association Request

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: hostapd configuration parameters
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
FST: hostapd configuration parameters

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoParsing of multi band element
Anton Nayshtut [Wed, 21 Jan 2015 13:30:48 +0000 (15:30 +0200)]
Parsing of multi band element

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Add the Fast Session Transfer (FST) module
Anton Nayshtut [Wed, 18 Feb 2015 14:59:21 +0000 (16:59 +0200)]
FST: Add the Fast Session Transfer (FST) module

Fast Session Transfer (FST) is the transfer of a session from a channel
to another channel in a different frequency band. The term "session"
refers to non-physical layer state information kept by a pair of
stations (STAs) that communicate directly (i.e., excludes forwarding).

The FST is implemented in accordance with IEEE Std 802.11ad-2012.

Definitions

 * FST interface - an interface for which FST functionality is enabled
 * FST group - a bunch of FST interfaces representing single
multi-band STA
 * FST peer - a multi-band capable STA connected
 * FST module - multi-band operation functionality implemented in
accordance with IEEE Std 802.11ad-2012 (see 10.32
Multi-band operation) as a part of hostapd/wpa_supplicant
 * FST manager - an external application that implements custom FST
related logic, using the FST module's interfaces
accessible via CLI or D-Bus

This commit introduces only the FST module. Integration of the FST
module into the hostapd/wpa_supplicant and corresponding CLI/D-Bus
interfaces and FST related tests are covered in separate commits.

FST manager application is out of scope of these commits.

As FST aggregates a few interfaces into FST group, the FST module uses
global CLI for both commands and notifications. It also exposes
alternative non-interface based D-Bus subtree for this purposes.

Configuration and Initialization

 * FST functionality can enabled by compilation flag (CONFIG_FST)
 * hostapd/wpa_supplicant controlling multiple interfaces are used for
   FST
 * once enabled by compilation, the FST can be enabled for specific
   interfaces in the configuration files
 * FST interfaces are aggregated in FST groups (fst_group_id config file
   entry), where each FST group:
   - represents one multi-band device
   - should have two or more FST interfaces in it
 * priority (fst_priority config file entry) must be configured for each
   FST interface. FST interface with higher priority is the interface FST
   will always try to switch to. Thus, for example, for the maximal
   throughput, it should be the fastest FST interface in the FST setup.
 * default Link Loss Timeout (LLT) value can be configured for each FST
   interface (fst_llt config file entry). It represents LLT to be used
   by FST when this interface is active.
 * FST interfaces advertise the Multi-band capability by including the
   Multi-band element in the corresponding frames

FST CLI commands:

 * fst list_groups - list FST groups configured.
 * fst list_ifaces - list FST interfaces which belong to specific group
 * fst iface_peers - list Multi-Band STAs connected to specific interface
 * fst list_sessions - list existing FST sessions
 * fst session_get - get FST session info
 * fst session_add - create FST session object
 * fst session_set - set FST session parameters (old_iface, new_iface,
                     peer_addr, llt)
 * fst session_initiate - initiate FST setup
 * fst session_respond - respond to FST setup establishemnt attempt by
                         counterpart
 * fst session_transfer - initiate FST switch
 * fst session_teardown - tear down FST Setup but leave the session object
  for reuse
 * fst session_remove - remove FST session object

FST CLI notifications:
  * FST-EVENT-PEER - peer state changed (CONNECT/DISCONNECT)
  * FST-EVENT-SESSION - FST session level notification with following
                        sub-events:
     - EVENT_FST_SESSION_STATE - FST session state changed
     - EVENT_FST_ESTABLISHED - previously initiated FST session became
                               established
     - EVENT_FST_SETUP - new FST session object created due to FST session
                         negotiation attempt by counterpart

All the FST CLI commands and notifications are also implemented on D-Bus
for wpa_supplicant.

IEEE 802.11 standard compliance

FST module implements FST setup statemachine in compliance with IEEE
802.11ad (P802.11-REVmc/D3.3), as it described in 10.32 Multi-band
operation (see also Figure 10-34 - States of the FST setup protocol).

Thus, for example, the FST module initiates FST switch automatically
when FST setup becomes established with LLT=0 in accordance with
10.32.2.2 Transitioning between states.

At the moment, FST module only supports non-transparent STA-based FST
(see 10.32.1 General).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd IEEE 802.11ad element descriptions
Anton Nayshtut [Wed, 18 Feb 2015 14:59:21 +0000 (16:59 +0200)]
Add IEEE 802.11ad element descriptions

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd is_multicast_ether_addr()
Anton Nayshtut [Tue, 27 Jan 2015 14:30:08 +0000 (16:30 +0200)]
Add is_multicast_ether_addr()

This helper function can be used to check whether a MAC address is a
multicast (including broadcast) address.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Global control interface notifications
Anton Nayshtut [Sun, 16 Nov 2014 14:52:49 +0000 (16:52 +0200)]
hostapd: Global control interface notifications

This commit implements hostapd global control interface notifications
infrastructure. hostapd global control interface clients issue
ATTACH/DETACH commands to register and deregister with hostapd
correspondingly - the same way as for any other hostapd/wpa_supplicant
control interface.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Generic Linux master interface support for hostapd
Anton Nayshtut [Wed, 4 Mar 2015 10:12:36 +0000 (12:12 +0200)]
nl80211: Generic Linux master interface support for hostapd

Previously, hostapd only supported the case of EAPOL frames receiving
from interfaces enslaved into bridge. This commit adds support for any
Linux master (teaming, openvswitch, bonding, etc.) to be detected.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Invalid P2PS attribute parsing
Jouni Malinen [Sun, 12 Jul 2015 21:51:15 +0000 (00:51 +0300)]
tests: Invalid P2PS attribute parsing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IEEE 802.1X and EAPOL Authenticator aWhile handling
Jouni Malinen [Sat, 11 Jul 2015 21:51:00 +0000 (00:51 +0300)]
tests: IEEE 802.1X and EAPOL Authenticator aWhile handling

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IEEE 802.1X and EAPOL_SET command
Jouni Malinen [Sun, 12 Jul 2015 08:32:16 +0000 (11:32 +0300)]
tests: IEEE 802.1X and EAPOL_SET command

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd EAPOL_SET hostapd command to configure EAPOL parameters
Jouni Malinen [Sun, 12 Jul 2015 08:31:28 +0000 (11:31 +0300)]
Add EAPOL_SET hostapd command to configure EAPOL parameters

This new control interface command "EAPOL_REAUTH <MAC address>
<parameter> <value>" can be used to implement the IEEE 802.1X PAE
Set Authenticator Configuration operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IEEE 802.1X and EAPOL_REAUTH request
Jouni Malinen [Sun, 12 Jul 2015 07:46:12 +0000 (10:46 +0300)]
tests: IEEE 802.1X and EAPOL_REAUTH request

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd EAPOL_REAUTH hostapd command to trigger EAPOL reauthentication
Jouni Malinen [Sun, 12 Jul 2015 07:44:20 +0000 (10:44 +0300)]
Add EAPOL_REAUTH hostapd command to trigger EAPOL reauthentication

This new control interface command "EAPOL_REAUTH <MAC address>" can be
used to implement the IEEE 802.1X PAE Reauthenticate operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: More coverage for EAPOL Authenticator state dump
Jouni Malinen [Sat, 11 Jul 2015 21:20:44 +0000 (00:20 +0300)]
tests: More coverage for EAPOL Authenticator state dump

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix resource leak in test-rsa-sig-ver on error paths
Nishant Chaprana [Thu, 9 Jul 2015 14:26:46 +0000 (19:56 +0530)]
tests: Fix resource leak in test-rsa-sig-ver on error paths

The opened FILE pointer needs to be closed on error paths.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
8 years agoRSN: Stop connection attempt on apparent PMK mismatch
Jouni Malinen [Wed, 8 Jul 2015 17:48:18 +0000 (20:48 +0300)]
RSN: Stop connection attempt on apparent PMK mismatch

If WPA2-Enterprise connection with full EAP authentication (i.e., no
PMKSA caching used) results in a PMKID that does not match the one the
AP/Authenticator indicates in EAPOL-Key msg 1/4, there is not much point
in trying to trigger full EAP authentication by sending EAPOL-Start
since this sequence was immediately after such full authentication
attempt.

There are known examples of authentication servers with incorrect MSK
derivation when TLS v1.2 is used (e.g., FreeRADIUS 2.2.6 or 3.0.7 when
built with OpenSSL 1.0.2). Write a clear debug log entry and also send
it to control interface monitors when it looks likely that this case has
been hit. After doing that, stop the connection attempt by
disassociating instead of trying to send out EAPOL-Start to trigger new
EAP authentication round (such another try can be tried with a new
association).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-TLS and TLS version configuration
Jouni Malinen [Wed, 8 Jul 2015 16:52:14 +0000 (19:52 +0300)]
tests: EAP-TLS and TLS version configuration

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoMake TLS version number available in STATUS command
Jouni Malinen [Wed, 8 Jul 2015 16:51:03 +0000 (19:51 +0300)]
Make TLS version number available in STATUS command

This adds a new STATUS command field "eap_tls_version" that shows the
TLS version number that was used during EAP-TLS/TTLS/PEAP/FAST exchange.
For now, this is only supported with OpenSSL.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Add option to disable use of TLSv1.0
Jouni Malinen [Wed, 8 Jul 2015 16:25:10 +0000 (19:25 +0300)]
OpenSSL: Add option to disable use of TLSv1.0

The new phase1 config parameter value tls_disable_tlsv1_0=1 can now be
used to disable use of TLSv1.0 for a network configuration. This can be
used to force a newer TLS version to be used. For example,
phase1="tls_disable_tlsv1_0=1 tls_disable_tlsv1_1=1" would indicate that
only TLS v1.2 is accepted.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoNFC: Add a hardcoded limit on maximum NDEF payload length
Jouni Malinen [Wed, 8 Jul 2015 14:00:28 +0000 (17:00 +0300)]
NFC: Add a hardcoded limit on maximum NDEF payload length

While this is already enforced in practice due to the limits on the
maximum control interface command length and total_length bounds
checking here, this explicit check on payload_length value may help
static analyzers understand the code better. (CID 122668)

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_supplicant: Fix a typo in wpa_scan_result_compar()
Hahn, Maital [Wed, 8 Jul 2015 13:13:11 +0000 (13:13 +0000)]
wpa_supplicant: Fix a typo in wpa_scan_result_compar()

A typo in wpa_scan_result_compar() caused wrong scan results sorting
(and wrong roaming decision). This fixes a copy-paste regression
introduced by commit a1b790eb9d7514d1a6e0582a07f695a1564caa59 ('Select
AP based on estimated maximum throughput').

Signed-off-by: Maital Hahn <maitalm@ti.com>
8 years agotests: Few trivial cleanups to P2PS tests
Andrei Otcheretianski [Thu, 2 Jul 2015 13:14:55 +0000 (16:14 +0300)]
tests: Few trivial cleanups to P2PS tests

Remove unused variables and replace split(" ") with just split().

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Wait for scan to complete on all interfaces in reset()
Andrei Otcheretianski [Thu, 2 Jul 2015 13:14:53 +0000 (16:14 +0300)]
tests: Wait for scan to complete on all interfaces in reset()

When WpaSupplicant executes reset() it waits until all the ongoing scans
are completed. However, it checks the status of the wlanX interface
only. If a dedicated P2P device interface is used, scan may be still
running on the P2P Device interface, e.g., due to P2P_FIND. This might
affect subsequent tests.

Fix this by waiting until the scan is done both on wlanX and P2P
Device interfaces.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Additional invalid NDEF records
Jouni Malinen [Tue, 7 Jul 2015 19:43:39 +0000 (22:43 +0300)]
tests: Additional invalid NDEF records

These are regression tests for NDEF message parsing issues with payload
length validation.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoNFC: Fix payload length validation in NDEF record parser
Jouni Malinen [Tue, 7 Jul 2015 18:57:28 +0000 (21:57 +0300)]
NFC: Fix payload length validation in NDEF record parser

It was possible for the 32-bit record->total_length value to end up
wrapping around due to integer overflow if the longer form of payload
length field is used and record->payload_length gets a value close to
2^32. This could result in ndef_parse_record() accepting a too large
payload length value and the record type filter reading up to about 20
bytes beyond the end of the buffer and potentially killing the process.
This could also result in an attempt to allocate close to 2^32 bytes of
heap memory and if that were to succeed, a buffer read overflow of the
same length which would most likely result in the process termination.
In case of record->total_length ending up getting the value 0, there
would be no buffer read overflow, but record parsing would result in an
infinite loop in ndef_parse_records().

Any of these error cases could potentially be used for denial of service
attacks over NFC by using a malformed NDEF record on an NFC Tag or
sending them during NFC connection handover if the application providing
the NDEF message to hostapd/wpa_supplicant did no validation of the
received records. While such validation is likely done in the NFC stack
that needs to parse the NFC messages before further processing,
hostapd/wpa_supplicant better be prepared for any data being included
here.

Fix this by validating record->payload_length value in a way that
detects integer overflow. (CID 122668)

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoP2PS: Save intended interface address after P2PS PD
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:08 +0000 (10:45 +0300)]
P2PS: Save intended interface address after P2PS PD

One possible outcome of the P2PS PD is P2P GO/P2P Client. In this case,
one peer becomes a P2P GO and the P2P Client joins it. Since multiple
GOs may run simultaneously on the same P2P Device, the P2P Client should
join using the intended interface address.

To be able to find the device by the intended interface address, save it
during the PD.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Set intended interface address correctly for new group
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:07 +0000 (10:45 +0300)]
P2PS: Set intended interface address correctly for new group

If a device may be an explicit GO, it adds the GO details in the PD
Request. First, we try to reuse an active GO. If it is not present, we
try to reuse a non-active persistent group. In the latter case, if a
dedicated P2P interface is needed, the intended address should be that
of the pending interface. However, the wpas_get_go_info() provided the
ssid->bssid address, which is the address of the P2P device. This might
result in an incorrect intended interface attribute in the PD Request in
case a separate group interface is used.

Fix this by setting group_iface variable to true only if a dedicated
interface should be used and set the attribute accordingly.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Add PD Response validation
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:06 +0000 (10:45 +0300)]
P2PS: Add PD Response validation

Validate the PD Response frame contents more thoroughly when it is used
for P2PS.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Add intended iface address during PD for persistent group
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:05 +0000 (10:45 +0300)]
P2PS: Add intended iface address during PD for persistent group

When persistent group is used and the peer is GO in this group,
intended interface attribute should be added to PD request/response.
Not doing so violates the spec.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Fix P2PS-PROV-DONE event on GO
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:04 +0000 (10:45 +0300)]
P2PS: Fix P2PS-PROV-DONE event on GO

If after P2PS PD the device should become a GO it sends P2PS-PROV-DONE
event which contains the GO interface name. If the GO isn't running yet
the device may use pending interface name. However, when the GO is
started, pending interface name will be removed.

Fix the GO interface name in P2PS-PROV-DONE event by copying the
interface name instead of saving the pointer.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Use wpas_p2p_create_iface() to check if dedicated iface is needed
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:03 +0000 (10:45 +0300)]
P2PS: Use wpas_p2p_create_iface() to check if dedicated iface is needed

Call wpas_p2p_create_iface() instead of just checking p2p_no_group_iface
config value. Not doing so, resulted in an incorrect behavior when the
driver sets WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE flag.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Save wps_prov_info on the responder side
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:02 +0000 (10:45 +0300)]
P2PS: Save wps_prov_info on the responder side

When device A sends PD response to device B, device A should save
wps_prov_info for device B. Not doing so would result in a redundant and
incorrect PD flow, e.g., when upon PROV-DISC-DONE event device B starts
a GO and device A should join it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Validate WPS config methods more accurately in PD Request
Andrei Otcheretianski [Thu, 2 Jul 2015 07:45:01 +0000 (10:45 +0300)]
P2PS: Validate WPS config methods more accurately in PD Request

In case of a P2PS PD, allow keypad, display, and P2PS WPS config
methods. For a legacy PD, allow keypad, display, and pushbutton methods.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Refactor p2p_process_prov_disc_resp() function
Max Stepanov [Thu, 2 Jul 2015 07:45:00 +0000 (10:45 +0300)]
P2P: Refactor p2p_process_prov_disc_resp() function

Add 'else if' to P2PS status verification to prevent a redundant
condition checking. The first 'if' condition is true only if
  status == P2P_SC_SUCCESS || status == P2P_SC_SUCCESS_DEFERRED.
while the second condition checks:
  status != P2P_SC_SUCCESS &&
  status != P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE &&
  status != P2P_SC_SUCCESS_DEFERRED
Thus, the two conditions are mutually exclusive and 'else if' can be
used if this case.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Delete redundant comparison in p2p_process_prov_disc_resp()
Max Stepanov [Thu, 2 Jul 2015 07:45:00 +0000 (10:45 +0300)]
P2P: Delete redundant comparison in p2p_process_prov_disc_resp()

Delete redundant comparison of msg.wps_config_methods with
dev->req_config_methods in p2p_process_prov_disc_resp() since it's
already done early in this function. Also, the second comparison
doesn't make too much sense: it can happen after a possible
p2p_reset_pending_pd() call setting dev->req_config_methods to 0.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Fix adv_id and adv_mac params of P2P-PROV-DISC-FAILURE
Max Stepanov [Thu, 2 Jul 2015 07:44:59 +0000 (10:44 +0300)]
P2PS: Fix adv_id and adv_mac params of P2P-PROV-DISC-FAILURE

When wpa_supplicant receives a PD Response with reject status it
generated P2P-PROV-DISC-FAILURE event without adv_id and adv_mac
parameters. Fix this by adding these parameters to the
wpas_prov_disc_fail() function call.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agohostap: Fix send_mlme() after 'freq' parameter addition
Dan Williams [Tue, 7 Jul 2015 15:49:54 +0000 (10:49 -0500)]
hostap: Fix send_mlme() after 'freq' parameter addition

This fixes the incomplete driver_hostap.c change from commit
5d180a77392690b141d95609d8c8692317712b4f ('drivers: Add freq parameter
to send_mlme() function') that did not take into account the internal
callers.

Signed-off-by: Dan Williams <dcbw@redhat.com>
8 years agotests: IEEE 802.1X and HELD state
Jouni Malinen [Tue, 7 Jul 2015 16:23:47 +0000 (19:23 +0300)]
tests: IEEE 802.1X and HELD state

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoSend EAPOL-Start on HELD->CONNECTING transition
Jouni Malinen [Tue, 7 Jul 2015 16:22:11 +0000 (19:22 +0300)]
Send EAPOL-Start on HELD->CONNECTING transition

Previously, only CONNECTING->CONNECTING case ended up sending out an
EAPOL-Start frame to avoid sending the unnecessary initial EAPOL-Start.
However, this optimization prevented new EAPOL-Start from being
initiated when leaving the HELD state. Allow that case to trigger
immediate EAPOL-Start transmission to speed up connection.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agopkcs11: Don't ask for a new PIN on TLS handshake failure
Mike Gerow [Mon, 6 Jul 2015 21:26:57 +0000 (14:26 -0700)]
pkcs11: Don't ask for a new PIN on TLS handshake failure

The only time the PIN should fail is when we initialize the TLS
connection, so it doesn't really make sense to get rid of the PIN just
because some other part of the handshake failed.

This is a followup to commit fd4fb28179a0b750dff4d38a72a7bf89a2c49813
('OpenSSL: Try to ensure we don't throw away the PIN unnecessarily').

Signed-off-by: Mike Gerow <gerow@google.com>
8 years agotests: Add Undefined Behavior Sanitizer (ubsan) configuration
Jouni Malinen [Tue, 7 Jul 2015 14:00:12 +0000 (17:00 +0300)]
tests: Add Undefined Behavior Sanitizer (ubsan) configuration

This allows hostapd and wpa_supplicant to be built for hwsim test cases
with ubsan functinality from the recent gcc/clang compiler versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoDATA_TEST_TX: Avoid ubsan warning on 0x80<<24 not fitting in int
Jouni Malinen [Tue, 7 Jul 2015 13:21:36 +0000 (16:21 +0300)]
DATA_TEST_TX: Avoid ubsan warning on 0x80<<24 not fitting in int

Use unsigned constant instead of signed to avoid warning with the LSB
being set in an int.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAvoid misaligned IPv4 header accesses in DATA_TEST_* commands
Jouni Malinen [Tue, 7 Jul 2015 13:01:46 +0000 (16:01 +0300)]
Avoid misaligned IPv4 header accesses in DATA_TEST_* commands

The IPv4 header after the Ethernet header is not 32-bit aligned and the
previous version ended up accessing 32-bit members at misaligned
addresses.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAvoid ubsan warning on 0x80<<24 not fitting in int in WPA_GET_BE32/LE32
Jouni Malinen [Tue, 7 Jul 2015 12:54:31 +0000 (15:54 +0300)]
Avoid ubsan warning on 0x80<<24 not fitting in int in WPA_GET_BE32/LE32

Use a typecast to make this shift unsigned so that the MSB fits within
the range of allowed values.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agondisc_snoop: Avoid misaligned read of IPv6 address
Jouni Malinen [Tue, 7 Jul 2015 12:51:05 +0000 (15:51 +0300)]
ndisc_snoop: Avoid misaligned read of IPv6 address

The IPv6 address in the frame buffer may not be 32-bit aligned, so use a
local copy to align this before reading the address with 32-bit reads
(s6_addr32[]).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-TTLS: Avoid ubsan warning on 0x80<<24 not fitting in int
Jouni Malinen [Tue, 7 Jul 2015 12:41:51 +0000 (15:41 +0300)]
EAP-TTLS: Avoid ubsan warning on 0x80<<24 not fitting in int

Use a typecast to make this unsigned so that the MSB fits within the
range of allowed values.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoradiotap: Avoid ubsan warning on 1<<31
Jouni Malinen [Tue, 7 Jul 2015 12:39:08 +0000 (15:39 +0300)]
radiotap: Avoid ubsan warning on 1<<31

Use the BIT() macro and unsigned int to avoid ubsan warning on 1<<31 not
fitting in an int.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoNFC: Avoid misaligned read of an NDEF field
Jouni Malinen [Tue, 7 Jul 2015 12:33:55 +0000 (15:33 +0300)]
NFC: Avoid misaligned read of an NDEF field

The 32-bit version of payload length field may not be 32-bit aligned in
the message buffer, so use WPA_GET_BE32() to read it instead of ntohl().

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotrace: Use explicit alignment requirements to avoid misalignment
Jouni Malinen [Tue, 7 Jul 2015 10:04:08 +0000 (13:04 +0300)]
trace: Use explicit alignment requirements to avoid misalignment

64-bit builds with CONFIG_WPA_TRACE=y resulted in the wpabuf pointers
getting misaligned (only 32-bit aligned) and that would result in reads
and writes of unaligned size_t values. Avoid this by indicating explicit
alignment requirement for wpabuf_trace to 8 octets (i.e., there will be
extra four octets of padding in case of 64-bit builds).

Similarly, struct os_alloc_trace resulted in some potential misalignment
cases, e.g., when CONFIG_ACS=y uses a 'long double' variable within
struct hostapd_channel_data. Avoid misalignment issues with explicit
alignment indication.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agodrivers: Use unsigned arguments for sta_set_flags()
Jouni Malinen [Tue, 7 Jul 2015 09:33:38 +0000 (12:33 +0300)]
drivers: Use unsigned arguments for sta_set_flags()

Since BIT() is now returning unsigned int, these functions need to match
that to avoid compiler warnings.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoMake BIT() unsigned int instead of int
Jouni Malinen [Tue, 7 Jul 2015 09:33:03 +0000 (12:33 +0300)]
Make BIT() unsigned int instead of int

This is needed to avoid ubsan warnings on BIT(31).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoInclude stddef.h to use the standard offsetof()
Jouni Malinen [Tue, 7 Jul 2015 09:24:57 +0000 (12:24 +0300)]
Include stddef.h to use the standard offsetof()

src/utils/list.h ended up defining a local version of offsetof() due to
stddef.h not getting included. This resulted in unnecessary warnings
from ubsan related to "dereferencing" of a NULL pointer.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRADIUS DAS: Avoid compiler warning on abs()
Jouni Malinen [Tue, 7 Jul 2015 09:14:47 +0000 (12:14 +0300)]
RADIUS DAS: Avoid compiler warning on abs()

The input parameter ended up being converted to long int instead of int,
so use an explicit typecase to get rid of the compiler warning.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoERP: Avoid mixing of enum types
Jouni Malinen [Tue, 7 Jul 2015 09:09:09 +0000 (12:09 +0300)]
ERP: Avoid mixing of enum types

Use explicit typecasting to avoid implicit conversion warnings in cases
where enum eap_erp_type is used in functions taking an EapType argument.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoD-Bus: Fix dont_quote const declaration
Jouni Malinen [Tue, 7 Jul 2015 09:07:06 +0000 (12:07 +0300)]
D-Bus: Fix dont_quote const declaration

Commit 38279bdb35c1b0c248289752197ebddd2fdd52ef ('D-Bus: Coding style
cleanup') handled the dbus_new_handlers.c change properly, but misplaced
the second 'const' in dbus_old_handlers.c in a way that resulted in
duplicated const rather than marking the actual value const.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPA2-PSK-FT AP over DS protocol testing
Jouni Malinen [Wed, 1 Jul 2015 21:33:20 +0000 (00:33 +0300)]
tests: WPA2-PSK-FT AP over DS protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPA2-PSK-FT and OOM
Jouni Malinen [Wed, 1 Jul 2015 21:08:28 +0000 (00:08 +0300)]
tests: WPA2-PSK-FT and OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPA2-PSK-FT AP with GCMP-256 cipher
Jouni Malinen [Wed, 1 Jul 2015 20:53:03 +0000 (23:53 +0300)]
tests: WPA2-PSK-FT AP with GCMP-256 cipher

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFT: Allow CCMP-256 and GCMP-256 as group ciphers
Jouni Malinen [Wed, 1 Jul 2015 20:51:31 +0000 (23:51 +0300)]
FT: Allow CCMP-256 and GCMP-256 as group ciphers

The FT-specific check for valid group cipher in wpa_ft_gen_req_ies() was
not up-to-date with the current list of supported ciphers. Fix this by
using a generic function to determine validity of the cipher. In
practice, this adds support for using CCMP-256 and GCMP-256 as the group
cipher with FT.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IEEE 802.1X connection and EAPOL-Key protocol tests
Jouni Malinen [Wed, 1 Jul 2015 18:04:06 +0000 (21:04 +0300)]
tests: IEEE 802.1X connection and EAPOL-Key protocol tests

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IEEE 802.1X and EAPOL-Start retransmissions
Jouni Malinen [Wed, 1 Jul 2015 15:37:29 +0000 (18:37 +0300)]
tests: IEEE 802.1X and EAPOL-Start retransmissions

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP server and OOM
Jouni Malinen [Tue, 30 Jun 2015 21:42:09 +0000 (00:42 +0300)]
tests: EAP server and OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPA2-Enterprise connection using MAC ACL
Jouni Malinen [Tue, 30 Jun 2015 21:34:27 +0000 (00:34 +0300)]
tests: WPA2-Enterprise connection using MAC ACL

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-TLS and unknown OCSP signer
Jouni Malinen [Tue, 30 Jun 2015 19:05:37 +0000 (22:05 +0300)]
tests: EAP-TLS and unknown OCSP signer

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Invalid OCSP data (parsing failure)
Jouni Malinen [Tue, 30 Jun 2015 19:01:05 +0000 (22:01 +0300)]
tests: Invalid OCSP data (parsing failure)

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Invalid openssl_ciphers value
Jouni Malinen [Tue, 30 Jun 2015 18:55:59 +0000 (21:55 +0300)]
tests: Invalid openssl_ciphers value

Signed-off-by: Jouni Malinen <j@w1.fi>