mech_eap.git
9 years agoP2P: Add support for 60 GHz social channel
Ahmad Masri [Thu, 25 Sep 2014 09:42:07 +0000 (12:42 +0300)]
P2P: Add support for 60 GHz social channel

Support 60 GHz band in P2P module by selecting random social channel
from all supported social channels in 2.4 GHz and 60 GHz bands.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoExtend STATUS command with frequency information
Bojan Prtvar [Sat, 13 Sep 2014 16:24:04 +0000 (18:24 +0200)]
Extend STATUS command with frequency information

This makes 'wpa_cli status' command more versatile.

Signed-off-by: Bojan Prtvar <bojan.prtvar@rt-rk.com>
9 years agohostapd: Avoid dead code with P2P not enabled
Philippe De Swert [Tue, 23 Sep 2014 07:08:30 +0000 (10:08 +0300)]
hostapd: Avoid dead code with P2P not enabled

In case P2P is not enabled the if (dev_addr) is always ignored as
dev_addr will be NULL. As this code is relevant only to P2P, it can be
moved to be the ifdef to avoid static analyzer warnings. (CID 72907)

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
9 years agodbus: Add a global property to set or unset WFD IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:31 +0000 (08:04 +0300)]
dbus: Add a global property to set or unset WFD IEs

This permits to set or unset the WiFi Display subelements from DBus, by
providing the full WFD specific IE frame.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agowifi_display: Add a utility function to set WFD subelements from IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:30 +0000 (08:04 +0300)]
wifi_display: Add a utility function to set WFD subelements from IEs

This will be useful to update the WFD subelements from DBus.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agowifi_display: Add a utility function to get the sub-elements as IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:29 +0000 (08:04 +0300)]
wifi_display: Add a utility function to get the sub-elements as IEs

This will be useful for DBus API to expose current WFD configuration.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoutil: Don't use "\e"
Bernhard Walle [Tue, 16 Sep 2014 19:20:47 +0000 (21:20 +0200)]
util: Don't use "\e"

'\e' representing ESC (0x1b) is not C standard, it's an GNU extension.
https://gcc.gnu.org/onlinedocs/gcc/Character-Escapes.html#Character-Escapes

Since the code also compiles on Windows with Microsoft compiler, we
should use '\033' instead.

Note: I didn't try to build the whole wpa_supplicant on Windows, so I
don't know if it still builds (I have no Visual Studio 2005 for a quick
test). I just needed the string conversion routines for the P"" syntax
in both directions.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
9 years agotests: P2P_PROV_DISC auto
Jouni Malinen [Sun, 28 Sep 2014 15:56:06 +0000 (18:56 +0300)]
tests: P2P_PROV_DISC auto

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: P2P service discovery no protocol/match cases
Jouni Malinen [Sun, 28 Sep 2014 15:44:24 +0000 (18:44 +0300)]
tests: P2P service discovery no protocol/match cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Increase P2P persistent group with per-STA PSK coverage
Jouni Malinen [Sun, 28 Sep 2014 15:09:53 +0000 (18:09 +0300)]
tests: Increase P2P persistent group with per-STA PSK coverage

Remove and re-start the persistent group manually to increase test
coverage to include the case of re-configuring the PSK list entries from
a stored persistent group.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make ap_hs20_random_mac_addr more robust
Jouni Malinen [Sun, 28 Sep 2014 14:51:09 +0000 (17:51 +0300)]
tests: Make ap_hs20_random_mac_addr more robust

If the previuous test case used a non-RSN AP and that was left in
cfg80211 scan results, it was possible for ap_hs20_random_mac_addr to
pick that old AP from the previous test and reject to connect through
Hotspot 2.0 mechanisms. Work around this test issue by requesting new
set of scan result at the beginning of the test.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WPS while connected
Jouni Malinen [Sun, 28 Sep 2014 08:03:21 +0000 (11:03 +0300)]
tests: WPS while connected

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoap_config.c: fix typo for "capabilities"
Stefan Lippers-Hollmann [Tue, 16 Sep 2014 23:22:06 +0000 (01:22 +0200)]
ap_config.c: fix typo for "capabilities"

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
9 years agoWPS: Fix WPS-in-search check when STA_AUTOCONNECT is disabled
Jouni Malinen [Sat, 27 Sep 2014 19:41:28 +0000 (22:41 +0300)]
WPS: Fix WPS-in-search check when STA_AUTOCONNECT is disabled

If "STA_AUTOCONNECT 0" has been used to disable automatic connection on
disconnection event and the driver indicates multiple disconnection
events for the disconnection from the current AP when WPS is started, it
could have been possible to hit a case where wpa_s->disconnected was set
to 1 during WPS processing and the following scan result processing
would stop the operation.

wpa_s->key_mgmt == WPA_KEY_MGMT_WPS check was trying to avoid to skip
autoconnect when WPS was in use, but that does not seem to work anymore.
Fix this by checking through wpas_wps_searching() as well to avoid
setting wpa_s->disconnect = 1 when there is an ongoing WPS operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Remove unecessary sanity check for global p2p
Eduardo Abinader [Sat, 20 Sep 2014 20:51:01 +0000 (16:51 -0400)]
P2P: Remove unecessary sanity check for global p2p

This check is already being done on wpas_p2p_deinit_iface.
Of course, it is assumed wpa_s is not deinit when reaches
that point as a matter of fact.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agoP2P: Flush services based on global p2p init and not p2p ifaces
Eduardo Abinader [Sat, 20 Sep 2014 20:51:00 +0000 (16:51 -0400)]
P2P: Flush services based on global p2p init and not p2p ifaces

As P2P service are not necessarily attached to a iface, when
added, proceed with same approach on p2p global deinit. Such
approach solves memory leaks ocurring upon wpa_supplicant
termination, when p2p services were registered previously.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agoP2P: Decrement sd_pending_bcast_queries when sd returns success
Constantin Musca [Mon, 22 Sep 2014 12:00:37 +0000 (15:00 +0300)]
P2P: Decrement sd_pending_bcast_queries when sd returns success

The sd_pending_bcast_queries variable should be decremented only
in case of success. This way, the supplicant can retry if a service
discovery request fails.

Signed-off-by: Constantin Musca <constantin.musca@intel.com>
9 years agonl80211: Fix memory leak on start radar detection error path
Janusz Dziedzic [Fri, 26 Sep 2014 18:21:25 +0000 (20:21 +0200)]
nl80211: Fix memory leak on start radar detection error path

Free nlmsg if failing to start radar detection.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agohostap: nl80211 use nl80211_put_freq_params
Janusz Dziedzic [Fri, 26 Sep 2014 18:21:24 +0000 (20:21 +0200)]
hostap: nl80211 use nl80211_put_freq_params

Use nl80211_put_freq_params when it possible. Remove
duplicated code.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agotests: Random MAC address use
Jouni Malinen [Sat, 27 Sep 2014 16:12:32 +0000 (19:12 +0300)]
tests: Random MAC address use

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd support for using random local MAC address
Jouni Malinen [Sat, 27 Sep 2014 16:12:41 +0000 (19:12 +0300)]
Add support for using random local MAC address

This adds experimental support for wpa_supplicant to assign random local
MAC addresses for both pre-association cases (scan, GAS/ANQP) and for
connections. MAC address policy for each part can be controlled
separately and the connection part can be set per network block.

This requires support from the driver to allow local MAC address to be
changed if random address policy is enabled. It should also be noted
that number of drivers would not support concurrent operations (e.g.,
P2P and station association) with random addresses in use for one or
both.

This functionality can be controlled with the global configuration
parameters mac_addr and preassoc_mac_addr which set the default MAC
address policies for connections and pre-association operations (scan
and GAS/ANQP while not connected). The global rand_addr_lifetime
parameter can be used to set the lifetime of a random MAC address in
seconds (default: 60 seconds). This is used to avoid unnecessarily
frequent MAC address changes since those are likely to result in driver
clearing most of its state. It should be noted that the random MAC
address does not expire during an ESS connection, i.e., this lifetime is
only for the case where the device is disconnected.

The mac_addr parameter can also be set in the network blocks to define
different behavior per network. For example, the global mac_addr=1 and
preassoc_mac_addr=1 settings and mac_addr=0 in a home network profile
would result in behavior where all scanning is performed using a random
MAC address while connections to new networks (e.g.,
Interworking/Hotspot 2.0) would use random address and connections to
the home network would use the permanent MAC address.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd helper function for generating random MAC addresses
Jouni Malinen [Sat, 27 Sep 2014 16:12:02 +0000 (19:12 +0300)]
Add helper function for generating random MAC addresses

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Add command for changing local MAC address
Jouni Malinen [Sat, 27 Sep 2014 16:11:24 +0000 (19:11 +0300)]
nl80211: Add command for changing local MAC address

This can be used to allow wpa_supplicant to control local MAC address
for connections.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make ap_wps_er_add_enrollee more robust under load
Jouni Malinen [Sat, 27 Sep 2014 13:17:17 +0000 (16:17 +0300)]
tests: Make ap_wps_er_add_enrollee more robust under load

The scan for WPS-AUTH validation may miss a Probe Response frame if the
hostapd process gets blocked under load, e.g., when testing with
parallel-vm.sh.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Set timeout when starting GO Negotiation from Probe Req RX
Jouni Malinen [Sat, 27 Sep 2014 10:44:03 +0000 (13:44 +0300)]
P2P: Set timeout when starting GO Negotiation from Probe Req RX

It was possible for the p2p_go_neg_start timeout handler to get called
when there was a pending timeout from an earlier GO Negotiation start.
This could result in that old timeout expiring too early for the newly
started GO Negotiation to complete. Avoid such issues by setting a
sufficiently long timeout here just before triggering the new GO
Negotiation.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Clear pending_listen_freq when starting GO Neg/Invite
Jouni Malinen [Sat, 27 Sep 2014 10:15:47 +0000 (13:15 +0300)]
P2P: Clear pending_listen_freq when starting GO Neg/Invite

Previously, it was possible for the p2p->pending_listen_freq to be left
at non-zero value if Probe Request frame was received from a peer with
which we were waiting to start GO Negotiation/Invite process. That could
result in the following Listen operation getting blocked in some
operation sequences if the peer did not acknowledge the following P2P
Public Action frame.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Ignore auth/assoc events when testing driver-SME
Jouni Malinen [Sat, 27 Sep 2014 09:53:17 +0000 (12:53 +0300)]
nl80211: Ignore auth/assoc events when testing driver-SME

Previously, extra connect/roam events were ignored when user space SME
was used to avoid confusing double events for association. However,
there was no matching code for ignoring auth/assoc events when using
driver SME. Such events would not normally show up since the driver SME
case would not generated them. However, when testing forced connect
command with force_connect_cmd=1 driver param, these events are
indicated.

Ignore the extra events in testing cases to make the hwsim test cases
match more closely the real code path for driver SME. In addition, this
resolves some test case failures where double association event could
end up causing a failure, e.g., when doing PMKSA caching in
pmksa_cache_oppurtunistic_connect.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix autogo_bridge to clear autoscan setting
Jouni Malinen [Sat, 27 Sep 2014 09:16:06 +0000 (12:16 +0300)]
tests: Fix autogo_bridge to clear autoscan setting

Previously, periodic autoscan could have been left running and that
could result in the following test cases failing in some cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make ap_hs20 test cases more robust
Jouni Malinen [Sat, 27 Sep 2014 09:08:21 +0000 (12:08 +0300)]
tests: Make ap_hs20 test cases more robust

Some of the test cases where using INTERWORKING_SELECT internally
without using scan_for_bss like the helper functions did. Add explicit
scan_for_bss calls to make the test cases less likely to fail due to
missing BSSes in scan results. This could cause false failure reports
when runnign under heavy load with parallel-vm.sh.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Use TYPE=ONLY scan for scan_for_bss
Jouni Malinen [Sat, 27 Sep 2014 13:11:28 +0000 (16:11 +0300)]
tests: Use TYPE=ONLY scan for scan_for_bss

This avoids unexpected connection attempts in cases a matching network
is enabled and there is no existing connection (e.g., when testing with
ENABLE_NETWORK no-connect option).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Skip ap_wpa2_tdls_concurrent_init on failure
Jouni Malinen [Sat, 27 Sep 2014 08:30:56 +0000 (11:30 +0300)]
tests: Skip ap_wpa2_tdls_concurrent_init on failure

A mac80211 TDLS validation change ended up breaking test functionality
that was needed for this test case. Instead of reporting this known
issue as a FAIL every time, mark the test as SKIP since the issues is
known and there are no plans of "fixing" it.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: PMKSA_FLUSH
Jouni Malinen [Sat, 27 Sep 2014 07:50:19 +0000 (10:50 +0300)]
tests: PMKSA_FLUSH

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd PMKSA_FLUSH ctrl_iface command
Ahmad Kholaif [Fri, 26 Sep 2014 17:20:21 +0000 (10:20 -0700)]
Add PMKSA_FLUSH ctrl_iface command

"PMKSA_FLUSH" can now be used to flush PMKSA cache entries over the
control interface.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_cli: Support action scripts with global ctrl_iface
Jouni Malinen [Fri, 26 Sep 2014 12:41:55 +0000 (15:41 +0300)]
wpa_cli: Support action scripts with global ctrl_iface

This extends "wpa_cli -a<action script>" functionality to work with the
global wpa_supplicant control interface. The IFNAME=<ifname> prefix is
removed from the event messages and converted to the control interface
name when present. Previously, action scripts could only be used with
the per-interface control interfaces.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_cli: Increase event buffer size to 4096 bytes
Jouni Malinen [Fri, 26 Sep 2014 12:26:43 +0000 (15:26 +0300)]
wpa_cli: Increase event buffer size to 4096 bytes

Number of other buffers were already increased to this size, but the
buffer used for receiving unsolicited event messages from wpa_supplicant
(e.g., for wpa_cli action scripts) was still at the older 256 byte size.
This could result in some events getting truncated. Avoid this by using
the same 4096 byte buffer size here as in the other places receiving
messages from wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_cli: Fix PING in interactive mode with ifname_prefix
Jouni Malinen [Fri, 26 Sep 2014 12:23:00 +0000 (15:23 +0300)]
wpa_cli: Fix PING in interactive mode with ifname_prefix

The ifname_prefix string could change during line editing and the
periodic PING command running in the background ended up getting the
latest snapshot of the command line due to the pointer being left to
point to the edit buffer. This resulted in unexpected prefix strings
getting used with the periodic PING command. Fix this by temporarily
clearing the ifname_prefix whenever running such a periodic PING.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoCheck for driver's DFS offload capability before handling DFS
Sunil Dutt [Mon, 22 Sep 2014 09:06:01 +0000 (14:36 +0530)]
Check for driver's DFS offload capability before handling DFS

This fixes couple of code paths where the WPA_DRIVER_FLAGS_DFS_OFFLOAD
flag was not checked properly and unexpected DFS operations were
initiated (and failed) in case the driver handles all these steps.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoSTA: Update scan results for ap_scan=1 skip-selection case also
Jouni Malinen [Mon, 18 Aug 2014 18:04:56 +0000 (11:04 -0700)]
STA: Update scan results for ap_scan=1 skip-selection case also

The commit 5cd4740580350371d77618ac037deef90b48d339 has rearranged the
update scan results code and hence the IEs were not getting updated
properly for ap_scan=1 case. This can result in a 4-way handshake
failure in the roaming case (IE mismatch in 3/4 EAPOL). Fix this by
updating the scan results even if ap_scan=1 is used and network does not
need to get reselected based on association information.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Add SignalPoll() method to report current signal properties
Dan Williams [Wed, 10 Sep 2014 17:34:56 +0000 (12:34 -0500)]
dbus: Add SignalPoll() method to report current signal properties

Analogous to the control interface's SIGNAL_POLL request.

Signed-hostap: Dan Williams <dcbw@redhat.com>

9 years agoAndroid: Add NO_EVENTS parameter to status command
vandwalle [Thu, 11 Sep 2014 18:40:14 +0000 (11:40 -0700)]
Android: Add NO_EVENTS parameter to status command

It also allows to use the STATUS command with default behavior,
say for debug, i.e., don't generate a "fake" CONNECTION and
SUPPLICANT_STATE_CHANGE events with the new STATUS-NO_EVENTS case.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoP2P: Check os_get_random() return value more consistently
Jouni Malinen [Sat, 13 Sep 2014 13:27:52 +0000 (16:27 +0300)]
P2P: Check os_get_random() return value more consistently

In theory, this call could fail, so check the return value before using
the received data. These specific cases would not really care much about
the failures, but this keeps the code more consistent and keeps static
analyzer warnings more useful. (CID 72678, CID 72679, CID 72680,
CID 72683, CID 72689, CID 72698, CID 72703)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS server: Remove unreachable code
Jouni Malinen [Sat, 13 Sep 2014 13:22:16 +0000 (16:22 +0300)]
RADIUS server: Remove unreachable code

The previous break will already stop the loop, so this unnecessary check
can be removed (CID 72708).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFT: Fix hostapd with driver-based SME to authorize the STA
Darshan Paranji Sri [Fri, 12 Sep 2014 15:46:56 +0000 (18:46 +0300)]
FT: Fix hostapd with driver-based SME to authorize the STA

The driver-based SME case did not set STA flags properly to the kernel
in the way that hostapd-SME did in ieee802_11.c. This resulted in the FT
protocol case not marking the STA entry authorized. Fix that by handling
the special WLAN_AUTH_FT case in hostapd_notif_assoc() and also add the
forgotten hostapd_set_sta_flags() call to synchronize these flag to the
driver.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Roaming policy change with the bssid parameter
Jouni Malinen [Thu, 11 Sep 2014 12:56:37 +0000 (15:56 +0300)]
tests: Roaming policy change with the bssid parameter

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Add roaming policy update using QCA vendor command
Jouni Malinen [Thu, 11 Sep 2014 12:54:57 +0000 (15:54 +0300)]
nl80211: Add roaming policy update using QCA vendor command

This allows updating roaming policy for drivers that select the BSS
internally so that wpa_supplicant (based on bssid parameter
configuration) and the driver remain in sync.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd support for driver command to update roaming policy
Jouni Malinen [Thu, 11 Sep 2014 12:52:37 +0000 (15:52 +0300)]
Add support for driver command to update roaming policy

The network block bssid parameter can be used to force a specific BSS to
be used for a connection. It is also possible to modify this parameter
during an association. Previously, that did not result in any
notification to the driver which was somewhat problematic with drivers
that take care of BSS selection. Add a new mechanism to allow
wpa_supplicant to provide a driver update if the bssid parameter change
for the current connection modifies roaming policy (roaming
allowed/disallowed within ESS).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Print debug info on STA flag changes
Jouni Malinen [Thu, 11 Sep 2014 08:25:04 +0000 (11:25 +0300)]
nl80211: Print debug info on STA flag changes

This makes it easier to follow how kernel STA flags are managed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Fix radio work issue with wait-for-peer GO Negotiation
Jouni Malinen [Tue, 9 Sep 2014 14:20:23 +0000 (17:20 +0300)]
P2P: Fix radio work issue with wait-for-peer GO Negotiation

If a TX status event and RX event for a GO Negotiation frame gets
delayed long enough to miss the initial wait, it was possible for
reception of a GO Negotiation Response frame with status 1 to try to
initiate a new p2p-listen work item to wait for the peer to become ready
while a previous p2p-listen was already in progress due to that earlier
timeout while waiting for peer. This would result in the new
start_listen request getting rejected ("P2P: Reject start_listen since
p2p_listen_work already exists") and the negotiation not proceeding.

Work around this by using P2P_WAIT_PEER_CONNECT state instead of
P2P_WAIT_PEER_IDLE if P2P_CONNECT_LISTEN state has already been entered
when processing this special GO Negotiation Response status=1 case. This
can avoid double-scheduling of p2p-listen and as such, completion of the
GO negotiation even if the driver event or peer response are not
received in time (the response is supposed to be there within 100 ms per
spec, but there are number of deployed devices that do not really meet
this requirement).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWork around broken AP PMKSA caching implementation
Jouni Malinen [Mon, 8 Sep 2014 14:18:01 +0000 (17:18 +0300)]
Work around broken AP PMKSA caching implementation

An interoperability issue with a deployed AP has been identified where
the connection fails due to that AP failing to operate correctly if
PMKID is included in the Association Request frame. To work around this,
allow EAPOL-Start packet to be transmitted on startWhen reaching 0 even
when trying to use PMKSA caching. In practice, this allows fallback to
full EAP authentication if the AP/Authenticator takes more than 1-2
seconds to initiate 4-way handshake for PMKSA caching or full EAP
authentication if there was no PMKSA cache match.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWPS: Set EAPOL workarounds dynamically based on association
Jouni Malinen [Mon, 8 Sep 2014 13:49:08 +0000 (16:49 +0300)]
WPS: Set EAPOL workarounds dynamically based on association

Previously, the shorter startWhen value was used based on build
parameters (i.e., if WPS was enabled). This is not really ideal and the
knowledge of WPS use can be provided to the EAPOL state machine to allow
this (and similar WPS workarounds) to be done only when the association
is for the purpose of WPS.

Reduce the default startWhen value from 3 to 2 seconds for non-WPS case
since WPS builds have likely received most testing for the past years
with the 1 second value and there is no strong justification for forcing
the longer 3 second wait should a frame be lost or something else
require the EAPOL-Start to initiate operation after a connection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWPS: Extend internal entropy pool help for key/snonce derivation
Jouni Malinen [Mon, 8 Sep 2014 09:54:18 +0000 (12:54 +0300)]
WPS: Extend internal entropy pool help for key/snonce derivation

The internal entropy pool was previously used to prevent 4-way handshake
in AP mode from completing before sufficient entropy was available to
allow secure keys to be generated. This commit extends that workaround
for boards that do not provide secure OS level PRNG (e.g., /dev/urandom
does not get enough entropy) for the most critical WPS operations by
rejecting AP-as-enrollee case (use of AP PIN to learn/modify AP
configuration) and new PSK/passphrase generation. This does not have any
effect on devices that have an appropriately working OS level PRNG
(e.g., /dev/random and /dev/urandom on Linux).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoRemove WPA_EVENT_SCAN_STARTED message from MSG_INFO log
Dmitry Shmidt [Thu, 14 Aug 2014 23:56:00 +0000 (16:56 -0700)]
Remove WPA_EVENT_SCAN_STARTED message from MSG_INFO log

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoP2P: Deauth p2p client just after dbus notify
Eduardo Abinader [Thu, 21 Aug 2014 03:30:24 +0000 (23:30 -0400)]
P2P: Deauth p2p client just after dbus notify

Currently to signal PropertiesChanged upon group client
removal (group property), wpa_supplicant dbus uses wpa_s
members like go_dev_addr and current_ssid, for instance.
Thus, deferring p2p client deauth to after dbus notify,
but keeping the same order as before, solves the issue,
as wpa_s is not yet completely deinitialized.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agonl80211: Register eloop after hs20 action frame
Eduardo Abinader [Mon, 1 Sep 2014 03:20:21 +0000 (23:20 -0400)]
nl80211: Register eloop after hs20 action frame

Even when hs20 action frame is unable to be registered,
for whatever reason, it should be possible to register
event handle for received driver messages. This patch also
avoids a segmentation fault, when p2p and hs20 were enabled
and GO NEG was unable to create p2p iface, the destroy eloop
was crashing by reading an invalid handle.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agodbus: add BSS Age property to indicate last-seen time
Dan Williams [Thu, 4 Sep 2014 18:10:54 +0000 (13:10 -0500)]
dbus: add BSS Age property to indicate last-seen time

"Age" is the age in seconds since the BSS was last seen, and is
emitted as a PropertyChanged signal whenever the BSS is updated
from a scan result. It also returns the correct age when queried
directly.

This property can be used to resolve issues where, if no other
properties of the BSS changed from scan results (for example,
if the BSS always had 100% signal) no D-Bus signals would be
emitted to indicate that the BSS had just been seen in the scan.

Signed-hostap: Dan Williams <dcbw@redhat.com>

9 years agoopenssl: Fix memory leak in openssl ec deinit
Masashi Honma [Fri, 5 Sep 2014 06:42:32 +0000 (15:42 +0900)]
openssl: Fix memory leak in openssl ec deinit

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
9 years agoFix hostapd GET_CONFIG wpa_pairwise_cipher value
Jouni Malinen [Sun, 7 Sep 2014 15:40:05 +0000 (18:40 +0300)]
Fix hostapd GET_CONFIG wpa_pairwise_cipher value

Copy-paste error ended up getting rsn_pairwise_cipher value for both
rsn_pairwise_cipher and wpa_pairwise_cipher (CID 72693).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS client: Check getsockname() return value
Jouni Malinen [Sun, 7 Sep 2014 15:35:46 +0000 (18:35 +0300)]
RADIUS client: Check getsockname() return value

In theory, this function could fail, so check the return value before
printing out the RADIUS local address debug message (CID 72700).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHTTP: Fix OCSP status check
Jouni Malinen [Sun, 7 Sep 2014 15:30:58 +0000 (18:30 +0300)]
HTTP: Fix OCSP status check

Due to a missing curly brackets, the OCSP status checking was not
working in the expected way. Instead of allowing optional-OCSP
configuration to accept connection when OCSP response was ready, all
such cases were marked as hard failures. In addition, the debug prints
were not necessarily accurate for the mandatory-OCSP-but-no-response
case (CID 72694, CID 72704).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSME: Verify that os_get_random() succeeds for SA Query
Jouni Malinen [Sun, 7 Sep 2014 15:27:42 +0000 (18:27 +0300)]
SME: Verify that os_get_random() succeeds for SA Query

Be more consistent on checking os_get_random() return value (CID 72706).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS server: Fix IPv6 radiusAuthClientAddress mask
Jouni Malinen [Sun, 7 Sep 2014 15:25:04 +0000 (18:25 +0300)]
RADIUS server: Fix IPv6 radiusAuthClientAddress mask

Incorrect buffer was used when writing the IPv6 mask for RADIUS server
MIB information (CID 72707).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Verify that os_get_random() succeeds
Jouni Malinen [Sun, 7 Sep 2014 15:05:53 +0000 (18:05 +0300)]
P2P: Verify that os_get_random() succeeds

Be more consistent with os_get_random() use (CID 72710).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-PAX server: Add explicit CID length limit
Jouni Malinen [Sun, 7 Sep 2014 14:10:33 +0000 (17:10 +0300)]
EAP-PAX server: Add explicit CID length limit

Instead of using implicit limit based on 16-bit unsigned integer having
a maximum value of 65535, limit the maximum length of a CID explicitly
to 1500 bytes. This will hopefully help in reducing false warnings from
static analyzers (CID 72712).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRemove unnecessarily shadowed local variable
Jouni Malinen [Sun, 7 Sep 2014 13:40:33 +0000 (16:40 +0300)]
Remove unnecessarily shadowed local variable

The same local X509 *cert variable can be used for both the X509_dup()
calls.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowlantest: Add decryption of CCMP-256, GCMP, GCMP-256
Ashok Kumar Ponnaiah [Fri, 29 Aug 2014 13:05:05 +0000 (16:05 +0300)]
wlantest: Add decryption of CCMP-256, GCMP, GCMP-256

This extends wlantest support for decrypting the new cipher suites.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowlantest: Indicate if a TKIP/CCMP replay has Retry=1
Ashok Kumar Ponnaiah [Fri, 29 Aug 2014 13:04:08 +0000 (16:04 +0300)]
wlantest: Indicate if a TKIP/CCMP replay has Retry=1

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowlantest: Recognize CCMP-256, GCMP, and GCMP-256 ciphers
Ashok Kumar Ponnaiah [Fri, 29 Aug 2014 13:03:01 +0000 (16:03 +0300)]
wlantest: Recognize CCMP-256, GCMP, and GCMP-256 ciphers

This adds support for displaying whether a BSS or STA is using one of
the newer cipher suites.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd: Remove unused variable assignment
Jouni Malinen [Wed, 3 Sep 2014 12:37:58 +0000 (15:37 +0300)]
hostapd: Remove unused variable assignment

The local bss variable is used only within the while loop, so no need to
assign or even make it visible outside the loop.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoTDLS: Decline Setup Request with status code 37 if BSSID does not match
Sunil Dutt [Tue, 2 Sep 2014 13:13:54 +0000 (18:43 +0530)]
TDLS: Decline Setup Request with status code 37 if BSSID does not match

TDLS Setup Request frame has to be rejected with status code 37 ("The
request has been declined"), if the BSSID in the received Link
Identifier does not match the current BSSID per IEEE Std 802.11-2012,
10.22.4 ('TDLS direct-link establishment') step (b). The previously used
status code 7 ('Not in same BSS') is described to used only when
processing TPK Handshake Message 2 in TDLS Setup Response frame.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoTDLS: Add RSN and Timeout interval IEs in TDLS Discovery Response frame
Mahesh A Saptasagar [Thu, 28 Aug 2014 09:22:25 +0000 (14:52 +0530)]
TDLS: Add RSN and Timeout interval IEs in TDLS Discovery Response frame

If RSN is enabled, add RSN and Timeout interval elements in TDLS
Discovery Response frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Do not add P2P IEs on P2P disabled interface
Edhar, Mahesh Kumar [Tue, 2 Sep 2014 05:03:44 +0000 (10:33 +0530)]
P2P: Do not add P2P IEs on P2P disabled interface

While building Association Request frame IEs we should consider adding
P2P IEs only on interface where P2P functionality is enabled. Consider
per interface p2p_disabled parameter before adding P2P IEs to complete
the checks for this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P GO netdev in a bridge
Jouni Malinen [Mon, 1 Sep 2014 13:27:27 +0000 (16:27 +0300)]
tests: P2P GO netdev in a bridge

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Add more RTM_NEWLINK/DELLINK debug messages
Jouni Malinen [Mon, 1 Sep 2014 13:18:01 +0000 (16:18 +0300)]
nl80211: Add more RTM_NEWLINK/DELLINK debug messages

This makes it easier to figure out what operations are generating each
RTM_DELLINK message.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Fix RTM_DELLINK processing for bridge events
Jouni Malinen [Mon, 1 Sep 2014 13:14:07 +0000 (16:14 +0300)]
nl80211: Fix RTM_DELLINK processing for bridge events

When a netdev is removed from a bridge, RTM_DELLINK message is received
with ifname (IFLA_IFNAME) pointing to the main netdev event though that
netdev is not deleted. This was causing issues with P2P GO interface
getting disabled when the netdev was removed from a bridge. Fix this by
filtering RTM_DELLINK events that are related to the bridge when
indicating interface status changes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPS mixed-WPA/WPA2 credential merging
Jouni Malinen [Fri, 29 Aug 2014 17:13:35 +0000 (20:13 +0300)]
tests: WPS mixed-WPA/WPA2 credential merging

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWPS: Merge mixed-WPA/WPA2 credentials if received in same session
Hu Wang [Fri, 29 Aug 2014 17:11:13 +0000 (20:11 +0300)]
WPS: Merge mixed-WPA/WPA2 credentials if received in same session

Some deployed APs send two credentials when in mixed-WPA/WPA2
configuration; one for the WPA-Personal/TKIP and the other for
WPA2-Personal/CCMP. Previously, this would result in two network blocks
getting added for the single AP. This can be somewhat confusing and
unnecessary, so merge such credentials into a single one that allows
both WPA and WPA2 to be used.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd printf NULL checks to silence static analyzer
Srinivas Girigowda [Thu, 28 Aug 2014 15:25:32 +0000 (18:25 +0300)]
Add printf NULL checks to silence static analyzer

Add NULL checks to take care of issues reported by static analyzer tool
on potentially using NULL with printf format %s (which has undefined
behavior even though many compilers end up printing "(null)").

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Verify that sec_dev_type gets reported for P2P peer
Jouni Malinen [Wed, 27 Aug 2014 13:22:53 +0000 (16:22 +0300)]
tests: Verify that sec_dev_type gets reported for P2P peer

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Overwrite pending interface only after verifying BSS entry
Chandrasekaran, Manishekar [Thu, 14 Aug 2014 11:14:32 +0000 (16:44 +0530)]
P2P: Overwrite pending interface only after verifying BSS entry

Previously, the P2P Interface Address of the peer gets updated in the
peer table every time based on the scan results.

For example, in a two port concurrency scenario, where the peer device
has two interfaces with unique P2P Interface Addresses and with same P2P
Device Address, based on the Probe Response/Beacon frames from these two
interfaces, their peer table gets updated, but each of these updates
happens in the peer table only based on the P2P Device Address. So, the
same peer's P2P Interface address is updated every time and hence, at
any instant, only one P2P Device Address to P2P Interface Address
mapping entry exist in the peer table for the peer which has two
interfaces.

When we try to join a group operated by the peer, lookup happens in the
peer table and when an interface entry is not available, the pending
interface address gets overwritten with the P2P Device Address and hence
the P2P connection can fail. Since the BSS table is the one that is
up-to-date, this fix will ensure that the interface overwriting will
happen only when there is no BSS entry for the pending P2P Interface
Address as well.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P GO channel preference and regulatory rule mismatch
Jouni Malinen [Tue, 26 Aug 2014 14:57:26 +0000 (17:57 +0300)]
tests: P2P GO channel preference and regulatory rule mismatch

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd: Check that EVENT_ASSOC data is present before using it
Jouni Malinen [Tue, 26 Aug 2014 14:23:02 +0000 (17:23 +0300)]
hostapd: Check that EVENT_ASSOC data is present before using it

While hostapd should not really receive the EVENT_ASSOC message for
IBSS, driver_nl80211.c could potentially generate that if something
external forces the interface into IBSS mode and the IBSS case does not
provide the struct assoc_info data. Avoid the potential NULL pointer
dereference by explicitly verifying for the event data to be present.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_supplicant: Use freq_list scan filtar in sched_scan
Bojan Prtvar [Mon, 11 Aug 2014 10:25:03 +0000 (12:25 +0200)]
wpa_supplicant: Use freq_list scan filtar in sched_scan

Global freq_list scan filtar was taken into account only by
req_scan and not by req_sched_scan. We want to allow the user
to limit the channels that wpa_supplicant will scan in req_sched_scan
requests as well.

Signed-off-by: Bojan Prtvar <bojan.prtvar@rt-rk.com>
9 years agodbus: Close dbus dict just after appending data
Eduardo Abinader [Sun, 3 Aug 2014 22:48:15 +0000 (18:48 -0400)]
dbus: Close dbus dict just after appending data

Before fixing this issue, calling wpas_dbus_getter_p2p_device_config
was causing early termination of dbus connection, due to writing
values to an already closed dict.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agonl80211: Disable Probe Request reporting for static AP during deinit
Avinash Patil [Tue, 5 Aug 2014 07:20:53 +0000 (12:50 +0530)]
nl80211: Disable Probe Request reporting for static AP during deinit

Disable Probe Request reporting for statically created AP interfaces
during de-initialization. We will enable it again while starting AP
operations.

Signed-off-by: Avinash Patil <avinashapatil@gmail.com>
9 years agonl80211: Do not change iftype for static AP interface
Avinash Patil [Tue, 5 Aug 2014 07:19:46 +0000 (12:49 +0530)]
nl80211: Do not change iftype for static AP interface

Some devices have limitations which do not allow changing virtual
interface mode from AP to station or vice versa. To work around this,
check if such AP interface is not dynamic. If such an interface is
enumarated, just set ifmode to AP and avoid setting nlmode to default
station mode on deinit.

Signed-off-by: Avinash Patil <avinashapatil@gmail.com>
9 years agowext: Add signal_poll callback
Jean-Marie Lemetayer [Fri, 8 Aug 2014 08:45:00 +0000 (10:45 +0200)]
wext: Add signal_poll callback

Add a basic implementation of a signal_poll callback for wext drivers.

Signed-off-by: Jean-Marie Lemetayer <jeanmarie.lemetayer@gmail.com>
9 years agoP2P: Use ssid instead of wpa_ssid to find GO iface
Eduardo Abinader [Fri, 8 Aug 2014 10:51:23 +0000 (06:51 -0400)]
P2P: Use ssid instead of wpa_ssid to find GO iface

In order to find a GO interface, there has to be a
comparison among two SSIDs, instead of a wpa_ssid and
a ssid.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agoAdd RSN cipher/AKM suite attributes into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:53:25 +0000 (19:53 +0300)]
Add RSN cipher/AKM suite attributes into RADIUS messages

This adds hostapd support for the new WLAN-Pairwise-Cipher,
WLAN-Group-Cipher, WLAN-AKM-Suite, and WLAN-Group-Mgmt-Pairwise-Cipher
attributes defined in RFC 7268. These attributes are added to RADIUS
messages when the station negotiates use of WPA/RSN.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd WLAN-HESSID into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:11:31 +0000 (19:11 +0300)]
Add WLAN-HESSID into RADIUS messages

This adds hostapd support for the new WLAN-HESSID attribute defined in
RFC 7268. This attribute contains the HESSID and it is added whenever
Interworking is enabled and HESSID is configured.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd Mobility-Domain-Id into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:00:37 +0000 (19:00 +0300)]
Add Mobility-Domain-Id into RADIUS messages

This adds hostapd support for the new Mobility-Domain-Id attribute
defined in RFC 7268. This attribute contains the mobility domain id and
it is added whenever the station negotiates use of FT.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Declare and implement GroupFinished as for GroupStarted
Tomasz Bursztyka [Tue, 8 Jul 2014 12:56:11 +0000 (15:56 +0300)]
dbus: Declare and implement GroupFinished as for GroupStarted

First for better concistancy but also to tell about the group_object
that is getting removed, thus the client will know about it and will be
able to act accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P: Cancel pending action TX radio work on p2p_cancel
Jithu Jance [Tue, 29 Jul 2014 13:04:32 +0000 (18:34 +0530)]
P2P: Cancel pending action TX radio work on p2p_cancel

When p2p_cancel is invoked while the GO Negotiation Action TX was
pending, the p2p_send_action_work was not getting cleared.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
9 years agoFix writing of the wowlan_triggers parameter
Philippe Nunes [Wed, 23 Jul 2014 10:16:41 +0000 (12:16 +0200)]
Fix writing of the wowlan_triggers parameter

The parameter wowlan_triggers is a global string and is not recognised
if it is embraced with double-quotes.

Signed-off-by: Philippe Nunes <philippe.nunes@linux.intel.com>
9 years agoAndroid: Always #include <sys/...>, not <linux/...>
Elliott Hughes [Sat, 19 Jul 2014 00:45:49 +0000 (17:45 -0700)]
Android: Always #include <sys/...>, not <linux/...>

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoEAP-FAST server: Fix potential read-after-buffer (by one byte)
Jouni Malinen [Sat, 26 Jul 2014 18:12:49 +0000 (21:12 +0300)]
EAP-FAST server: Fix potential read-after-buffer (by one byte)

The special PAC_OPAQUE_TYPE_PAD case did not skip incrementing of the
pos pointer and could result in one octet read-after-buffer when parsing
the PAC-Opaque data.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoInterworking: Remove unnecessary placeholder for PAME-BI
Jouni Malinen [Sat, 26 Jul 2014 17:28:03 +0000 (20:28 +0300)]
Interworking: Remove unnecessary placeholder for PAME-BI

The PAME-BI bit in the Advertisement Protocol element is reserved for
non-AP STA, so this function will never set that bit to one and as such,
there is not much point in maintaining the placeholder dead code for
this either. (CID 68107)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: No EAP fast session resumption between network blocks
Jouni Malinen [Sat, 26 Jul 2014 16:31:10 +0000 (19:31 +0300)]
tests: No EAP fast session resumption between network blocks

Verify that EAP fast session resumption is skipped if the connection
uses a different network configuration than the last EAP connection.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP: Do not allow fast session resumption with different network block
Jouni Malinen [Sat, 26 Jul 2014 16:35:02 +0000 (19:35 +0300)]
EAP: Do not allow fast session resumption with different network block

This forces EAP peer implementation to drop any possible fast resumption
data if the network block for the current connection is not the same as
the one used for the previous one. This allows different network blocks
to be used with non-matching parameters to enforce different rules even
if the same authentication server is used. For example, this allows
different CA trust rules to be enforced with different ca_cert
parameters which can prevent EAP-TTLS Phase 2 from being used based on
TLS session resumption.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Remove PSK/passphrase from P2P-GROUP-STARTED debug log entry
Jouni Malinen [Sat, 26 Jul 2014 10:11:34 +0000 (13:11 +0300)]
P2P: Remove PSK/passphrase from P2P-GROUP-STARTED debug log entry

The PSK/passphrase are needed for the control interface events since the
upper layer UI component is required by the specification to be able to
make this available for manual configuration. However, this is not
needed in the INFO verbosity level debug entry, so split the event
generation into two parts.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Use a helper function for P2P_EVENT_GROUP_STARTED events
Jouni Malinen [Sat, 26 Jul 2014 10:09:17 +0000 (13:09 +0300)]
P2P: Use a helper function for P2P_EVENT_GROUP_STARTED events

This makes it easier to change the event message message for indication
when P2P group has stated and removes some duplicated code.

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