mech_eap.git
8 years agotests: Handle different delays in discovery_and_interface_disabled
Ilan Peer [Mon, 29 Feb 2016 12:30:02 +0000 (14:30 +0200)]
tests: Handle different delays in discovery_and_interface_disabled

Test different delay intervals between the INTERFACE_DISABLED event
and the INTERFACE_ENABLED event for discovery_and_interface_disabled.

Previously, only a delay of 1 second was used, in which case the
scan results for the P2P_FIND operation were received after the
interface was enabled again, and the case the scan results were
received while the interface was disabled was not covered.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agowpa_supplicant: Handle EVENT_SCAN_RESULTS when an interface is disabled
Ilan Peer [Mon, 29 Feb 2016 12:30:01 +0000 (14:30 +0200)]
wpa_supplicant: Handle EVENT_SCAN_RESULTS when an interface is disabled

An interface can be disabled while it has an ongoing scan request.
In such a case, when the scan results notification is received,
it was being ignored (as the interface is already disabled) so the
scan state was not cleared. This can cause undetermined behavior
for the next scan request.

To handle this, clear the scan state when EVENT_SCAN_RESULTS is
received and the interface is disabled.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoWNM: Do not scan based on malformed BSS Transition Management Request
Avraham Stern [Mon, 29 Feb 2016 12:30:00 +0000 (14:30 +0200)]
WNM: Do not scan based on malformed BSS Transition Management Request

Verify that when the Candidate List Included bit is set in a BSS
Transition Management Request frame, the candidate list actually
includes at least one candidate. If no candidates are included, reject
the request without scanning.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agotests: BTM Request Preferred Candidate List followed by vendor element
Jouni Malinen [Thu, 3 Mar 2016 14:59:27 +0000 (16:59 +0200)]
tests: BTM Request Preferred Candidate List followed by vendor element

This goes through parsing code for a case that was interpreted
incorrectly in the past.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWNM: Fix candidates count in BSS Transition Management Request
Avraham Stern [Mon, 29 Feb 2016 12:29:59 +0000 (14:29 +0200)]
WNM: Fix candidates count in BSS Transition Management Request

In BSS Transition Management Request frame, it is possible that vendor
specific IEs are included after the candidate list. In this case the
candidates count was incremented for each IE although the candidate list
is already over which could result in adding all zeros candidates into
the neighbor list.

Fix that by incrementing the candidates count only for neighbor report
elements.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agowpa_cli: Support running action script on global control interface
Ilan Peer [Mon, 29 Feb 2016 12:29:58 +0000 (14:29 +0200)]
wpa_cli: Support running action script on global control interface

In case wpa_cli is started with an option to execute an action script,
but no interface is specified, wpa_cli might crash in wpa_cli_exec() if
arg1 == NULL. Fix this be setting arg1 = "global".

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoEAP-PWD peer: Fix possible memory leak on error path
Ilan Peer [Mon, 29 Feb 2016 12:29:57 +0000 (14:29 +0200)]
EAP-PWD peer: Fix possible memory leak on error path

Fix possible memory leak in eap_pwd_perform_commit_exchange().

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoAndroid: Remove superfluous OpenSSL include paths
Adam Langley [Fri, 23 Jan 2015 01:13:10 +0000 (17:13 -0800)]
Android: Remove superfluous OpenSSL include paths

The libcrypto and libssl modules (and their respective static and host
versions) use LOCAL_EXPORT_C_INCLUDE_DIRS thus just including the module
is sufficient.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
8 years agoHS 2.0R2: Clear fetch_anqp_in_progress if fopen fails
Daichi Ueura [Tue, 1 Mar 2016 18:26:38 +0000 (03:26 +0900)]
HS 2.0R2: Clear fetch_anqp_in_progress if fopen fails

Clear wpa_s->fetch_anqp_in_progress when osu-providers.txt can't be
opened. An issue happens, for instance, when wpa_supplicant doesn't
have correct access permission to the directory specified by osu_dir.
If hs20_osu_fetch_done method returns without clearing the flag,
'FETCH_OSU' command will never work correctly.

Signed-off-by: Daichi Ueura <daichi.ueura@sonymobile.com>
8 years agoFix CONFIG_WPA_TRACE=y compilation without CONFIG_WPA_TRACE_BFD=y
Eliad Peller [Wed, 2 Mar 2016 12:38:41 +0000 (14:38 +0200)]
Fix CONFIG_WPA_TRACE=y compilation without CONFIG_WPA_TRACE_BFD=y

syms is defined only for WPA_TRACE_BFD:

../src/utils/trace.c: In function ‘wpa_trace_deinit’:
../src/utils/trace.c:372:7: error: ‘syms’ undeclared (first use in this function)
  free(syms);
       ^
../src/utils/trace.c:372:7: note: each undeclared identifier is reported only once for each function it appears in
make: *** [../src/utils/trace.o] Error 1
make: *** Waiting for unfinished jobs....

Add appropriate #ifdef.

Signed-off-by: Eliad Peller <eliad@wizery.com>
8 years agoAdd EAP-AKA' and EAP-pwd to wpa_supplicant README
Jouni Malinen [Thu, 3 Mar 2016 14:19:55 +0000 (16:19 +0200)]
Add EAP-AKA' and EAP-pwd to wpa_supplicant README

The EAP methods were missing from the lists.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoUpdate notes about OpenSSL versions
Jouni Malinen [Thu, 3 Mar 2016 14:17:34 +0000 (16:17 +0200)]
Update notes about OpenSSL versions

Obsolete OpenSSL versions 0.9.* are not supported anymore.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFix some typos in wpa_supplicant README files
Jouni Malinen [Thu, 3 Mar 2016 14:15:46 +0000 (16:15 +0200)]
Fix some typos in wpa_supplicant README files

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoREADME-P2P: Fix a typo
Nishant Chaprana [Thu, 3 Mar 2016 12:52:39 +0000 (18:22 +0530)]
README-P2P: Fix a typo

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
8 years agoP2P: Add Dev Info attribute to Probe Request frames in 60 GHz
Lior David [Sat, 20 Feb 2016 14:45:58 +0000 (16:45 +0200)]
P2P: Add Dev Info attribute to Probe Request frames in 60 GHz

When building P2P IE for Probe Request frames in P2P scan, add the
device information attribute if the 60 GHz band is included in the scan,
since this is required by the P2P specification.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
8 years agowpa_supplicant: Expose wpas_get_bands() and related API
Lior David [Sat, 20 Feb 2016 11:46:10 +0000 (13:46 +0200)]
wpa_supplicant: Expose wpas_get_bands() and related API

Expose the functions wpas_get_bands() and wpas_freq_to_band() and the
enum wpa_radio_work_band, since they will be needed outside
wpa_supplicant.c.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
8 years agoP2P: Change order of P2P IE and frequencies set up
Lior David [Sat, 20 Feb 2016 11:28:27 +0000 (13:28 +0200)]
P2P: Change order of P2P IE and frequencies set up

When setting up parameters for P2P scan, calculate the frequencies
for the scan before calculating the scan IE. This is because
the scan IE calculation may need information about the scan
frequencies in use.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
8 years agoAndroid: Allow wpa_supplicant to write files to osu-info dir
Kanchanapally, Vidyullatha [Tue, 1 Mar 2016 02:06:53 +0000 (07:36 +0530)]
Android: Allow wpa_supplicant to write files to osu-info dir

This commit allows any process running with group id of AID_WIFI to
read/write files to osu-info directory. Also, it allows other users to
read and search the osu-info directory.

This fixes issues with hs20-osu-client creating a directory for
wpa_supplicant use without wpa_supplicant actually having privileges to
write there on Android where the wpa_supplicant process does not run as
root.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Enlarge State Transition Timeout (STT)
Dedy Lansky [Thu, 25 Feb 2016 08:03:07 +0000 (10:03 +0200)]
FST: Enlarge State Transition Timeout (STT)

STT guards the exchange of FST Action frames with the peer station.
It was observed that sometimes Action frames sending is delayed at
driver/FW layers for few hundreds millisec.

Enlarge the STT to overcome such cases.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
8 years agoAdd error handling for offloaded ACS with vendor command failures
Peng Xu [Tue, 1 Mar 2016 19:13:25 +0000 (11:13 -0800)]
Add error handling for offloaded ACS with vendor command failures

In case vendor ACS command returns invalid channel or hardware mode,
complete the interface setup with an error code instead of simply
return, so that hostapd can properly clean up the interface setup.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFix scan rescheduling from wpas_stop_pno to check postponed case
Jouni Malinen [Thu, 3 Mar 2016 09:04:38 +0000 (11:04 +0200)]
Fix scan rescheduling from wpas_stop_pno to check postponed case

Commit 02e122a995dea947a2ad2c0d85190d709f9128b7 ('Reschedule scan from
wpas_stop_pno if it was postponed') uses wpa_s->scanning as the only
condition for automatically starting a postponed scan request from
EVENT_SCHED_SCAN_STOPPED event handler. However, wpa_s->scanning may be
set for sched_scan and as such, this can result in unexpected extra
scans without there having been any real postponed request.

Make this more accurate by verifying that there really is a pending
request for a scan before speeding up its start.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WPA2-Enterprise with EAP-GPSK and PTK rekey enforced by AP
Jouni Malinen [Wed, 2 Mar 2016 15:11:38 +0000 (17:11 +0200)]
tests: WPA2-Enterprise with EAP-GPSK and PTK rekey enforced by AP

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Add more address fields into RX frame debug message
Jouni Malinen [Mon, 29 Feb 2016 19:18:27 +0000 (21:18 +0200)]
nl80211: Add more address fields into RX frame debug message

This makes it easier to debug issues related to Public Action frame
addressing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: GAS query with another AP while associated
Jouni Malinen [Mon, 29 Feb 2016 17:49:52 +0000 (19:49 +0200)]
tests: GAS query with another AP while associated

This is without PMF to cover the case of Public Action frame to another
AP while associated.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoRADIUS: Add Acct-Delay-Time into accounting messages
Jouni Malinen [Mon, 29 Feb 2016 15:40:23 +0000 (17:40 +0200)]
RADIUS: Add Acct-Delay-Time into accounting messages

This tells to the server how long we have been trying to transmit the
message so that the actual time of the message generation can be
determined from receive time (ignoring network delays and only at
accuracy of one second).

For interim updates, only value 0 is used since there are no
retransmissions of the same message. For other accounting messages, the
initial attempt goes out with value 0 and the retransmissions, if
needed, show the number of seconds the message has been waiting in the
queue.

Update the Identifier and Authenticator in the messages whenever
updating the Acct-Delay-Time per RFC 2866, 4.1 requirements.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: RADIUS Accounting interim update retry
Jouni Malinen [Mon, 29 Feb 2016 09:44:30 +0000 (11:44 +0200)]
tests: RADIUS Accounting interim update retry

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRADIUS: Update full message for interim accounting updates
Jouni Malinen [Mon, 29 Feb 2016 09:44:43 +0000 (11:44 +0200)]
RADIUS: Update full message for interim accounting updates

Instead of using the RADIUS client retransmission design with the old
RADIUS message contents for each retry, trigger a completely new interim
accounting update instance more quickly (using the same schedule as
RADIUS message retransmissions) to improve accounting updates in cases
where RADIUS message delivery fails. This allows the server to get up to
date information from the time the "retry" message was sent instead of
the old information from the time the first failed attempt was sent.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoDocument nas_identifier requirements for RADIUS accounting
Jouni Malinen [Sun, 28 Feb 2016 19:19:14 +0000 (21:19 +0200)]
Document nas_identifier requirements for RADIUS accounting

nas_identifier needs to be set to a unique value for RADIUS accounting
to work properly. This needs to be unique for each BSS.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoReplace hostapd_mac_comp_empty() with is_zero_ether_addr()
Jouni Malinen [Sun, 28 Feb 2016 16:00:48 +0000 (18:00 +0200)]
Replace hostapd_mac_comp_empty() with is_zero_ether_addr()

There is no need to maintain two implementations of the functionality.
is_zero_ether_addr() is easier to understand, so use it.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoVLAN: Avoid use of libnl cache
Michael Braun [Wed, 24 Feb 2016 11:53:50 +0000 (12:53 +0100)]
VLAN: Avoid use of libnl cache

Using rtnl_link_alloc_cache() is expensive as it fills in all configured
links. Using rtnl_link_get_kernel() is much more lightweight.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agonl80211: Clean up ifidx properly if interface in a bridge is removed
Michael Braun [Wed, 24 Feb 2016 11:53:44 +0000 (12:53 +0100)]
nl80211: Clean up ifidx properly if interface in a bridge is removed

When an interface is removed while it was in a bridge, the bridge was
not removed from the local ifidx list.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoFT: Check destination MAC address on RRB receive
Michael Braun [Wed, 24 Feb 2016 11:53:41 +0000 (12:53 +0100)]
FT: Check destination MAC address on RRB receive

As the Linux variant of l2_packet_init() does not use its own_addr
argument and l2_packet_receive() does not filter on destination MAC
address, this needs to be checked in the callback.

If there are multiple BSSes listening for FT RRB packets, all their
BSSIDs need to be local to the bridge interface. As l2_packet_init() is
going to receive all of them going for any local address, those RRB
messages started turning up on BSSes that were not destinated for and
cluttering logs.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoRADIUS: Allow RADIUS server to provide PSK instead of passphrase
Michael Braun [Wed, 24 Feb 2016 11:53:38 +0000 (12:53 +0100)]
RADIUS: Allow RADIUS server to provide PSK instead of passphrase

If the AP is slow, passphrase hashing takes too long to serve the client
before timeout. Extend the Tunnel-Password design to allow a 64
character value to be interpreted as a PSK and send SSID to RADIUS
server. This allows the RADIUS server to either take care of passphrase
hashing or to use raw PSK without such hashing.

This is especially important for FT-PSK with FT-over-air, where hashing
cannot be deferred.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoCache hashed passphrase in RADIUS-based PSK delivery
Michael Braun [Wed, 24 Feb 2016 11:53:37 +0000 (12:53 +0100)]
Cache hashed passphrase in RADIUS-based PSK delivery

Instead of copying the full struct hostapd_sta_wpa_psk_short, share the
existing entry and use reference counting to check when it needs to be
freed. This allows caching of PSKs derived from passphrases to avoid
having to perform the heavy hashing operation multiple times.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoDefer passphrase-to-PSK hashing out of 802.11 authentication ACL check
Michael Braun [Wed, 24 Feb 2016 11:53:36 +0000 (12:53 +0100)]
Defer passphrase-to-PSK hashing out of 802.11 authentication ACL check

Hashing takes quite some time (can be about one second on a low-power
CPU for each passphrase provided), so hostapd can easily hit the 900 ms
Wi-Fi client authentication deadline (mac80211 uses 3x 300 ms). This can
be fixed by storing the passphrase instead of PSK with the STA and defer
the hashing into the WPA/RSN 4-way handshake, when enumerating all PSKs.

This applies for the case where a RADIUS server is used to store the
per-STA passphrases and this passphrase is delivered as part of the MAC
ACL check during IEEE 802.11 Authentication frame processing.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoVLAN: Use stack instead of heap allocation for new interface name
Michael Braun [Wed, 24 Feb 2016 11:53:35 +0000 (12:53 +0100)]
VLAN: Use stack instead of heap allocation for new interface name

The VLAN ifname is limited to the maximum length of IFNAMSIZ, so there
is no need to use heap allocation for it.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoFT: Use BSSID as r1_key_holder if no value is configured
Michael Braun [Wed, 24 Feb 2016 11:53:34 +0000 (12:53 +0100)]
FT: Use BSSID as r1_key_holder if no value is configured

r1_key_holder is an identifier that was always set to zero if unless
configured before.

See 11.6.1.7.4 of IEEE Std 802.11-2012 which reads
 "R1KH-ID is a MAC address of the holder of the PMK-R1 in the
  Authenticator of the AP"
See 12.2.2 of IEEE Std 802.11-2012 which reads
 "Each R0KH-ID and R1KH-ID is assumed to be expressed as a unique
  identifier within the mobility domain."
 "The R1KH-ID shall be set to a MAC address of the physical entity
  that stores the PMK-R1 ..."

Defaulting this to BSSID is a more reasonable value since we have not
rejected the missing r1_key_holder as invalid configuration.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: FT RRB internal delivery to non-WPA BSS
Michael Braun [Wed, 24 Feb 2016 11:53:24 +0000 (12:53 +0100)]
tests: FT RRB internal delivery to non-WPA BSS

A malicious station could try to do FT-over-DS with a non WPA-enabled
BSS. When this BSS is located in the same hostapd instance, internal RRB
delivery will be used and thus the FT Action Frame will be processed by
a non-WPA enabled BSS. This processing used to crash hostapd as
hapd->wpa_auth is NULL.

This test implements such a malicious request for regression testing.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoFT: Check hapd->wpa_auth before RRB internal delivery
Michael Braun [Wed, 24 Feb 2016 11:53:25 +0000 (12:53 +0100)]
FT: Check hapd->wpa_auth before RRB internal delivery

A malicious station could try to do FT-over-DS with a non WPA-enabled
BSS. When this BSS is located in the same hostapd instance, internal RRB
delivery will be used and thus the FT Action Frame will be processed by
a non-WPA enabled BSS. This processing used to crash hostapd as
hapd->wpa_auth is NULL. If the target BSS is on a different hostapd
instance, it will not listen for these packets and thus not crash.

Fix this by checking hapd->wpa_auth before delivery.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agoFT: Fix R0KH-R1KH protocol data length values
Michael Braun [Wed, 24 Feb 2016 11:53:11 +0000 (12:53 +0100)]
FT: Fix R0KH-R1KH protocol data length values

The FT RRB hostapd packets have a length field. For PULL frames, it
counted the bytes starting with nonce and up to the last before pad. For
RESP frames, it counted the bytes starting with nonce and up to the last
before pad except for 2 bytes. For PUSH frames, it counted the bytes
starting with nonce and up to including pad.

As rounding is done with AES encryption, including pad does not make
sense. Not including the last field before pad does not make sense
either. These were broken in the earlier addition of the 2 octet
pairwise field in commit 1b484d60e55a01d02bf01f790a7c6fb9ea606098 ('FT:
Include pairwise cipher suite in PMK-R0 SA and PMK-R1 SA').

AES encryption is not affected, as rounding hides the differences. The
packets data_length field is not used, so the differences have no effect
there.

This patch changes the constants to match the bytes used, thus excluding
the pad. To validate the changes, look at remainder modulo 8 of the sum
of the size constants and the padding sizes.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: RSN pre-auth and PMKSA caching with per_sta_vif
Michael Braun [Wed, 24 Feb 2016 11:53:10 +0000 (12:53 +0100)]
tests: RSN pre-auth and PMKSA caching with per_sta_vif

This adds new tests to verify pmksa_cache_preauth when
used with per_sta_vif and possibly vlans.

While at it it refactors the code such that the tests
  pmksa_cache_preauth
  pmksa_cache_preauth_vlan_enabled
  pmksa_cache_preauth_vlan_used
  pmksa_cache_preauth_per_sta_vif
  pmksa_cache_preauth_vlan_enabled_per_sta_vif
  pmksa_cache_preauth_vlan_used_per_sta_vif
share code where possible.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: Document tshark and python-netifaces as dependencies
Michael Braun [Wed, 24 Feb 2016 11:53:09 +0000 (12:53 +0100)]
tests: Document tshark and python-netifaces as dependencies

tshark and python-netifaces are used by some tests.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: Verify correct VLAN operation after reconnect
Michael Braun [Wed, 24 Feb 2016 11:53:08 +0000 (12:53 +0100)]
tests: Verify correct VLAN operation after reconnect

This adds a test case ap_vlan_reconnect. It connects, disconnects, and
reconnects a station in a VLAN. This tests for a regression with
wpa_group entering the FATAL_FAILURE state as the AP_VLAN interface is
removed before the group was stopped.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: Tagged-VLAN only change on reauthentication
Michael Braun [Wed, 24 Feb 2016 11:53:07 +0000 (12:53 +0100)]
tests: Tagged-VLAN only change on reauthentication

Check VLAN ID change during reauthentication when using tagged-only
configuration.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agotests: P2PS connection with cfg80211 P2P Device
Jouni Malinen [Sat, 27 Feb 2016 17:44:11 +0000 (19:44 +0200)]
tests: P2PS connection with cfg80211 P2P Device

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: p2p_device_nfc_invite with no separate group interface
Jouni Malinen [Sat, 27 Feb 2016 17:36:30 +0000 (19:36 +0200)]
tests: p2p_device_nfc_invite with no separate group interface

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: P2P persistent group with cfg80211 P2P Device
Jouni Malinen [Fri, 26 Feb 2016 20:21:15 +0000 (22:21 +0200)]
tests: P2P persistent group with cfg80211 P2P Device

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2P join-group using cfg80211 P2P Device
Jouni Malinen [Fri, 26 Feb 2016 16:40:19 +0000 (18:40 +0200)]
tests: P2P join-group using cfg80211 P2P Device

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2P autogo using cfg80211 P2P Device
Jouni Malinen [Fri, 26 Feb 2016 16:36:44 +0000 (18:36 +0200)]
tests: P2P autogo using cfg80211 P2P Device

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2P group formation with driver using cfg80211 P2P Device
Jouni Malinen [Fri, 26 Feb 2016 16:21:51 +0000 (18:21 +0200)]
tests: P2P group formation with driver using cfg80211 P2P Device

This extends the P2P Device testing coverage to include the newly
enabled option of using the primary interface (e.g., wlan0) for P2P
group operation instead of always forcing a separate group interface to
be created dynamically.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Support dedicated P2P_DEVICE without separate group interface
Lior David [Sun, 24 Jan 2016 15:36:49 +0000 (17:36 +0200)]
P2P: Support dedicated P2P_DEVICE without separate group interface

Add support for drivers with dedicated P2P_DEVICE interface, but without
group interface concurrency (only a single netdev is used). With such
devices, wpa_supplicant tried to use the p2p_dev interface instead of
the group interface and most P2P operations failed. Extend
wpa_supplicant to use the primary interface instead of a separate group
interface in such cases.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
8 years agoP2P: Add a separate pointer to the P2P Device instance
Lior David [Sun, 24 Jan 2016 15:36:49 +0000 (17:36 +0200)]
P2P: Add a separate pointer to the P2P Device instance

In many places in the code there was a reference to wpa_s->parent to get
from group interface to p2p_dev interface. These places can break if
P2P_DEVICE interface would need to be used with the primary interface as
the group interface, since the parent of the primary interface points to
itself and not the p2p_dev interface.

Fix this by adding a separate "p2pdev" pointer to wpa_supplicant,
it will be the same as parent pointer in most cases but whenever
the primary interface is used as a group interface, change it to
point to the correct p2p_dev interface.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
8 years agoGAS client: Make PMF check on RX more consistent
Jouni Malinen [Sat, 27 Feb 2016 16:49:31 +0000 (18:49 +0200)]
GAS client: Make PMF check on RX more consistent

Use the SA field instead of BSSID in the received Action frame to
determine whether PMF has been negotiated with the transmitter. While
these fields are supposed to be same for Public Action frames from an
AP, it would be possible that a frame is received with different values.
The following operations in gas_query_rx() use SA, so do the same for
the PMF check.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: GAS query with another AP while associated and using PMF
Jouni Malinen [Sat, 27 Feb 2016 09:47:58 +0000 (11:47 +0200)]
tests: GAS query with another AP while associated and using PMF

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Multi-icon fetch with REQ_HS20_ICON
Jouni Malinen [Sat, 27 Feb 2016 09:14:02 +0000 (11:14 +0200)]
tests: Multi-icon fetch with REQ_HS20_ICON

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WNM BSS Transition Management and scan behavior
Jouni Malinen [Fri, 26 Feb 2016 15:18:39 +0000 (17:18 +0200)]
tests: WNM BSS Transition Management and scan behavior

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWNM: Optimize a single BSS transition management candidate scan
Jouni Malinen [Fri, 26 Feb 2016 15:16:35 +0000 (17:16 +0200)]
WNM: Optimize a single BSS transition management candidate scan

If the BSS Transition Management Request frame includes only a single
candidate and we need to scan for the BSS to get up-to-date information,
use a scan for the known BSSID instead of wildcard BSSID. In addition,
set the SSID in the scan if it is known based on old scan results in the
BSS table. This removes unnecessary Probe Response frames when we are
interested in results from only a single BSS.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Add an option to specify the BSSID to scan for
Jouni Malinen [Fri, 26 Feb 2016 14:31:33 +0000 (16:31 +0200)]
nl80211: Add an option to specify the BSSID to scan for

This allows scans to be optimized when a response is needed only from a
single, known BSS.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: MBO STA supported operating classes
Jouni Malinen [Wed, 24 Feb 2016 10:31:09 +0000 (12:31 +0200)]
tests: MBO STA supported operating classes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAP: Store STA supported operating classes information
Jouni Malinen [Wed, 24 Feb 2016 10:20:31 +0000 (12:20 +0200)]
AP: Store STA supported operating classes information

This makes hostapd track Supported Operating Classes information from
the associated STAs. The stored information is available through the STA
control interface command (supp_op_classes row) as a hexdump of the
Supported Operating Classes element starting from the Length field. This
information can be used as input to BSS transition management and
channel switching decisions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAP: Debug print management frame TX result
Dedy Lansky [Tue, 9 Feb 2016 07:16:56 +0000 (09:16 +0200)]
AP: Debug print management frame TX result

Inside management frame TX status callback, print the TX result where it
was missing. This is useful for debugging management frame drops.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
8 years agotests: MBO non-preferred channel list
Jouni Malinen [Mon, 22 Feb 2016 17:51:36 +0000 (19:51 +0200)]
tests: MBO non-preferred channel list

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Parse non-preferred channel list on the AP
Jouni Malinen [Mon, 22 Feb 2016 18:37:21 +0000 (20:37 +0200)]
MBO: Parse non-preferred channel list on the AP

This adds parsing of non-preferred channel list on an MBO AP. The
information in (Re)Association Request and WNM Notification Request
frames is parsed to get the initial value and updates from each
associated MBO STA. The parsed information is available through the STA
control interface command non_pref_chan[i] rows.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WNM Sleep Mode - AP side OOM
Jouni Malinen [Mon, 22 Feb 2016 17:35:39 +0000 (19:35 +0200)]
tests: WNM Sleep Mode - AP side OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWNM: Fix a memory leak on AP error path
Jouni Malinen [Mon, 22 Feb 2016 17:34:06 +0000 (19:34 +0200)]
WNM: Fix a memory leak on AP error path

If the second memory allocation in ieee802_11_send_wnmsleep_resp() were
to fail and ieee80211_11_get_tfs_ie() succeed, the wnmtfs_ie allocation
would not have been freed on the error path.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoVLAN: Fix vlan_compare() for tagged VLANs
Michael Braun [Sun, 21 Feb 2016 11:01:39 +0000 (12:01 +0100)]
VLAN: Fix vlan_compare() for tagged VLANs

While refactoring VLAN comparison into vlan_compare(), it was overlooked
that modifications are needed for tagged VLAN support.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
8 years agohostapd_cli: Add support for RAW command
Dedy Lansky [Sun, 21 Feb 2016 12:49:44 +0000 (14:49 +0200)]
hostapd_cli: Add support for RAW command

Same as for wpa_cli, RAW command is a passthrough to hostapd control
interface.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
8 years agoMBO: Mandate use of PMF for WPA2+MBO association (STA)
Jouni Malinen [Mon, 22 Feb 2016 14:46:29 +0000 (16:46 +0200)]
MBO: Mandate use of PMF for WPA2+MBO association (STA)

If WPA2 is used, MBO AP must enable PMF. Refuse to select a BSS that has
MBO and WPA2 enabled without PMF.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Mandate use of PMF for WPA2+MBO association (AP)
Jouni Malinen [Mon, 22 Feb 2016 14:39:24 +0000 (16:39 +0200)]
MBO: Mandate use of PMF for WPA2+MBO association (AP)

If WPA2 and MBO are enabled, PMF needs to be enabled in hostapd
configuration. If PMF is optional in the configuration, an MBO STA is
required to negotiate use of PMF.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: MBO cellular data capability update with PMF required
Jouni Malinen [Mon, 22 Feb 2016 14:26:29 +0000 (16:26 +0200)]
tests: MBO cellular data capability update with PMF required

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: MBO cellular data capability update
Jouni Malinen [Mon, 22 Feb 2016 10:06:33 +0000 (12:06 +0200)]
tests: MBO cellular data capability update

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Update STA cellular data capability based on WNM Notification
Jouni Malinen [Mon, 22 Feb 2016 11:24:21 +0000 (13:24 +0200)]
MBO: Update STA cellular data capability based on WNM Notification

This makes hostapd parse a received WNM Notification Request frame
subelements and if a WFA MBO cellular data capability subelement is
seen, update the cellular data capability for the STA.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Track STA cellular data capability from association request
Jouni Malinen [Mon, 22 Feb 2016 11:03:28 +0000 (13:03 +0200)]
MBO: Track STA cellular data capability from association request

This makes hostapd parse the MBO attribute in (Re)Association Request
frame and track the cellular data capability (mbo_cell_capa=<val> in STA
control interface command).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWNM: Minimal processing for WNM Notification Request frames on AP
Jouni Malinen [Mon, 22 Feb 2016 10:41:48 +0000 (12:41 +0200)]
WNM: Minimal processing for WNM Notification Request frames on AP

Write debug log entries on receiving WNM Notification Request frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Indicate WNM-Notification support on AP when MBO is enabled
Jouni Malinen [Mon, 22 Feb 2016 10:41:00 +0000 (12:41 +0200)]
MBO: Indicate WNM-Notification support on AP when MBO is enabled

This is needed to allow MBO STAs to send WNM Notification Request
frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoSimplify hostapd_build_ap_extra_ies() with helper functions
Jouni Malinen [Mon, 22 Feb 2016 09:37:03 +0000 (11:37 +0200)]
Simplify hostapd_build_ap_extra_ies() with helper functions

This removes multiple copies of wpabuf_resize() following by
wpabuf_put_{buf,data}() with the help of two simple helper functions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WNM BSS Transition Management query
Jouni Malinen [Mon, 22 Feb 2016 08:57:37 +0000 (10:57 +0200)]
tests: WNM BSS Transition Management query

This tests BSS Transition Management Query frame generation with
candidate list and transmission of the following request and response
frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMBO: Expire non-matching bss_tmp_disallowed entries as part of check
Jouni Malinen [Sun, 21 Feb 2016 21:01:45 +0000 (23:01 +0200)]
MBO: Expire non-matching bss_tmp_disallowed entries as part of check

This makes wpa_is_bss_tmp_disallowed() expire old entries from the
bss_tmp_disallowed list even if they do not match the BSSID that is
being searched for. This allows the list to be kept at shorter length to
speed up operations and minimize memory use in cases where the
previously disabled BSS is not in radio range anymore.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoMBO: Parse MBO IE in ieee802_11_parse_elems()
Jouni Malinen [Sun, 21 Feb 2016 18:54:23 +0000 (20:54 +0200)]
MBO: Parse MBO IE in ieee802_11_parse_elems()

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoMBO: Send WNM-Notification when cellular capabilities change
Avraham Stern [Mon, 15 Feb 2016 14:54:02 +0000 (16:54 +0200)]
MBO: Send WNM-Notification when cellular capabilities change

Send a WNM-Notification to the associated AP to indicate changes in
cellular data capabilities.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agotests: MBO association disallowed indication
Avraham Stern [Mon, 15 Feb 2016 14:53:55 +0000 (16:53 +0200)]
tests: MBO association disallowed indication

Add a test that verifies that no Association Request frame is sent to
APs that include the MBO IE with association disallowed attribute in
Beacon and Probe Response frames.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agotests: WNM BSS Transition Management with MBO IE
Avraham Stern [Mon, 15 Feb 2016 14:53:54 +0000 (16:53 +0200)]
tests: WNM BSS Transition Management with MBO IE

Add tests to verify that MBO IE in BSS Transition Management Request
frame is parsed correctly:

1. The MBO transition reason code is received by the MBO station.
2. The MBO cellular data connection preference is received by the
   MBO station.
3. The MBO station does not try to connect to the AP until the retry
   delay is over.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agotests: Enable CONFIG_MBO in hwsim configs
Ilan Peer [Mon, 15 Feb 2016 14:53:58 +0000 (16:53 +0200)]
tests: Enable CONFIG_MBO in hwsim configs

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agohostapd: Add MBO IE to BSS Transition Management Request frame
Avraham Stern [Mon, 15 Feb 2016 14:53:49 +0000 (16:53 +0200)]
hostapd: Add MBO IE to BSS Transition Management Request frame

Add an option to add MBO IE to BSS Transition Management Request frame.
The MBO IE includes the transition reason code, cellular data connection
preference, and, if the disassoc imminent bit is set, it may also
include re-association retry delay. Otherwise, the re-association retry
delay should be set to zero.

The additional BSS_TM_REQ argument uses the following format:
mbo=<reason>:<reassoc delay>:<cell pref>
reason: 0-9
reassoc delay: 0-65535 (seconds; 0 = disabled)
cell pref: 0, 1, 255

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agohostapd: Add MBO IE to Beacon, Probe Response, Association Response
Avraham Stern [Mon, 15 Feb 2016 14:53:52 +0000 (16:53 +0200)]
hostapd: Add MBO IE to Beacon, Probe Response, Association Response

Add MBO IE with AP capability attribute to Beacon, Probe Response, and
(Re)Association Response frames to indicate the AP supports MBO.

Add option to add Association Disallowed attribute to Beacon, Probe
Response, and (Re)Association Response frames. Usage:

SET mbo_assoc_disallow <reason code>

Valid reason code values are between 1-5. Setting the reason code to
0 will remove the Association Disallowed attribute from the MBO IE
and will allow new associations.

MBO functionality is enabled by setting "mbo=1" in the config file.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoMove Hotspot 2.0 element in (Re)Association Request frames
Avraham Stern [Mon, 15 Feb 2016 14:53:48 +0000 (16:53 +0200)]
Move Hotspot 2.0 element in (Re)Association Request frames

According to IEEE Std 802.11-2012, Table 8-22, vendor specific elements
must follow all other elements, so Hotspot 2.0 element which is actually
a vendor specific element must come after all other elements.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoRe-order elements in (Re)Association Request frames
Avraham Stern [Mon, 15 Feb 2016 14:53:48 +0000 (16:53 +0200)]
Re-order elements in (Re)Association Request frames

According to IEEE Std 802.11-2012, Table 8-22, RM Enabled Capabilities
element must come before the Extended Capabilities element.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoWNM: Add candidate list to BSS transition query
Avraham Stern [Mon, 15 Feb 2016 14:53:43 +0000 (16:53 +0200)]
WNM: Add candidate list to BSS transition query

Add an option to configure a candidate list to BSS transition query
("list" as the second argument to WNM_BSS_QUERY). The candidate list is
built from the available scan results. If no updated scan results (< 10
sec) are available, the command fails.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoWNM: Add candidate list to BSS transition response
Avraham Stern [Mon, 15 Feb 2016 14:53:41 +0000 (16:53 +0200)]
WNM: Add candidate list to BSS transition response

Add the transition candidate list to BSS Transition Management Response
frame. The candidates preference is set using the regular wpa_supplicant
BSS selection logic. If the BSS transition request is rejected and
updated scan results are not available, the list is not added.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoutils: Derive phy type by frequency and bandwidth
David Spinadel [Mon, 15 Feb 2016 14:53:40 +0000 (16:53 +0200)]
utils: Derive phy type by frequency and bandwidth

Add a function to derive phy type from frequency and bandwidth
as defined in IEEE Std 802.11ac-2013 Annex C (dot11PHYType).

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Add MBO IE to BSS Transition Management Response frame
Avraham Stern [Mon, 15 Feb 2016 14:53:37 +0000 (16:53 +0200)]
MBO: Add MBO IE to BSS Transition Management Response frame

When rejecting a BSS Transition Management Request frame, add MBO IE to
the BSS Transition Management Response frame to specify the transition
rejection reason.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoMBO: Parse MBO IE in BSS Transition Management Request frames
Avraham Stern [Mon, 15 Feb 2016 14:53:36 +0000 (16:53 +0200)]
MBO: Parse MBO IE in BSS Transition Management Request frames

Add parsing of MBO IE in BSS Transition Management Request frames. If
the MBO IE includes the association retry delay attribute, do not try to
reconnect to the current BSS until the delay time is over.

If the MBO IE includes the cellular data connection preference attribute
or the transition rejection reason attribute, send a message to upper
layers with the data.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoMBO: Add Supported Operating Classes element to Association Request
Avraham Stern [Mon, 15 Feb 2016 14:53:34 +0000 (16:53 +0200)]
MBO: Add Supported Operating Classes element to Association Request

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoMBO: Add global operating class definitions
Avraham Stern [Mon, 15 Feb 2016 14:53:32 +0000 (16:53 +0200)]
MBO: Add global operating class definitions

Add definitions for global operating classes. These definitions will be
used to construct supported operating classes information element.

The operating classes definitions used locally for P2P module will be
removed and included in the general operating classes definitions.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agoMBO: Prevent association to APs that explicitly disallow this
David Spinadel [Mon, 15 Feb 2016 14:53:29 +0000 (16:53 +0200)]
MBO: Prevent association to APs that explicitly disallow this

Prevent association to MBO APs that have association disallowed
attribute in MBO IE in Beacon or Probe Response frames.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Add cellular capability to MBO IE
David Spinadel [Mon, 15 Feb 2016 14:53:28 +0000 (16:53 +0200)]
MBO: Add cellular capability to MBO IE

Add cellular capability attribute to MBO IE and add MBO IE with cellular
capabilities to Probe Request frames. By default, cellular capability
value is set to Not Cellular capable (3).

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Send MBO WNM-Notification Request frames to notify changes
David Spinadel [Mon, 15 Feb 2016 14:53:25 +0000 (16:53 +0200)]
MBO: Send MBO WNM-Notification Request frames to notify changes

Send a WNM-Notification Request frame with Non-preferred Channel Report
subelement if the non-preferred channels list changes during an
association.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Implement MBO non-preferred channel report in Association Request
David Spinadel [Mon, 15 Feb 2016 14:53:24 +0000 (16:53 +0200)]
MBO: Implement MBO non-preferred channel report in Association Request

Add MBO IE with non-preferred channels to (Re)Association Request
frames.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Add non-preferred channel configuration in wpa_supplicant
David Spinadel [Mon, 15 Feb 2016 14:53:22 +0000 (16:53 +0200)]
MBO: Add non-preferred channel configuration in wpa_supplicant

Add non-preferred channel configuration to wpa_config for MBO.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
8 years agoMBO: Add Multi Band Operation definitions
David Spinadel [Mon, 15 Feb 2016 14:53:19 +0000 (16:53 +0200)]
MBO: Add Multi Band Operation definitions

These are based on the specification draft WFA_MBO_TechSpec_v0.0_r19.

Signed-off-by: David Spinadel <david.spinadel@intel.com>