Commit graph

3197 commits

Author SHA1 Message Date
Ilan Peer c16a7590cf wpa_supplicant: Add a configuration file for the P2P_DEVICE parameters
Add an option to specify a configuration file that can be used to hold
the P2P_DEVICE configuration parameters. If this option is not used, the
P2P_DEVICE configuration parameters will be read from interface
configuration file.

Note that it is advised to use this option in some cases such as:

If a P2P_DEVICE is supported by the driver, the wpa_supplicant creates a
dedicated P2P Device interface, where the configuration file used for
the main interface is used. As a consequence, if the configuration file
includes network definition etc., the wpa_supplicant will try to perform
station specific flows on the P2P Device interface which will fail.

If a P2P_DEVICE is supported by the driver and update_config is used,
the P2P Device configuration data will override the main interface
configuration data.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2014-03-07 00:11:04 +02:00
Jouni Malinen 8f05577d11 Configure beacon interval for IBSS command
wpa_supplicant already allowed beacon interval to be configured for AP
mode operations, but this was not passed to the driver for IBSS even
though the same parameter can used for that case. Add this for the
nl80211 driver interface to allow beacon interval to be controlled for
IBSS as well.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-03-06 23:09:20 +02:00
Moshe Benji 354c903f8e AP/GO interface teardown optimization
This commit adds an option to optimize AP teardown by leaving the
deletion of keys (including group keys) and stations to the driver.

This optimization option should be used if the driver supports stations
and keys removal when stopping an AP.

For example, the optimization option will always be used for cfg80211
drivers since cfg80211 shall always remove stations and keys when
stopping an AP (in order to support cases where the AP is disabled
without the knowledge of wpa_supplicant/hostapd).

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
2014-03-05 23:57:02 +02:00
Eliad Peller 3a94adbf42 P2P: Do not start scan for P2P Device interfaces at driver init
wpa_supplicant started delayed sched scan also on P2P Device interfaces,
resulting in erroneous scans and connection attempts. Skip that on
driver init when the interface is dedicated only for P2P management
purposes.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
2014-03-04 22:34:00 +02:00
David Spinadel aa10983004 P2P: Do not initialize bgscan on P2P interfaces
As a P2P group has a unique SSID and one security domain, it does
not make sense to enable background scanning for roaming purposes.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
2014-03-04 22:32:24 +02:00
Alexander Bondar 54ac5aa271 config: Add bgscan option when saving global configuration
Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
2014-03-04 22:27:39 +02:00
David Spinadel 268043d55f bgscan: Do not initialize bgscan if disabled by user
Do not initialize bgscan if the user explicitly set bgscan to an empty
string. Without this patch wpa_supplicant tries to initialize bgscan to
the first option if the string is empty.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
2014-03-04 22:26:19 +02:00
Beni Lev adef89480d nl80211: Add vendor command support
Add a callback to the driver interface that allows vendor specific
commands to be sent. In addition, a control interface command is added
to expose this new interface outside wpa_supplicant:

Vendor command's format:
VENDOR <vendor id> <sub command id> [<hex formatted data>]

The 3rd argument will be converted to binary data and then passed as
argument to the sub command.

This interface is driver independent, but for now, this is only
implemented for the nl80211 driver interface using the cfg80211 vendor
commands.

Signed-off-by: Beni Lev <beni.lev@intel.com>
2014-03-04 22:24:20 +02:00
Jouni Malinen 508e24c20b dbus: Clean up error reporting for TDLS peer address parsing
Passing a pointer to an error reply message is not very robust since
memory allocation could fail even for that error message. Instead, use a
separate error value as the return value from get_peer_hwaddr_helper()
and return a pointer to the error message through a pointer-to-pointer
so that the error case will always be clear.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen a7c37d92d2 dbus: Remove duplicated variable assignment
This gets rid of a static analyzer warning.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen ea3b8c1d2d Do not use a separate variable for tracking first entry in a list
The pos pointer can be compared to the start of the buffer pointer to
determine whether the entry is the first one in the list. This gets rid
of some static analyzer warnings about unused variable writes.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 6ed626df40 Remove unused gid_str pointer update
The group name is not used on these paths, so just remove it from the
directory name without updating gid_str to point to the unused group
name.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 67adcd266c WNM: Check wpa_s->current_bss more consistently
The scan result comparison routine would not make much sense without
current BSS level known, so return from the function without going
through the iteration that could have dereferenced the pointer if
wpa_s->current_bss == NULL.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 2af4d87fc3 GAS: Fix additional comeback delay with status code 95
The special case of non-zero status code used in a GAS Comeback Response
frame to indicate that additional delay is needed before the response is
available was not working properly. This case needs to allow the status
code check to be bypassed for the comeback case prior to having received
any response data.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 17:06:20 +02:00
Jouni Malinen 07d462c7b7 Interworking: Remove unused password setting for SIM credential
The simulated SIM/USIM case uses a separate milenage cred parameter, so
this cred password parameter was unused for this credential type.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 17:06:20 +02:00
Jouni Malinen 3141b82c16 Add OSEN to proto config field writer
This was forgotten from the OSEN addition where it was parsed, but not
written to a network block.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 10:49:18 +02:00
Jouni Malinen 06c7b7f0b5 HS 2.0R2: Fix temporary network disabling in Deauth Req case
Commits 7ef6947993 and
533536d82a added this temporarily
disabling case, but those commits were merged in without having been
converted to the new os_reltime design used for ssid->disabled_until.
Consequently, they ended up disabling the network for 44 years or so too
long time (depending on what values the relative timestamp had
accummulated so far). Fix this by using relative timestamps
consistently.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-28 00:29:34 +02:00
Jouni Malinen b7fb98f072 Interworking: Fix already-connected check to verify network priority
Commit d28f4e44f1 optimized Interworking
network selection in a case where the operation is run while already
connected to the selected network by skipping the reconnection. However,
this did not take into account that a higher priority network may have
shown up in the new scan results.

Fix this by checking whether network selection based on the latest scan
results (the ones from the interworking_select operation) would result
in a network with higher priority being selected. If so, skip the
optimization and force normal network connection (which will select this
newly found higher priority network). This fixes cases where a
non-Hotspot 2.0 network with higher priority (e.g., home network) shows
up while connected to a Hotspot 2.0 network with lower priority.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 14:06:23 +02:00
Jouni Malinen 7c373ac267 Interworking: Fix last-network preference to not override priority
Commit 3d910ef497 tried to make
last-network selection behave more consistently with Interworking
network selection preferences. However, it did not take into account
that other network block may have higher priority. In such cases, the
last added network from Interworking network selection should actually
not be selected for the next connection. Fix this by limiting the
last-network preference to work only within a priority class.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 13:47:23 +02:00
Jouni Malinen f54e92433e HS 2.0R2: Fix req_conn_capab example
Protocol field needs to be separated properly from te port number list.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 00:43:58 +02:00
Jouni Malinen a6739e191e HS 2.0R2: Try to scan multiple times for OSU providers
Scan operation is not that reliable, so try couple of times if no
OSU provider matches are found during fetch_osu command.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen cf6d08a63f Interworking: Add OCSP parameter to the cred block
This new parameter can be used to configure credentials to mandate use
of OCSP stapling for AAA server authentication.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 6402f2fe40 Interworking: Add more debug info on roaming partner preferences
This can be useful in debugging selection of roaming partner preference.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 74794891c7 Interworking: Add sp_priority cred parameter
This new priority parameter can be used to specify priorities between
credentials provisioned by the same SP. cred->priority is checked first
and if it is same and the provisioning_sp parameter matches, the new
sp_priority is used to order the credentials. It should be noted that
the order of priorities is different (higher 'priority' value indicates
higher priority of the credential, while higher 'sp_priority' indicates
lower priority of the credential).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 751ac99768 Interworking: Use a helper function to compare cred priority
This makes it easier to extend credential priority comparison beyond a
single priority variable.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen aff419f56a Interworking: Remove separate credential priority tracking
There is no need to keep the separate local variable for tracking the
highest selected priority since we track a pointer to the selected
credential with that information.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 533536d82a HS 2.0R2: Disable full ESS for as a workaround for per-BSS issues
For now, disable full ESS since some drivers may not support disabling
per BSS.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 8a77f1be86 HS 2.0R2: Slow down connection attempts on EAP failures
This is needed to limit the number of consecutive authentication
attempts to no more than 10 within a 10-minute interval to avoid
unnecessary load on the authentication server. In addition, use a random
component in the delay to avoid multiple stations hitting the same
timing in case of simultaneous disconnection from the network.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:24 +02:00
Jouni Malinen 76a55a8e12 HS 2.0R2: Add more debug to network selection
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 8b4b9fb384 HS 2.0R2: Fix bandwidth policy BSS selection
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 28f2a7c407 HS 2.0R2: Allow excluded network to be selected based on user override
Move excluded SSID filtering step to the end of credential validation
process and return list of BSSes that would otherwise have matching
credentials, but have an excluded SSID. Automatic network selection will
not select such a network, but interworking_connect command can be used
to pick excluded networks.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 33fb8c526c HS 2.0R2: Add support for Policy/RequiredProtoPortTuple
The new credential parameter req_conn_capab can be used to specify
restrictions on roaming networks providing connectivity for a set of
protocols/ports.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen a45b2dc5dc HS 2.0R2: Add support for Policy/MaximumBSSLoadValue
The new credential parameter max_bss_load can be used to specify
restrictions on BSS Load in the home network.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 4cad9df15a HS 2.0R2: Add support for Policy/MinBackhaulThreshold
The new credential parameters min_{dl,ul}_bandwidth_{home,roaming} can
be used to specify restrictions on available backhaul bandwidth.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen aa26ba68b4 HS 2.0R2: Add tracking of provisioning SP
The new provisioning_sp cred field can now be used to track which SP
provisioned the credential. This makes it easier to find the matching
PPS MO from the management tree (./Wi-Fi/<provisioning_sp>).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 8e5fdfabf6 HS 2.0R2: Add WFA server-only EAP-TLS peer method
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen df0f01d91f HS 2.0R2: Add OSEN client implementation
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen a5d75636f9 HS 2.0R2: Add common OSEN definitions
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 230e373539 HS 2.0R2: Add GAS operation duration statistics into debug
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen b572df8650 HS 2.0R2: Add routine for fetching OSU provider information
The new wpa_cli fetch_osu command can be used to fetch information about
all OSU providers and write that to a text file with the icons in
separate files. cancel_osu_fetch command can be used to stop ongoing OSU
provider list fetch.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 1d2215fc67 HS 2.0R2: Add OSU Providers list ANQP element
wpa_supplicant can now request OSU Providers list with "hs20_anqp_get
<BSSID> 8".

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 184e110caf HS 2.0R2: Add Icon Request and Icon binary File ANQP elements
wpa_supplicant can request OSU icon data with "hs20_icon_request <BSSID>
<icon filename>". This transmits an Icon Request ANQP element and
processes the response in Icon Binary File ANQP elements.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 7ef6947993 HS 2.0R2: Add STA support for Deauthentication Request notification
If requested, disable the network based on the HS 2.0 deauthentication
request.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen 95a3ea9426 HS 2.0R2: Add WNM-Notification Request for Subscription Remediation
Subscription remediation notification WNM-Notification Request is now
shown in the following way in wpa_supplicant control interface:
<3>HS20-SUBSCRIPTION-REMEDIATION http://example.com/foo/

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:23 +02:00
Jouni Malinen f9cd147d6b HS 2.0R2: Update Indication element to Release 2
The HS 2.0 Indication element from wpa_supplicant now includes the
release number field and wpa_supplicant shows the release number of the
AP in STATUS command (hs20=1 replaced with hs20=<release>).

The new update_identifier field in the cred block can now be used to
configure the PPS MO ID so that wpa_supplicant adds it to the Indication
element in Association Request frames.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:22 +02:00
Jouni Malinen bc00053c9d Interworking: Allow roaming partner configuration
The new roaming_partner parameter within a cred block can be used to
configure priorities for roaming partners.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:22 +02:00
Jouni Malinen 2c49d04cdb Do not clear global pmf setting on FLUSH
This parameter was actually used in some testing cases in a way that did
not really work well with the FLUSH command ending up disabling PMF.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:22 +02:00
Jouni Malinen eef7235da1 Only try fast reconnect if network is not disabled
Previously, it would have been possible for the network to be marked
disabled and that marking to be ignored if a recoverable disconnection
reason event were processed. Avoid this by verifying network status
before trying to reconenct back to the same BSS.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-25 23:52:09 +02:00
Jouni Malinen 3d910ef497 Interworking: Prefer last added network during network selection
Previously, any network block could be used to select the BSS to connect
to when processing scan results after Interworking network selection.
This can result in somewhat unexpected network selection in cases where
credential preferences indicated that a specific network was selected,
but another network ended up getting used for the connection. While the
older networks continue to be valid, add special processing for this
initial post-interworking-connect case to get more consistent network
selection to match with the Interworking network selection result.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-25 22:37:57 +02:00
Jouni Malinen da60d9c1ca tests: Add module tests for blacklist to complete coverage
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-25 20:16:28 +02:00
Jouni Malinen 2a33687ec7 P2P: Remove unnecessary ifdef CONFIG_NO_CONFIG_WRITE
wpa_config_write() is defined as a dummy function even if actual
operation to write the configuration file are commented out from the
build. This cleans up the code a bit and removed a compiler warning on
set-only variable.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-25 19:31:16 +02:00
Purushottam Kushwaha 050d8b5cc7 Fix documentation for wpa_supplicant_global_ctrl_iface_process()
This fixes a copy-paste error in the function name in
wpa_supplicant_global_ctrl_iface_process() documentation.

Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
2014-02-25 16:53:57 +02:00
Janusz Dziedzic 4db216fcf7 wpa_supplicant: Add support for IPv6 with UDP ctrl_iface
Add IPv6 support when using udp/udp-remote control interface using the
following new build configuration options:

CONFIG_CTRL_IFACE=udp6
CONFIG_CTRL_IFACE=udp6-remote

This is useful for testing, while we don't need to assign IPv4 address
(static or using DHCP) and can just use auto configured IPv6 addresses
(link local, which is based on the MAC address). Also add scope id
support for link local case.

For example,
./wpa_cli
./wpa_cli -i ::1,9877
./wpa_cli -i fe80::203:7fff:fe05:69%wlan0,9877

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2014-02-25 16:43:01 +02:00
Jouni Malinen f0e30c8410 Do not start another connect work while one is pending
It was possible for the connect or sme-connect radio work to get
re-scheduled while an earlier request was still pending, e.g.,
select_network is issued at the moment a scan radio work is in progress
and the old scan results are recent enough for starting the connection.
This could result in unexpected attempt to re-associate immediately
after completing the first connection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-24 15:22:35 +02:00
Jouni Malinen 3cdcb3a4b3 tests: Add module tests for WPS attribute parsing
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-02-21 13:41:30 +02:00
Jouni Malinen ea449b5bfe tests: Add a module test integration to hwsim tests
CONFIG_MODULE_TESTS=y build option can now be used to build in module
tests into hostapd and wpa_supplicant binaries. These test cases will be
used to get better testing coverage for various details that are
difficult to test otherwise through the control interface control. A
single control interface command is used to executed these tests within
the hwsim test framework. This commit adds just the new mechanism, but no
module tests are yet integrated into this mechanism.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-02-21 13:08:08 +02:00
Jouni Malinen 211d7ab3d8 P2P: Add even more debug prints for Probe Request in non-Listen state
It looks like discovery_dev_id test case can still fail and based on the
previously added debug prints, this is happening since the P2P module
believes it is not in Listen state even when a P2P_LISTEN was issued.
p2p_listen_cb() did not get called on remain-on-channel event for some
reason, so lets add more debug to find out why this can happen.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-20 16:59:29 +02:00
Roger Zanoni 848905b12a Avoid undefined references with CONFIG_WPA_TRACE_BFD=y
libdl, libiberty, and libzlib are dependencies for libbfd.

Signed-off-by: Roger Zanoni <roger.zanoni@openbossa.org>
2014-02-20 16:32:26 +02:00
Jithu Jance f667e031c9 P2P: Address few issues seen with P2P SD
Suppose we have multiple peers and we have peers advertising SD
capability, but no services registered for advertising. In this case,
even if there are multiple broadcast queries set, we might end up
sending only the lastly added broadcast query to the same device (since
SD_INFO won't get set for the first broadcast query). Add support for
multiple wildcard queries to be tracked to enable this type of use
case.

Some times it is seen that before advancing to next device in the list,
the scan results come and update SD_SCHEDULE flag. This will result in
sending the already sent query to the same device without giving chance
to other devices. This issue again is seen with peer devices advertising
SD capability without any services registered.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
2014-02-20 16:32:12 +02:00
Dmitry Shmidt e9a6f18385 TLS: Add tls_disable_tlsv1_1 and tls_disable_tlsv1_2 phase1 params
These can be used to disable TLSv1.1 and TLSv1.2 as a workaround for AAA
servers that have issues interoperating with newer TLS versions.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2014-02-20 15:28:57 +02:00
Dmitry Shmidt ac494fcce4 Android: Use external libnl 2.0 dynamic library
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2014-02-19 14:10:12 +02:00
Roger Zanoni b7cac41254 Fix hostapd and wpa_supplicant build with binutils >= 2.24.x
Using binutils >= 2.24.x and setting
CONFIG_WPA_TRACE/CONFIG_WPA_TRACE_BDF causes both builds to fail with
"#error config.h must be included before this header" message.

Since version 2.24.x, the bfd header checks for PACKAGE and
PACKAGE_VERSION macros.

As suggested in http://sourceware.org/bugzilla/show_bug.cgi?id=14243
projects that use bfd and don't use autotools should define a PACKAGE
macro.

Signed-off-by: Roger Zanoni <roger.zanoni@openbossa.org>
2014-02-19 14:10:12 +02:00
Jouni Malinen 94a3df500f P2P: Enable U-APSD support on GO automatically
Since P2P specification mandates P2P GO to support WMM-PS with legacy
STAs, enable this automatically if the driver indicates support for
U-APSD in AP mode. The "P2P_SET go_apsd 0" command can still be used to
disable this if needed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-17 13:15:29 +02:00
Andrei Otcheretianski b3253ebb73 wpa_supplicant: Complete radio works on disable event
While testing rfkill blocking of a scanning interface, it
was seen that the ongoing scan never completes. This happens
since EVENT_SCAN_RESULTS is discarded on a disabled interface.

Fix this and also other possible radio work completion issues
by removing all the radio works (including started) of the
disabled interface.

To be able to remove already started radio works, make their
callbacks be reentrant with deinit flag (when the work
is started), so each radio work should be able to handle
its own termination.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2014-02-16 00:06:23 +02:00
Jouni Malinen 2dff9e87b9 Remove unused NFC_RX_HANDOVER_REQ
The more generic NFC_REPORT_HANDOVER is now used to report completed NFC
connection handover operations in either role and NFC_RX_HANDOVER_REQ
did not have any implementation within wpa_supplicant.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-02-15 11:22:26 +02:00
Jouni Malinen 7ae7a84eef NFC: Workaround nfcpy message debug exception
The current nfcpy version does not support new WSC connection handover
message format and the handover server fails to process the request due
to a debug print. As a temporary workaround, override
HandoverServer::_process_request() with a version that avoids pretty()
print of the handover messages. This can be removed once nfcpy has been
updated to support the new format.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-13 16:37:43 +02:00
Max Stepanov cbf21c7cb5 P2P: Avoid compiler warning in p2p_supplicant.c
Initialize flag variable explicitly to avoid [-Wmaybeuninitialized]
compiler warning in wpas_p2p_verify_channel().

Signed-hostap: Max Stepanov <Max.Stepanov@intel.com>
2014-02-13 15:46:37 +02:00
Eytan Lifshitz 5e6aa04b09 wpa_supplicant: Fix memory leak in wfd_subelems error path
Memory allocated by calling function ieee802_11_vendor_ie_concat()
was not freed on an error path int ctrl_iface BSS command.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz@intel.com>
2014-02-13 15:41:15 +02:00
Jouni Malinen 88853aedf6 Fix CONFIG_WPS_NFC=y build without CONFIG_P2P=y
Some of the control interface operations for P2P were not properly
protected with #ifdef CONFIG_P2P.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-02-13 15:29:09 +02:00
Dmitry Shmidt 7ac7fd43aa Add bssid/freq hint for driver-based BSS selection
This uses the new nl80211 attributes to allow the connect command to
provide bssid and freq hints to the driver without limiting roaming to
the specific BSS/frequency. This can be used by drivers that perform
internal BSS selection (WPA_DRIVER_FLAGS_BSS_SELECTION) as a candidate
for initial association.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2014-02-13 15:14:18 +02:00
Jouni Malinen d6bfaaac69 NFC: Add summary and success file options for nfcpy scripts
These can be used to get updates on NFC operation status and success for
external programs.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-12 16:44:05 +02:00
Jouni Malinen 25cfc6f11e P2P NFC: Add p2p-nfc.py --handover-only option
p2p-nfc.py allowed an NFC Tag to be read and reported to wpa_supplicant
even in cases where it was explicitly asked to initiate negotiated
connection handover and return after completing this operation. The new
command line argument can be used to disable NFC Tag read operations
when a negotiated connection handover is expected.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-12 12:45:07 +02:00
Jouni Malinen 7bea076458 P2P NFC: Clean up p2p-nfc.py error handling
If wpa_supplicant reports a failure when trying to generate a handover
request, detect that before trying to decode the response as a hex
string.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-11 19:33:43 +02:00
Mahesh A Saptasagar 062a7c0d67 Fix persistent P2P connection failure in case channel list changes
P2P persistent connection may fail due to 802.11d channel change event
invalidating support of the operating frequency sent in the invitation
request, before receiving the invitation response. If the operating
frequency is invalid at the time the invitation response is processed
and there is no forced frequency provided by user, allow frequency
re-selection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-07 15:44:41 +02:00
Dmitry Shmidt 0547124d47 wpa_supplicant: Add DFS indicator to get_capability freq
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2014-02-06 16:13:10 +02:00
Jouni Malinen bab6677a31 Handle Wi-Fi Display commands more carefully if P2P is disabled
If P2P was disabled (e.g., due to driver not supporting it or through
p2p_disabled=1 configuration), setting Wi-Fi Display parameters could
result in segmentation fault when the WFD IE is updated without the P2P
module being initialized. Fix this by skipping the update if P2P module
is not in use. In addition, show Wi-Fi Display as disabled in "GET
wifi_display" and refuse to enable it with "SET wifi_display 1" if P2P
is not enabled.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-02-06 16:03:42 +02:00
Jouni Malinen 94ff22ea08 Remove dead code from AP setup
wpa_supplicant_create_ap() is only called for AP mode, so there is no
point in trying to address station (infra/IBSS) modes.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-04 13:23:35 +02:00
Jouni Malinen 0b5ff2ae12 WPS: Remove unused Credential AP Channel processing
Commit bd3a373767 added a mechanism to use
AP Channel attribute from within a Credential attribute to optimize
scans. However, this design is not actually used with the WPS NFC use
cases. With configuration token, the AP Channel attribute is in the same
container with the Credential attribute (and that was also handled in
the previous implementation). With connection handover, AP Channel
information is outside the Credential attribute as well.

Simplify implementation by removing the AP Channel within Credential
case. This allows wpas_wps_use_cred() to get the AP Channel from the
container instead of having to find this during credential iteration.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-04 13:23:35 +02:00
Jouni Malinen 44f967c729 Update ChangeLog files to match current implementation
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-04 13:23:35 +02:00
Prashanth Kumar 1b56d398a7 wpa_supplicant: Fix misplaced os_free
os_free has wfd_dev_info_hex as an argument which is defined within
CONFIG_NO_STDOUT_DEBUG

Signed-hostap: Prashanth Kumar <prashanthkumar.kr@globaledgesoft.com>
2014-02-03 19:35:09 +02:00
Jouni Malinen d950477913 Fix authentication algorithm negotiation in SME code
Commit 6ac4b15ef8 (wpa_radio work for
connection) caused a regression for cases where multiple auth_alg values
are set in a network block and wpa_supplicant-based SME is supposed to
iterate through them. The connection radio work was not terminated when
receiving authentication failure and this resulted in the following
authentication attempt failing.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-02-03 19:34:33 +02:00
Eytan Lifshitz 04c366cb1d Fix memory leaks and wrong memory access
1. In wpa_config_process_bgscan() fix memory leak after
   calling wpa_config_parse_string()
2. In hostapd_config_defaults(), on failure to allocate bss->radius,
   conf->bss was not freed.
3. In p2p_deauth_nofif(), memory allocated in p2p_parse_ies() was not
   freed in case of NULL minor_reason_code.
4. In p2p_disassoc_nofif(), memory allocated in p2p_parse_ies() was
   not freed in case of NULL minor_reason_code.
5. In p2p_process_go_neg_conf(), memory allocated was not freed in
   case that the P2P Device interface was not waiting for a
   GO Negotiation Confirm.
6. In wpa_set_pkcs11_engine_and_module_path(), the wrong pointer was
   checked.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz@intel.com>
2014-01-30 14:01:31 +02:00
Eytan Lifshitz fd67275b85 wpa_supplicant: Fix wrong size memory allocation
Fix memory allocation in wpa_scan_clone_params(), where the
allocation request used the size of a pointer rather than the
size of the structure.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz@intel.com>
2014-01-30 13:59:29 +02:00
Naresh Jayaram 4701f379f0 wpa_cli: Add tdls_external_control to tab completion for SET
This global configuration parameter was added in commit
800d58721c but the tab completion list for
the wpa_cli SET command in interactive mode was not updated.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-30 13:10:29 +02:00
Jouni Malinen 2e98839243 P2P: Disable DNS server from dnsmasq
This avoids issues with multiple instances of dnsmasq running, e.g.,
with one on eth0 and the other one for the P2P group.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:14 +02:00
Jouni Malinen c07f2615a0 P2P NFC: Add script for connection handover with nfcpy
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:14 +02:00
Jouni Malinen 12288d848c WPS NFC: Protect nfcpy pretty print calls against exceptions
nfcpy does not yet support all the new message formats, so some of the
pretty() calls can result in exceptions.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:14 +02:00
Jouni Malinen c209dd1108 WPS NFC: nfcpy script to use new connection handover design
Fetch a carrier record from wpa_supplicant instead of full handover
request. This makes it easier for external programs to build handover
request messages with multiple alternative carriers.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:14 +02:00
Jouni Malinen 6202500f6f WPS NFC: Logging level configuration to wps-nfc.py and wps-ap-nfc.py
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:13 +02:00
Jouni Malinen 1f1b5b31d7 WPS NFC: Clean up nfcpy script no-wait operations
This allows the scripts to terminate at proper point with --no-wait.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:13 +02:00
Jouni Malinen 79ede5a7e6 WPS NFC: Validate ctrl_iface response before decoding it
If the operation fails for any reason ("FAIL" response), it is cleaner
to return error clearly instead of hitting an exception in the hex
decoder.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:13 +02:00
Jouni Malinen ab1db08c05 WPS NFC: Use argparse in the nfcpy scripts
This cleans up command line parsing and simplifies the commands.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:13 +02:00
Jouni Malinen 6f8fa6e552 WPS NFC: Update wps-nfc.py and wps-ap-nfc.py to use new nfcpy API
This moves many of the peer discovery operations into the core nfcpy.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 22:08:13 +02:00
Jouni Malinen b56f6c8869 P2P NFC: Add support for freq option in NFC ctrl_iface commands
This can be used to force an operating channel for P2P group formation
triggered by NFC operations.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 91a65018d8 WPS NFC: Use BSSID and AP Channel from handover select
These optional attributes, if present, can be used to speed up the
initial connection by using a single channel scan.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 91226e0d12 WPS: Add testing option to corrupt public key hash
If CONFIG_WPS_TESTING=y is enabled in build configuration, the new
wps_corrupt_pkhash parameter (similar to wps_testing_dummy_cred) can be
used to request public key hash to be corrupted in all generated OOB
Device Password attributes. This can be used for testing purposes to
validate public key hash validation steps.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 73127764fe WPS NFC: add more debug prints for connection handover report
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 5cd4f66095 WPS NFC: Use AP Channel information from credential container
This allows NFC Configuration Token to indicate the current AP operating
channel, so that a single channel scan can be used to speed up the
initial connection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 5cd4740580 P2P NFC: WPA state machine config with driver-based BSS selection
wpa_s->current_bss was updated too late for the
wpa_supplicant_rsn_supp_set_config() call within
wpa_supplicant_select_config(). Re-order code so that current_bss gets
updated between current_ssid update and this call to set the WPA state
machine configuration, so that the new code that determines whether the
current GO support the new IP address assignment mechanism works.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:31 +02:00
Jouni Malinen 8e9f53c367 P2P NFC: Static handover with NFC Tag on client
This adds a new P2P Invitation mechanism to invite a P2P Device with an
NFC Tag to an already operating group when the GO with NFC Device reads
the NFC Tag. The P2P Device with the NFC Tag will then accept invitation
and connect to the group automatically using its OOB Device Password.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen dd87677115 P2P NFC: Enable own NFC Tag on GO Registrar
When "P2P_SET nfc_tag 1" is used to enable the own NFC Tag for P2P, also
enable it for any running GO interface.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen abe44e3ca2 P2P NFC: Add GO info into handover message when in client role
P2P Group ID can optionally be included in the connection handover
messages when acting as a P2P Client in a group. Add this information
and show it in the P2P-NFC-PEER-CLIENT event message.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 23318bea94 P2P NFC: Optimize join-a-group operation based on NFC information
When the NFC connection handover message received from a peer indicates
that the peer is operating as a GO on a specific channel, use that
information to avoid having to go through full scan. In addition, skip
the separate join-a-group scan since we already know the operating
channel, GO P2P Device Address, and SSID.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 86e320819c P2P NFC: Copy DH parameters to a separate group interface
The DH public and private key needs to be copied for the separate group
interface if that is used for a P2P group.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen d4b4d7fe3c WPS NFC: Update DH keys for ER operations
Since wpa_s->conf->wps_nfc_dh_* parameters can be set in number of code
paths, update the wps_context copy of the DH keys even if no new keys
were generated for the request. This tries to avoid some cases where
public key hash may not have matched the public key used in the ER
operation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 59b45d1afe P2P NFC: Add processing of P2P client while NFC handover case
Instead of automatically triggering a connection, provide an indication
of one of the devices being a P2P client to upper layers to allow user
to determine what to do next.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 74df9ecd4a P2P NFC: Do not try to join peer if both devices are already GO
Send a P2P-NFC-BOTH-GO event to upper layers to determine what to
do in case both devices going through NFC connection handover are
already operating as a GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 201b0f5fa6 P2P: Add test option to disable IP address assignment request
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:30 +02:00
Jouni Malinen 25ef8529c1 P2P: Add support for IP address assignment in 4-way handshake
This new mechanism allows P2P Client to request an IPv4 address from the
GO as part of the 4-way handshake to avoid use of DHCP exchange after
4-way handshake. If the new mechanism is used, the assigned IP address
is shown in the P2P-GROUP-STARTED event on the client side with
following new parameters: ip_addr, ip_mask, go_ip_addr. The assigned IP
address is included in the AP-STA-CONNECTED event on the GO side as a
new ip_addr parameter. The IP address is valid for the duration of the
association.

The IP address pool for this new mechanism is configured as global
wpa_supplicant configuration file parameters ip_addr_go, ip_addr_mask,
ip_addr_star, ip_addr_end. For example:

ip_addr_go=192.168.42.1
ip_addr_mask=255.255.255.0
ip_addr_start=192.168.42.2
ip_addr_end=192.168.42.100

DHCP mechanism is expected to be enabled at the same time to support P2P
Devices that do not use the new mechanism. The easiest way of managing
the IP addresses is by splitting the IP address range into two parts and
assign a separate range for wpa_supplicant and DHCP server.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:44:26 +02:00
Jouni Malinen c4f87a701b P2P NFC: Add NFC tag enabling for static handover
The device with the NFC Tag can be configured to enable NFC to be used
with "P2P_SET nfc_tag 1" and "P2P_LISTEN" commands to allow static
handover to be used.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:56 +02:00
Jouni Malinen dd37a93884 P2P NFC: Report handover select from tag for static handover
WPS_NFC_TAG_READ can be used to report static connection handover where
the connection handover select message was read from an NFC tag.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:56 +02:00
Jouni Malinen db6ae69e6b P2P NFC: Report connection handover as trigger for P2P
"NFC_REPORT_HANDOVER {INIT,RESP} P2P <req> <sel>" can now be used to
report completed NFC negotiated connection handover in which the P2P
alternative carrier was selected.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:56 +02:00
Jouni Malinen 9358878055 P2P NFC: Build connection handover messages
"NFC_GET_HANDOVER_{REQ,SEL} NDEF P2P-CR" can now be used to build P2P
alternative carrier record for NFC connection handover request/select
messages.

Static connection handover case can be enabled by configuring the DH
parameters (either with wps_nfc_* configuration parameters or with
WPS_NFC_TOKEN command at run time. The NFC Tag contents can be generated
with "NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG" after having configured
Listen channel (p2p_listen_reg_class/p2p_listen_channel).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:56 +02:00
Jouni Malinen ab9e34426f P2P NFC: Pass OOB Device Password ID to P2P
GO Negotiation needs to know which OOB Device Password ID is assigned
for the peer when NFC is used as the trigger.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:56 +02:00
Jouni Malinen 50d1f8901c NFC: Update WPS ER to use the new connection handover design
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen d95079361b WPS NFC: Add support for wpa_supplicant AP/GO mode to use handover
New functionality is needed for this with the update NFC connection
handover design that depends on the AP side using the public key hash
from the handover request.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen fa4c2988ae WPS NFC: Process new style handover select
The new WPS connection handover select includes Registrar public key
hash instead of credential. Use the new information to start
abbreviated WPS handshake instead of configuring a new network directly
from the old Credential-from-NFC design.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen 41f9ffb635 WPS NFC: Build new style carrier record for connection handover request
It is more useful to be able to build a single NFC carrier record
instead of the full connection handover request message to allow
external components to decide whether to negotiate which alternative
carrier is used. This updates the carrier record contents to the new
design to include Enrollee public key hash and provides this as a
carrier record instead of full message. An external program is expected
to be used to build the full NFC connection handover message with
potentially other alternative carrier records included.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen 57630e658b WPS: Preparations for allowing SSID filtering for provisioning step
If the SSID of the WPS AP is known, it should be possible to limit AP
selection based on this when searching for an active WPS AP. This commit
adds a mechanism to specify SSID for this type of uses.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen 5f4545573f WPS NFC: Validate peer public key hash on Enrollee
Since the Enrollee can now get the public key hash from the Registrar,
there is need to validate this during the WPS protocol run.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Jouni Malinen ea43ad960b P2P: Make group operating channel available
Provide local GO channel to the P2P module so that it can be used in
messages that indicate the current operating channel.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 21:10:55 +02:00
Arif Hussain 253f2e3795 P2P: Apply unsafe frequency rules to available channels
This adds a QCA vendor specific nl80211 event to allow the driver to
indicate a list of frequency ranges that should be avoided due to
interference or possible known co-existance constraints. Such
frequencies are marked as not allowed for P2P use to force groups to be
formed on different channels.

If a P2P GO is operating on a channel that the driver recommended not to
use, a notification about this is sent on the control interface and
upper layer code may decide to tear down the group and optionally
restart it on another channel. As a TODO item, this could also be changed
to use CSA to avoid removing the group.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-27 11:49:05 +02:00
Jouni Malinen 8615bdfac9 Increase global ctrl_iface buffer to same size as per-interface
Since the global ctrl_iface can be used with IFNAME= prefix to send
commands to be processed by per-interface code, it should have the same
(well, close to same since the prefix takes some space) limits on
command length as the per-interface ctrl_iface. Increase the buffer from
256 to 4096 to achieve this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-23 16:57:15 +02:00
Jouni Malinen c5a64e2d51 GAS client: Use Protected Dual of Public Action frames with PMF
When GAS is used with PMF negotiated, Protected Dual of Public Action
frames are expected to be used instead of Public Action frames, i.e.,
the GAS/ANQP frames are expected to be encrypted. Conver Public Action
GAS queries to use Dual of Public Action frame if PMF has been
negotiated with the AP to which the frame is being sent.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-23 11:50:28 +02:00
Jouni Malinen 5ce00d09c0 GAS server: Add support for Protected Dual of Public Action frames
When GAS is used with PMF negotiated, Protected Dual of Public Action
frames are expected to be used instead of Public Action frames, i.e.,
the GAS/ANQP frames are expected to be encrypted. Add support for this
different category of Action frames being used for GAS. The payload
after the Category field is identical, so the only change is in using
the Category field based on what was received in the request frames. For
backwards compatibility, do not enforce protected dual to be used on the
AP side, i.e., follow what the station does.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-23 11:19:55 +02:00
Jouni Malinen ea6e040c30 Clear more configuration parameters to default on FLUSH
This makes it more convenient for test scripts to change parameters for
a specific test case without having to separately clear them between
each test case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-23 10:21:49 +02:00
Raja Mani cf70d2981d wpa_supplicant: Schedule PNO on completion of ongoing sched_scan
When start PNO request comes from control interface, wpa_supplicant
should wait until ongoing sched_scan (triggered by wpa_supplicant)
gets cancelled. Issuing cancel sched_scan and start PNO scan
one after another from pno_start() would lead wpa_supplicant to clear
wps->sched_scanning flag while getting sched_scan stopped event
from driver for cancel sched_scan request. In fact, PNO scan will
be in progress in driver and wpa_s->sched_scanning will not be set
in such cases.

In addition to this change, RSSI threshold limit is passed as part of
start sched_scan request. This was previously set only in pno_start(),
but the same parameter should be available for generic sched_scan calls
as well and this can now be reached through the new PNO start sequence.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-22 19:41:45 +02:00
Max Stepanov a6cff8bfa8 wpa_supplicant: Fix seg fault in wpas_ctrl_radio_work_flush() in error case
Verify wpa_s->radio pointer before accessing it. If interface addition
fails, this could get called before wpa_s->radio has been set.

The segmentation fault details:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004b9591 in wpas_ctrl_radio_work_flush (wpa_s=0x77fff0) at ctrl_iface.c:5754
5754		dl_list_for_each_safe(work, tmp, &wpa_s->radio->work,

Call stack:
0  wpas_ctrl_radio_work_flush (wpa_s=0x77fff0) at ctrl_iface.c:5754
1  wpa_supplicant_deinit_iface (wpa_s=0x77fff0, notify=0, terminate=0) at wpa_supplicant.c:3619
2  wpa_supplicant_add_iface (global=0x75db10, iface=0x7fffffffe270) at wpa_supplicant.c:3691
3  wpas_p2p_add_p2pdev_interface (wpa_s=0x75dd20) at p2p_supplicant.c:3700
4  main (argc=<optimized out>, argv=<optimized out>) at main.c:317

Function:
5750	void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s)
5751	{
5752		struct wpa_radio_work *work, *tmp;
5753
5754		dl_list_for_each_safe(work, tmp, &wpa_s->radio->work,
5755				      struct wpa_radio_work, list) {
5756			struct wpa_external_work *ework;
5757
5758			if (os_strncmp(work->type, "ext:", 4) != 0)

Root cause:
(gdb) p wpa_s->radio
$1 = (struct wpa_radio *) 0x0

Signed-hostap: Max Stepanov <Max.Stepanov@intel.com>
2014-01-22 19:25:22 +02:00
David Spinadel f62a3c2fce P2P: Clone dtim_period to a new interface
Cloning dtim_period is needed for P2P GO.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2014-01-22 19:24:41 +02:00
Jouni Malinen 88a0bcab6b Update copyright years in the manpages
Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-21 16:33:25 +02:00
Dan Winship 32185f541c Sync manpages and command-line options
Signed-hostap: Dan Williams <dcbw@redhat.com>
2014-01-21 16:31:50 +02:00
Dan Williams b948e78b46 Add manpage for eapol_test
Signed-hostap: Dan Williams <dcbw@redhat.com>
2014-01-21 16:30:46 +02:00
Dan Williams 36bd29ee5e wpa_supplicant: Fix usage text based on build options
Signed-hostap: Dan Williams <dcbw@redhat.com>
2014-01-21 16:28:31 +02:00
Raja Mani dd271857a5 Skip normal scan when PNO is already in progress
Scan request failures are observed in wpa_supplicant debug log when
Android framework starts PNO scan in driver via ctrl interface command
'set pno 1' and wpa_supplicant also tries to issue a scan request after
PNO has started in the driver.

Some drivers may reject a normal scan request when PNO is already in
progress. wpa_supplicant should consider PNO status before issuing start
scan request to the driver. Otherwise, wpa_supplicant will get failures
from driver for the scan request and it will end up rescheduling scan
request in periodic interval and get a start scan request failure for
each attempt.

In order to avoid unnecessary scan attempt when PNO scan is already
running, PNO status is checked before issuing scan request to driver.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-21 16:19:49 +02:00
Rashmi Ramanna a2d6365760 P2P: Extend the listen time based on the active concurrent session
A P2P Device while in the Listen state waiting to respond for the
obtained group negotiation request shall give a fair chance for other
concurrent sessions to use the shared radio by inducing an idle time
between the successive listen states. However, if there are no
concurrent operations, this idle time can be reduced.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-20 22:55:09 +02:00
Dmitry Shmidt 443427e4ed P2P: Add missing direct global ctrl_iface commands for P2P
It should be noted that these commands are not exclusively used for P2P
or in the global context, so use of these commands through the global
control interface for operations that are specific to a single interface
have undefined behavior and that behavior may change in the future. As
such, these are recommend only for operations that are in the global
context (e.g., for P2P management).

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2014-01-17 11:58:36 +02:00
Jithu Jance 37b4198af4 P2P: Use GO's operating channel to optimize scan during join
Use P2P GO's operating channel information, if known, to do a single
channel scan during the join operation.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2014-01-17 11:57:07 +02:00
Arend van Spriel a0e9d89203 Use minimal scan delay upon EVENT_INTERFACE_ADDED
This patch resets the static interface_count to zero in case of
wpa_supplicant_driver_init() call for wpa_s which is in
INTERFACE_DISABLED state. This interface_count is used for the delay of
the scan which is now minimal for dynamically added interfaces. This may
collide with a scan for another interface, but the same is true for any
chosen delay in this scenario. Also the state change to DISCONNECTED is
moved to wpa_supplicant_driver_init() so it will move from
INTERFACE_DISABLED to INACTIVE when there are no enabled networks.

Tested-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
2014-01-17 11:50:31 +02:00
Arend van Spriel 5ddd07cb37 Reset normal_scans counter upon entering INTERFACE_DISABLED state
Depending on the implementation, the scheduled scan may not give results
quickly when in DISCONNECTED state. This patch resets
wpa_s::normal_scans upon entering to the INTERFACE_DISABLED state so a
normal scan is assured upon going to DISCONNECTED state after the
interface has been re-enabled. This mainly solves a long reconnect time
observed upon repeated kernel driver reloads, i.e., third reload
resulted in a scheduled scan.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-hostap: Arend van Spriel <arend@broadcom.com>
2014-01-17 11:48:17 +02:00
Sunil Dutt 3ed97271ba TDLS: Pass peer's Supported channel and oper class info during sta_add
The information of the peer's supported channel and operating class
is required for the driver to do TDLS off channel operations with a
compatible peer. Pass this information to the driver when the peer
station is getting added.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-14 17:24:33 +02:00
Jouni Malinen c48414af8f P2P: Limit join-a-group scans based on SSID from invitation
If we already know the SSID of the P2P group we are trying to join, use
that SSID to limit scan responses and BSS selection since we do not
really look for any other network in this case. In addition, this can
fix cases where the peer has just changed its SSID (e.g., started a new
group) and there may be multiple BSS entries for the same BSSID.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-01-13 21:39:06 +02:00
Jouni Malinen 78f0c933e0 Flush secondary device types on FLUSH command
This makes it possible to clear previously configured secondary device
types.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-08 22:27:30 +02:00
Jouni Malinen 2b384109f2 P2P: Allow requested device type to be specified with p2p_find
This allows filtering of P2P peers that reply to the device discovery
Probe Request frames.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-08 20:01:19 +02:00
Jouni Malinen d9bb2821e7 Clear configuration blobs on FLUSH command
All te network blocks and credentials were already cleared, but
configurations blobs should also be cleared here, e.g., to get
more consistent behavior test cases using EAP-FAST PACs.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-08 16:42:15 +02:00
Jouni Malinen c60ba9f7ab Skip network disabling on expected EAP failure
Some EAP methods can go through a step that is expected to fail and as
such, should not trigger temporary network disabling when processing
EAP-Failure or deauthentication. EAP-WSC for WPS was already handled as
a special case, but similar behavior is needed for EAP-FAST with
unauthenticated provisioning.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-08 16:42:15 +02:00
Ben Greear 3043b4f455 nl80211: Document how to configure for libnl 2.0 and 3.2
Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>

Signed-hostap: Ben Greear <greearb@candelatech.com>
2014-01-07 15:35:14 +02:00
Jouni Malinen 95fb2db242 P2P: Reject group formation on WPS provisioning failure
There is no need to wait for the 15 second group formation timeout to
clear the state if WPS failure is detected during P2P group formation.
Allow the WPS exchange steps (WSC_NACK and EAP-Failure) to be completed
and remove the group to get rid of the extra wait.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:12 +02:00
Jouni Malinen 6fc61e180e Fix TX status processing during AP mode shutdown in wpa_supplicant
A TX status event could be received after the AP interface has already
been deinitialized. This needs to check for NULL pointer before trying
to indicate the event to AP functions.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:12 +02:00
Jouni Malinen b6a9590b34 Interworking: Keep up to two pending GAS_REQUEST responses
Previously, only the last response data was kept in memory. This
increases that to hold up to two last responses to allow some more
parallel operations to be requested. In addition, the response data is
now freed as soon as the external program has fetched it.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:12 +02:00
Jouni Malinen 090b8e3d14 Update copyright notices for the new year 2014
Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:12 +02:00
Jouni Malinen 356d1488c4 Interworking: Add optional freq argument to INTERWORKING_SELECT
This can be used to limit which channels are scanned using the specified
list of frequency ranges in the same format that the SCAN command uses.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen a09ffd5f2f Fix req_scan-deplete-timeout and update eloop API for this
Commit e2f5a9889a was supposed to prevent
new scan request from pushing out the old one. However, it did not
really do that since eloop_deplete_timeout() returned 0 both for the
case where the old timeout existed (and was sooner) and if the old
timeout did not exist. It returned 1 only for the case where an old
timeout did exist and was larger than the new requested value. That case
used to result in wpa_supplicant_req_scan() rescheduling the timeout,
but hew code in eloop_deplete_timeout() did the exact same thing and as
such, did not really change anything apart from the debug log message.

Extend the eloop_deplete_timeout() (and eloop_replenish_timeout() for
that matter since it is very similar) to return three different values
based on whether the timeout existed or not and if yes, whether it was
modified. This allows wpa_supplicant_req_scan() to schedule a new
timeout only in the case there was no old timeout.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen 083916c022 P2P: Clear p2p_disabled and p2p_per_sta_psk on FLUSH command
The control interface FLUSH command now includes clearing of
"P2P_SET disabled 1" and "P2P_SET per_sta_psk 1".

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen 3f45fc403f P2P: Clear services on FLUSH command
The control interface FLUSH command now includes the step executed by
the P2P_SERVICE_FLUSH command.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen 1f965e622a Allow external programs to request wpa_radio work items
The new control interface command RADIO_WORK can be used by external
programs to request radio allocation slots from wpa_supplicant if
exclusive radio control is needed, e.g., for offchannel operations. If
such operations are done directly to the driver, wpa_supplicant may not
have enough information to avoid conflicting operations. This new
command can be used to provide enough information and radio scheduling
to avoid issues with such cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen 6428d0a71f Do not start wpa_radio work during externally triggered scan
If an external program triggers a scan, wpa_supplicant does not have a
wpa_radio work item for this operation to protect against other
offchannel operations. This can result in operations failing, so try to
avoid damage by not starting any new wpa_radio work items during a scan
that was started by another process.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen 6470f471e4 Remove unneeded scan delay on connection-in-progress
This type of protection against concurrent connection and scan
operations is now enforced through the wpa_radio work mechanism, so this
separate protection mechanism is not needed anymore.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:09 +02:00
Jouni Malinen 4bb232153f Remove unneeded GAS query delay on connection-in-progress
This type of protection against concurrent connection and offchannel GAS
operations is now enforced through the wpa_radio work mechanism, so this
separate protection mechanism is not needed anymore.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:09 +02:00
Jouni Malinen 6ac4b15ef8 Use wpa_radio work for connection
This protects against conflicting offchannel operations during
connection (authentication, association, EAP exchanges, 4-way
handshake).

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:09 +02:00
Jouni Malinen b9e6d7001d Use radio work for GAS requests
Avoid concurrent GAS operations with any other exclusive use of the
radio by using the radio work queuing mechanism. This replaces some of
the earlier constraints on concurrent operations with the more generic
wpa_radio work concept.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:09 +02:00
Jouni Malinen e05e130837 P2P: Use radio work to protect offchannel Action frame exchanges
Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:09 +02:00
Jouni Malinen e1d1c8e223 Use radio work for P2P Listen requests
Avoid concurrent P2P Listen operations with any other exclusive use of
the radio by using the radio work queuing mechanism. This removes some
of the earlier workarounds that postponed scans depending on other
operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 09:45:32 +02:00
Jouni Malinen 1b5d4714dd Use radio work for P2P scan requests
Avoid concurrent P2P scan requests with any other exclusive use of the
radio by using the radio work queuing mechanism. This removes some of
the earlier workarounds that postponed scans depending on other
operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:39:25 +02:00
Jouni Malinen d12a51b5d2 Use radio work for scan requests
Avoid concurrent scan requests by using the radio work queuing
mechanism.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:37:50 +02:00
Jouni Malinen b1ae396f59 Add framework for exclusive radio operations
The new radio work item concept can be used to request time for an
operation that requires exclusive radio control, e.g., a scan. Once the
radio is available, the registered callback function will be called.
radio_work_done() must be called once the exclusive radio operation has
been completed, so that the radio is freed for other operations. The
special case of deinit=1 is used to free the context data during
interface removal. That does not allow the callback function to start
the radio operation, i.e., it needs to free the allocated resources
and return.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:37:03 +02:00
Jouni Malinen dd43aaa509 Add helper functions for cloning and freeing scan parameters
Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:35:52 +02:00
Jouni Malinen 06f9acce18 Ignore externally triggered scan results with scan_res_handler
wpa_s->scan_res_handler is set only for cases where a scan operation is
requested for a specific purpose. As such, this callback should only be
called when a scan result from a scan that was triggered by
wpa_supplicant is processed.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:34:17 +02:00
Jouni Malinen c9b5559737 Clean up ctrl_iface debug prints for monitor events
Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:34:09 +02:00
Jouni Malinen d31b5ac778 Use cleaner debug print for ctrl_iface commands with private info
Convert this to a text string instead of ASCII hexdump to make the
debug log more convenient to use.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:33:50 +02:00
Jouni Malinen 9595151f3f Remove duplicated RX ctrl_iface hexdump
The newer wpa_dbg() print includes the same information in a more
convenient form, so remove the duplicate RX ctrl_iface hexdump in the
cases where there is no key material in the control interface commands
(the possible-key-material case is still using wpa_hexdump_ascii_key).

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-05 22:33:18 +02:00
Jouni Malinen 9b850799c1 Fix scan-cache-clearing operation to avoid unnecessary cases
wpa_drv_scan() success case was supposed to clear
wpa_s->clear_driver_scan_cache, not params->only_new_results (which
would do nothing here).

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-03 08:55:51 +02:00
Jouni Malinen 2f30cac36f Avoid unnecessary key clearing operations
Track set_key operations per-key index and clear keys on disconnection
only if the key was set (or may have been set which is the case for the
first operation after wpa_supplicant start).

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-02 23:49:38 +02:00
Jouni Malinen 949938aadf Ask driver to report only new scan results if requested
If the BSS table within wpa_supplicant is flushed, request the driver to
flush its own scan result table during the next scan. This can avoid
unexpected old BSS entries showing up after BSS_FLUSH or FLUSH command
in cases where the driver may maintain its internal cache of scan
results (e.g., cfg80211 BSS table persists at least for 15 seconds).

In addition to doing this automatically on BSS_FLUSH/FLUSH, a new SCAN
command argument, only_new=1, can be used to request a manual scan
request to do same. Though, it should be noted that this maintains the
BSS table within wpa_supplicant. BSS_FLUSH followed by SCAN command can
be used to clear all BSS entries from both the driver and
wpa_supplicant.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-02 23:03:31 +02:00
Jouni Malinen 101bdc2e8c Remove forgotten notes about already removed driver wrappers
These old driver wrappers have been removed quite some time ago, but
some of the build configuration notes were still describing how they
are configured.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-02 10:23:30 +02:00
Jouni Malinen 70067530b6 Update EAP-FAST note regarding OpenSSL support
This is now supported in the current OpenSSL version.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-02 10:13:11 +02:00
Jouni Malinen 5890fa81d8 WPS: Fix clear-from-timeout handling to avoid race condition
The 100 ms timeout to clear WPS state after EAP-Failure has been
received worked otherwise fine, but it opened a race condition on
another WPS operation starting within that wait. If that happens, the
timeout will cancel that new operation unexpectedly. Fix this by
cancelling the timeout from wpas_clear_wps().

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-01 22:00:09 +02:00
Jouni Malinen c64e3a08a9 P2P: Send received Presence Response information to ctrl_iface monitors
The P2P_PRESENCE_REQ command did not give any easily available
indication of the response received from the GO. Make this more useful
by providing such response (if received) as a ctrl_iface monitor event
(P2P-PRESENCE-RESPONSE).

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-01 18:44:44 +02:00
Jouni Malinen c5838683a8 Mark wpas_wps_er_nfc_handover_sel() static
This is not used outside wps_supplicant.c.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 19:37:15 +02:00
Jouni Malinen 0187c41d88 Declare wpa_debug_* variables in src/utils/wpa_debug.h
These were somewhat more hidden to avoid direct use, but there are now
numerous places where these are needed and more justification to make
the extern int declarations available from wpa_debug.h. In addition,
this avoids some warnings from sparse.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 19:29:52 +02:00
Jouni Malinen fcc61230d1 Declare wpa_drivers in src/drivers/driver.h
This avoids some warnings from sparse.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 19:19:37 +02:00
Jouni Malinen 0d79b50ae7 Clear EAPOL Logoff state on FLUSH command
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 19:03:39 +02:00
Jouni Malinen 4848a38d85 Get rid of duplicated cipher suite and AKM definitions
WPA_CIPHER_* and CIPHER_* are used for the exact same set of cipher
suites with the main difference being that the WPA_CIPHER_* version is
suitable to be used as a bitfield. Similarly, WPA_KEY_MGMT_* and
KEY_MGMT_* have similar design for AKMs. There is no need to maintain
two separate copies of the definitions since the bitfield compatible
version can be used for both needs. Get rid of the CIPHER_* and
KEY_MGMT_* versions to clean up the implementation by getting rid of
unnecessary mapping functions.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 09:16:27 +02:00
Jouni Malinen ef93abded7 WPS: Clean up UUID debug print
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-30 23:35:48 +02:00
Jouni Malinen 03ed332407 Interworking: Allow cred blocks not to be saved to a file
The new cred block parameter 'temporary' can be used to indicate that a
cred block is not to be saved to wpa_supplicant configuration file
(e.g., "SET_CRED 0 temporary 1"). This is similar to the concept of
temporary network blocks and allows cred blocks to be managed outside
the wpa_supplicant config file when other parameters are still saved to
the file written by wpa_supplicant.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-30 15:43:55 +02:00
Jouni Malinen 04f7ecc686 Reset WPA parameters to default values on FLUSH command
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 19:25:05 +02:00
Jouni Malinen 152cff6ba6 P2P: Remove WPA_DRIVER_FLAGS_P2P_MGMT option
The option of handling upper layer P2P management operations within the
driver/firmware was originally planned to be used with wpa_supplicant,
but this has not really happened and there is no clear sign of this
being needed in the near term either. This functionality has not been
completed and it is certainly not being kept up-to-date or tested. As
such, it is best to remove it for now and if this or something similar
is needed in the future, it can be brought back once a clear need for it
has been demonstrated first.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 18:20:47 +02:00
Jouni Malinen 538d6f4b54 WPS: Use shorter scan interval during pre-provisioning search
Previously, the shorter scan interval was already in use for the
connection following the provisioning step, but same optimization can
also be used for the pre-provisioning scan.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 18:02:05 +02:00
Jouni Malinen 3187fd900d WPS: Replace wpas_wps_in_progress with identical wpas_wps_searching
There is no point in maintaining two different functions that do
practically the same check of WPS state.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 17:59:12 +02:00
Jouni Malinen dbfb8e82ff Remove unnecessary EVENT_RX_ACTION
This driver event was used separately for some Action frames, but all
the driver wrappers converted to this from information that would have
been enough to indicate an EVENT_RX_MGMT event. In addition, the
received event was then converted back to a full IEEE 802.11 management
frame for processing in most cases. This is unnecessary complexity, so
get rid of the extra path and use EVENT_RX_MGMT for Action frames as
well as other management frame subtypes.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 17:18:17 +02:00
Jouni Malinen 8aaafcee9e Make local UUID available through ctrl_iface STATUS command
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 10:00:32 +02:00
Jouni Malinen 7b02375a41 Clear wps_fragment_size on FLUSH command
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-29 10:00:32 +02:00
Jouni Malinen db76aa64f1 Fix PeerKey 4-way handshake
The earlier changes to buffer EAPOL frames when not associated to avoid
race conditions (especially commit
3ab35a6603 but maybe something even before
that) broke PeerKey 4-way handshake. Fix this by using a separate check
before the race condition workaround to process PeerKey 4-way handshake
EAPOL-Key messages differently.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-28 16:32:54 +02:00
Jouni Malinen 2cd0f6a429 WNM: Add Target BSSID into BSS Transition Management Response
P802.11-REVmc clarifies that the Target BSSID field is always present
hen status code is zero, so match that requirement.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-27 18:11:07 +02:00
Jouni Malinen a8a6a35fd6 WNM: Use nonzero dialog token in BSS Transition Management Query
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-27 18:11:07 +02:00
Sudha Daram 3c1060ff8f WNM: Add debug logs to get the RSSI from the scan results
This commit adds few more debug prints to log the RSSI information from
the scanned BSSIDs and the current connected BSSID when comparing
neighbor results during WNM Transition Management Request processing.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-26 22:26:05 +02:00
Jouni Malinen c511b321f3 WPS: Remove old duplicate network even if key is different
Previously, WPS credential provisioning removed duplicated network
entries only if they had identicical SSID, security parameters, and the
keys. However, it is possible that the AP has changes its keys and
leaving the old entry behind can result in connectibity issues (e.g.,
with 4-way handshake failing due to use of the old PSK). Fix this by
allowing the old network entry to be removed even if the keys
(passphrase, PSK, WEP keys) are different.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-26 20:50:28 +02:00
Jouni Malinen 9d2cb3ec94 Make CONFIG_TESTING_OPTIONS=y enable all testing options
This makes it easier to enable various testing parameters and
functionality in build configuration.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-26 20:50:28 +02:00
Jouni Malinen 662b40b16b WPS: Reduce scan wait time during WPS processing
Since the AP is expected to be available, there is no need to wait for
the full five second wait between scans during WPS connection. This
speeds up cases where the first scan misses the AP for some reason.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-26 20:50:28 +02:00
Jouni Malinen 015af91fea Do not use results from externally requested scan for network selection
It may not always be desirable to trigger reassociation or network
change based on scan results from externally to wpa_supplicant trigger
scan operations. Skip network selection and roaming determination if the
received scan result is known to be triggered by something external to
wpa_supplicant. The control interface SCAN command can be used to
request wpa_supplicant to determine the best network.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 20:50:28 +02:00
Jouni Malinen 1cd93ff743 Reschedule own scan request if an externally started one is in progress
This avoids some unnecessary attempts to request the driver to start a
scan while it is still busy with the scan operation that was started by
an external program.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:48:52 +02:00
Jouni Malinen dc3906cb2d Show timing information about scan requests in debug log
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:48:52 +02:00
Jouni Malinen d81c73be18 Optional scan id for ctrl_iface SCAN requests
This allows users of wpa_supplicant control interface to figure out when
their specific scan command has been started and completed. For example:

CTRL-EVENT-SCAN-STARTED
> scan freq=2412,2417 passive=1 use_id=1
3
CTRL-EVENT-SCAN-RESULTS
CTRL-EVENT-SCAN-STARTED id=3
CTRL-EVENT-SCAN-RESULTS id=3

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:48:52 +02:00
Jouni Malinen a5f40eff18 Track whether scan was started by us or an external program
This can be used to improve scan behavior in cases external programs
request scans directly from the driver.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:27:48 +02:00
Jouni Malinen 88c2d48860 Allow passive scan to be requested with SCAN passive=1
This allows external programs to request wpa_supplicant to execute
a passive scan (i.e., do not send any Probe Request frames).

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:27:48 +02:00
Jouni Malinen 69278f7328 Remove unused last_scan_full
This parameter was not really used for anything else apart from a debug
message in the same function that set it. In addition, cfg80211 returns
the set of scanned frequencies even for the full scan, so the code that
was setting this conditionally on frequency list not being there was not
really ever entered either.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 18:27:48 +02:00
Jouni Malinen 1f5d2dd3d7 Interworking: Allow EAP-FAST to be used
This behaves like PEAP as far as Interworking network selection is
concerned.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 16:55:45 +02:00
Jouni Malinen 6ffa1687ee Add GAS-QUERY-START and GAS-QUERY-DONE event messages
External programs can use these new control interface events to better
track progress of GAS operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 16:55:45 +02:00
Jouni Malinen fee5234284 Allow channel list to be specified for SCAN command
The new freq=<frequency ranges> parameter to the SCAN command can be
used to request a scan to be performed on the specified set of channels
instead of on all channels. For example, "wpa_cli scan
freq=2400-2500,5180" would scan channels 1-14 and 36. Only the channels
that the driver indicates as enabled and that are within the specified
ranges are included in the request.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 16:55:44 +02:00
Jouni Malinen 98eda9c26d Move int_array helpfer functions to utils/common.c
These can be useful outside scan.c, so make them available.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 13:37:06 +02:00
Jouni Malinen a4cfb48694 Add make lcov-html to generate code coverage report
In addition, update build rules to compile object files in the same
directory as the source code file if CONFIG_CODE_COVERAGE=y is set to
make lcov find the source code files.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-26 13:37:06 +02:00
Jouni Malinen 4daa011be4 Clean up cipher capability prints
Use an array of ciphers and a loop instead of copy-pasted copies of the
same printing functionality for each cipher.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-25 10:44:06 +02:00
Jouni Malinen 30675c3416 Add definitions for new cipher suites from IEEE Std 802.11ac-2013
This adds initial parts for supporting the new GCMP-256, CCMP-256,
BIP-GMAC-128, BIP-GMAC-256, and BIP-CMAC-256 cipher suites.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-24 22:21:04 +02:00
Moshe Benji ab41595f35 wpa_supplicant: Fix crash when terminating all interfaces
In wpa_supplicant_terminate_proc(), while iterating and
terminating interfaces, after an interface is terminated,
we can no longer access its memory as it is no longer valid
and causes a crash.

Fix this by saving the pointer to the next interface before freeing
the current one to avoid accessing an invalid memory location.

Signed-hostap: Moshe Benji <moshe.benji@intel.com>
2013-12-24 08:29:28 +02:00
Johannes Berg a12d34546a wpa_supplicant: Use monotonic time for last_scan check
This just serves to check if there was a scan within
the last 5 seconds, hence it should use monotonic time.
While at it, also use os_reltime_expired().

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 08:21:18 +02:00
Johannes Berg 51bffab117 WPS: Use monotonic time for AP connection attempt
This is only used for a debug message, but that message prints
the time since the last attempt, so it should use monotonic
time instead of wall clock.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 08:19:47 +02:00
Johannes Berg 6473e5c842 wpa_supplicant: Use relative time for TKIP Michael MIC failures
The MMIC failure code should use monotonic time to check
whether 60 seconds have elapsed or not. For type-safety,
use struct os_reltime for the timestamp variable, and
also convert to using os_reltime_expired().

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 08:18:47 +02:00
Johannes Berg 4e1eae1dff wpa_supplicant: Use monotonic time for temp-disabled networks
Temporarily disabled networks are disabled for a certain
duration, so the code should use monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 08:01:59 +02:00
Johannes Berg 151ab808fa P2P: Use monotonic time for GO client waiting
GO activation can fail if the first client doesn't connect
within a certain time, but this should not be dependent on
wall time -- use monotonic time instead.

While at it, use os_reltime_expired().

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 08:00:03 +02:00
Johannes Berg 3326f19355 IBSS RSN: Use monotonic time for reinit detection
The reinit detection skips reinit when the time since the own
authentication frame TX is less than half a second, so it shouldn't
be affected by wall time and use monotonic time instead.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 07:58:21 +02:00
Johannes Berg c2be937ce7 wpa_supplicant: Use monotonic time for EAPOL RX workaround
The EAPOL RX workaround checks that the events are less than 100 ms
apart, so only uses relative times and should use monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 07:35:42 +02:00
Johannes Berg e72a001b0f bgscan: Use monotonic time
The bgscan simple and learn algorithms should run regardless
of wall clock time jumps, so make them use monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 07:34:43 +02:00
Johannes Berg acb69cec6f wpa_supplicant: Use monotonic time for RX/BSS times
The BSS table, scan timeout, and related functionality should use
monotonic time since they care about relative values (age) only.
Unfortunately, these are all connected, so the patch can't be split
further. Another problem with this is that it changes the driver wrapper
API. Though, it seems only the test driver is using this.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-12-24 07:27:02 +02:00
Johannes Berg 46b8d4c004 wpa_supplicant: Use monotonic time for SA query timeout
The SA query timeout is just a regular timeout (currently
hard-coded to 1000 TU), so use monotonic time for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-24 07:17:25 +02:00
Eliad Peller 3e06180fe0 bgscan_learn: Start scanning from the first freq
bgscan_learn_get_probe_freq() starts from returning the second entry in
the supp_freqs arrays. Change its logic a bit to make it start from the
first entry.

Signed-hostap: Eliad Peller <eliad@wizery.com>
2013-12-24 06:54:34 +02:00
Eyal Shapira f4c73ae640 bgscan_learn: Fix initial interval
In case the initial signal level of the associated BSS was above the
given threshold, bgscan_learn module would begin using the
short_interval but never switch to the long_interval as there would be
no signal change event. Make the init code poll for the current signal
level and set scan_interval accordingly. This logic exists in
bgscan_simple but was missing in bgscan_learn.

Signed-hostap: Eyal Shapira <eyal@wizery.com>
2013-12-24 06:54:24 +02:00
Eliad Peller 7dab119380 bgscan_learn: Avoid redundant frequencies
Some hw modes (e.g., 11b and 11g) contain the same frequencies,
causing the supp_freqs array to be populated with redundant entries.

Check for the existence of the freq before adding it.

Signed-hostap: Eliad Peller <eliad@wizery.com>
2013-12-24 06:49:26 +02:00
Eliad Peller 3727123269 bgscan: Stop bgscan only on disassociation
Stopping bgscan on any state other than COMPLETED results
in bgscan reset (stop + start) on every rekeying operation.

Signed-hostap: Eliad Peller <eliad@wizery.com>
2013-12-24 06:48:28 +02:00
Jouni Malinen b2838baf6a Update IBSS documentation to include RSN option
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-23 20:21:17 +02:00
Jouni Malinen 429dd9aff1 Advertise QoS Map support based on driver capability
Do not assume the driver supports QoS Mapping, but instead, advertise
support for this only if CONFIG_INTERWORKING is defined and driver
indicates support for configuring QoS Map.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-23 11:05:20 +02:00
Tomasz Bursztyka b154a24e83 Fix a never-ending loop with multiple radios in wpa_supplicant
Commit 202dec2a94 introduced a never
ending loop for a case where a single wpa_supplicant process is used
with multiple radios. Fix this by advancing the iface pointer properly
to the next interface in the loop until a NULL pointer is hit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2013-12-14 21:16:05 -08:00
Janusz Dziedzic 8d1fdde7f0 nl80211/hostapd: Extend channel switch notify handling
Adds support for VHT by parsing bandwidth and center_freq{1,2}.

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>
Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-12-07 20:50:15 -08:00
Jithu Jance 8567866d75 P2P: Handle frequency conflict in single channel concurrency case
Based on priority, remove the connection with least priority whenever
a frequency conflict is detected.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2013-12-07 18:55:58 -08:00
Dmitry Shmidt b125c48fce P2P: Add wfd_dev_info= field for device found event
This field allows adds enough information into the P2P-DEVICE-FOUND
events to figure out if the peer supports Wi-Fi Display.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-12-07 17:57:55 -08:00
Naresh Jayaram f7579502a6 eap_proxy: Extend Android.mk to support additional libraries
Allow addition static and shared libraries to be specified from the
eap_proxy_*.mk file for Android build. In addition use $(LOCAL_PATH) as
a prefix for that Android makefile part.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-12-07 16:54:24 -08:00
Jouni Malinen 0ad3b9c402 Use wpa_radio data for get_shared_radio_freqs()
This replaces the now unnecessary iteration of get_radio_name() calls.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:15 +02:00
Jouni Malinen 1b544ffa74 Use wpa_radio data for wpas_wpa_is_in_progress()
This replaces the now unnecessary iteration of get_radio_name() calls.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:14 +02:00
Jouni Malinen 5b81927d58 Use wpa_radio data for wpas_p2p_search_delay()
This replaces the now unnecessary iteration of get_radio_name() calls.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:14 +02:00
Jouni Malinen c67e7e2a23 Use wpa_radio data for channel list updates
This replaces the now unnecessary iteration of get_radio_name() calls.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:14 +02:00
Jouni Malinen f88f19b465 Use wpa_radio data for scan result updates
This replaces the now unnecessary iteration of get_radio_name() calls.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:14 +02:00
Jouni Malinen 202dec2a94 Add shared per-radio structure for wpa_supplicant
struct wpa_radio is used as a shared data structure between all struct
wpa_supplicant instances that share the same physical radio.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 21:20:14 +02:00
Jouni Malinen 73c00fd794 Move wpa_supplicant driver initialization into a helper function
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 19:36:29 +02:00
Jouni Malinen 7feff06567 Add CONFIG_CODE_COVERAGE=y option for gcov
This can be used to measure code coverage from test scripts.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-24 19:16:12 +02:00
Ilan Peer 6f72577f29 P2P: Handle INTERFACE_DISABLED event on a P2P GO interface
An INTERFACE_DISABLED event received on an interface that is
currently operating a P2P GO means that the group session ended.
In such a case, if the interface was dynamically added remove it, and
if not, remove all the network blocks that are temporary, assuming
that if needed a new session will be started by an external entity.

The use case was triggering rfkill (both SW and HW). This case popped up
as part of a testing cycle, where after a toggle in the rfkill state,
the result was that the interface was not deleted, but on the other hand
the wpa_supplicant did not configure the kernel to re-start the AP
functionality again.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-11-24 12:29:20 +02:00
Loic Poulain 1245503188 Restore scan_req if sta scan is rescheduled in the scan results event
On scan results event if a concurrent P2P scan was triggered previously,
scan results processing is canceled, p2p_find executed, and a new sta
scan is triggered (pending scan). However, this new sta scan does not
restore the scan_req value of the previous scan (whose scan result has
been canceled).

If we are currently connected to an AP and use ap_scan=2, the new
triggered scan will cause an associtation-without-scan in
wpa_supplicant_scan:
(ap_scan == 2 & scan_req != MANUAL_SCAN_REQ)
	=> wpa_supplicant_assoc_try()
causing an association error and a disconnection.

This patch fixes this issue by restoring the previous scan_req value.

Signed-off-by: Loic Poulain <loicx.poulain@intel.com>
2013-11-24 11:47:30 +02:00
Michael Schaller bdec7ee5c9 D-Bus: Add support to set pkcs11_{engine,module}_path
Add SetPKCS11EngineAndModulePath D-Bus method. Add PKCS11EnginePath
and PKCS11ModulePath D-Bus property getters.

Signed-hostap: Michael Schaller <misch@google.com>
2013-11-23 10:48:27 +02:00
Dmitry Shmidt a94737ea38 Android: P2P: Remember country locale
This updates P2P modules based on the Android specific
DRIVER COUNTRY command.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-22 20:23:16 +02:00
Jouni Malinen 5e2c3490d5 Android: Add driver_cmd for arbitrary driver commands
This is a mechanism used in Android to extend driver interface in vendor
specific ways. This is included only for the purpose of Android
compatibility. Proper interface commands should be used for any new
functionality.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-22 20:23:08 +02:00
Johannes Berg 594516b4c2 Use monotonic clock for relative time for eloop if available
Relative time shouldn't be calculated based on gettimeofday
because that clock can jump (e.g., when the time is adjusted
by the system administrator.)

On systems where that is available, use CLOCK_BOOTTIME (on
fairly recent Linux systems, this clock takes into account
the time spend suspended) or CLOCK_MONOTONIC (on Linux and
some POSIX systems, this clock is just freely running with
no adjustments.)

Reported-by: Holger Schurig <holgerschurig@gmail.com>
Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-11-20 23:52:56 +02:00
Jithu Jance 1cba9bea96 STA: Cancel sched_scan while initiating wps_reassoc
Scan initiated from wps_nfc command context was ketp on
getting rescheduled due to an on-going scheduled scan. So
cancel sched_scan before issuing a reassociation scan.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2013-11-20 22:28:28 +02:00
Jouni Malinen 215a02f359 Add Wi-Fi Direct to the build configuration example
In addition, include Wi-Fi Direct support for Android builds by
default.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-20 20:49:48 +02:00
Rashmi Ramanna 6fc48481e4 P2P: Short scan wait to speed up the group re-invocation
The shorter 250 ms wait for the next scan request can be used also for
the case of persistent group re-invocation instead of just formation of
a new group. This speeds up the process and makes this more robust
especially in cases where the GO is using MCC.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-20 16:35:30 +02:00
Jouni Malinen 93a06fe103 Fix QoS Map Configure frame use
The QoS Map Set element was passed in full to the driver instead of just
the payload of the element. This resulted in the updated QoS Map being
rejected. Validate the element id/len and send only the payload to the
driver.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-20 12:49:27 +02:00
Jouni Malinen 1b665cbf51 P2P: Fix channel preference use for MCC p2p_connect
Only force_freq was used in the wpas_p2p_set_own_freq_preference() call
which allowed the P2P module channel re-selection to ignore the
preference for using a channel we are already using. Fix this by setting
either force_freq or pref_freq as the preference based on which one is
set. This allows p2p_ignore_shared_freq parameter to be used whether to
prefer the shared frequency in this case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-19 12:39:29 +02:00
Jouni Malinen 5624ccfe93 P2P: Optimize default case for own freq preference setting
There is no need to use wpas_p2p_num_unused_channels() here in the
default configuration of p2p_ignore_sahred_freq=0, so re-order the
conditions to skip that operation. This is a bit more efficient and the
debug log is also a bit cleaner in the default case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-19 12:29:25 +02:00
Jouni Malinen d0f61a4bea P2P: Fix p2p_ignore_shared_freq=1 when inviting a peer
p2p_ignore_shared_freq=1 was supposed to allow a MCC-capable device to
ignore a preference for using the same channel on multiple interfaces.
However, it was not used when inviting a peer to re-invoke a persistent
group. This case needs special handling since the peer's channel list is
not available to perform channel reselection and the operating channel
indicated in the Invitation Request frames ends up getting used as the
operating channel if the transmitted of that frames becomes the GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-19 12:26:16 +02:00
Jouni Malinen 21e491f2f6 P2P: Fix p2p_ignore_shared_freq=1 during invitation processing
p2p_ignore_shared_freq=1 was supposed to allow a MCC-capable device to
ignore a preference for using the same channel on multiple interfaces.
However, it was not used during processing of an Invitation Request. Fix
that case to use channel preference instead of channel forcing if free
channels are available. This allows p2p_ignore_shared_freq=1 case to
ignore the preference.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-19 12:15:45 +02:00
Jouni Malinen 107a89448c P2P: Clean up wpas_p2p_setup_freqs() debug message
It is confusing to talk about current operating channels being
unavailable for P2P when there are no current operating channels. Make
the debug message easier to understand.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-18 18:16:27 +02:00
Jouni Malinen 7d669cf7a1 P2P: Clean up wpas_p2p_init_go_params()
It is clearer if there is only a single loop of the channel list and
shared debug prints. In addition, the note about current operating
channels not being available is quite confusing if there are no
operating group, so make that part of the message conditional.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-18 18:13:15 +02:00
Jouni Malinen b17d89bd10 P2P: Fix channel selection for MCC case
Commit 0d08efa447 modified
wpas_p2p_setup_freqs() design to use number of MCC channels capability
from the driver. However, it resulted in regression on how the preferred
vs. forced channel selection is done in the case of a MCC device.
force_freq was set unconditionally even though this was supposed to be
done only if no additional channels are available. pref_freq needs to be
used when possible to avoid preventing connection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-18 16:53:44 +02:00
Jithu Jance f86d282f43 Handle legacy scan interruption of sched_scan/PNO
While starting from PNO start context, the scheduled scan was not
setting the flag wpa_s->scanning. This was resulting in the subsequent
SCAN command to proceed further and send command to nl80211/cfg80211.
The expected behavior of cancelling sched_scan was not happening here.

While sched_scan is in progress and a legacy scan comes on the
cli/socket, the sched_scan is cancelled and normal scan is allowed to
continue. However, sometimes sched_scan cancelled event comes a bit
delayed and we will send out the scan command before the wpa_s->scanning
is cleared. Instead, reschedule the incoming scan req if the
wpa_s->scanning shows that it is still in progress.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2013-11-18 14:35:48 +02:00
Andrei Otcheretianski 334bf36ac5 Add chan_switch to ctrl interface of wpa_supplicant and hostapd
Add chan_switch to the control interface of wpa_supplicant and hostapd,
and also to wpa_cli and hostapd_cli.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2013-11-17 17:12:58 +02:00
Andrei Otcheretianski bf281c129f Add AP channel switch mechanism
Build CSA settings and call the driver to perform the switch. Construct
Beacon, Probe Response, and (Re)Association Response frames both for CSA
period and for the new channel. These frames are built based on the
current configuration. Add CSA IE in Beacon and Probe Response frames.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2013-11-17 17:12:58 +02:00
Andrei Otcheretianski dcca2219ae wpa_supplicant: Update channel switch driver interface
Add csa_settings struct which holds parameters for CSA. Change driver
interface for switch_channel(), so that it will receive this struct and
not only the new frequency as it was before. This allows wpa_supplicant
to provide all the required parameters (beacons, proberesp, assocresp,
CSA IE) which are required by cfg80211 implementation.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2013-11-17 16:48:33 +02:00
Jouni Malinen e1925bde36 eloop: Remove eloop_none.c
This was supposed to be a minimal sample of eloop wrapper, but it is
unclear whether this is of that much use and the file has not been kept
up-to-date. Remove this file to reduce maintenance effort. The other
eloop*.c files can be used as a starting point if something new is
needed.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-17 16:48:20 +02:00
Dmitry Shmidt f6c2b8c367 Android: Add state message sent after 'status' command
This triggers re-transmission of CTRL-EVENT-STATE-CHANGE and
CTRL-EVENT-CONNECTED events on STATUS command for Android framework
specific processing.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-17 16:47:56 +02:00
Dmitry Shmidt 6b49907665 Android: Add SSID in supplicant change event
In addition, change wpa_s->pending_bssid to wpa_s->bssid for the BSSID
value in the event.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-17 16:47:45 +02:00
Masashi Honma 22cf7d7324 SCARD: Clean up SIM/USIM selection
Commit eb32460029 left an unneeded
sim_type argument to scard_init(). Remove that unnecessary argument to
clean up the implementation.

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-11-17 16:47:38 +02:00
Paul Stewart cea97a04f9 dbus_new: Add DBus TDLS methods
Add DBus methods for TDLS operations similar to those available
for the control interface. This includes Discover, Setup, and
Teardown commands. While here, add a method to query the TDLS
link status and add a DBus method for it.

Tested with CONFIG_TDLS enabled, on a TDLS-enabled host and
peer capable of TDLS:

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address>

    yields: string "peer does not exist"

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSDiscover string:<peer-mac-address>

    yields no error

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSSetup string:<peer-mac-address>

    yields no error

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address>

    yields: string "connected" after TDLS completes

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSTeardown string:<peer-mac-address>

    yields no error

    dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \
        /fi/w1/wpa_supplicant1/Interfaces/0 \
        fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address>

    yields: string "peer not connected"

Signed-hostap: Paul Stewart <pstew@chromium.org>
2013-11-17 16:47:32 +02:00
Jithu Jance cc4952ad63 Request new scan only for the original interface
Request new scan only for the interface for which the original scan
request and results has come. Otherwise while sharing scan results along
with P2P interfaces, the new scan will be requested on P2P interfaces.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2013-11-17 16:47:22 +02:00
Jouni Malinen fa58da2e6c Remove old mechanism of skipping scan request rescheduling
Since eloop_deplete_timeout() is doing practically same in
wpa_supplicant_req_scan(), revert the old mechanism from commit
7e1488494e to avoid unnecessary work in
this function.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-17 16:47:13 +02:00
Dmitry Shmidt e2f5a9889a Deplete scan request if new time is less than remaining
This avoids pushing out previous scheduled scan requests based on new
events.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-17 16:46:58 +02:00
Vinay Krishna Eranna dcd25d4c3b P2P: Use negotiated channel from invitation for persistent GO
During persistent group re-invocation, GO may end up using a different
channel as the operation channel compared to what was indicated in the
invitation frames. This may break the connection if the peer device ends
up scanning the GO only on the channel from the invitation frame. Fix
this by using the negotiated channel (if available) on the GO as the
operating channel instead of the channel that was provided in the
p2p_invite command to start negotiation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-16 18:05:28 +02:00
Sunil Dutt 800d58721c TDLS: Provide external control to specify the peers for setup
There are use cases requesting the host driver to initiate the TDLS
setup with the peer only when configured by the external applications.
Thus, enable this control by tdls_external_control=1 and pass the
requisite information for the specific TDLS operation to the driver
on the request from such use cases.

This operation mode expects the driver to initiate TDLS link
automatically based on signal strength and traffic to a peer and tear
down links whenever they are not used or suitable due to signal strength
etc. The list of peers with which such operations are to be performed
are provided with the TDLS driver operations.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-15 03:02:08 +02:00
Dmitry Shmidt 58d6f91d16 Android: Reset MD5OBJS value before += operation
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-09 15:30:46 +02:00
Jouni Malinen 890b3a44cb Android: Sync Android.mk with Makefile
This brings in commit 411f567050 changes
to allow libdl to be linked in after OpenSSL.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-08 13:04:51 +02:00
Dmitry Shmidt 736abfc166 Android: Set proper path to keystore include dir
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 13:04:51 +02:00
Dmitry Shmidt 5e42035ed9 Android: Fix CONFIG_EAP_PROXY option and move it to right place
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:47:00 +02:00
Dmitry Shmidt 643fab30a0 Android: Add CONFIG_IEEE80211AC option to makefile
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:47:00 +02:00
Dmitry Shmidt 4ba83096e2 Android: Add CONFIG_EAP_UNAUTH_TLS option to makefile
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:47:00 +02:00
Ying Wang 53414a7e35 Android: Add liblog
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:46:59 +02:00
Kenny Root 1d415f1fcc Android: Switch keystore to binder
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:46:53 +02:00
Joe Onorato 4e5a4d3e57 Android: Get rid of LOCAL_MODULE_TAGS := user
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:41:05 +02:00
Kenny Root 206d81319e Android: Restore OpenSSL ENGINE support
We now use an OpenSSL ENGINE to support keystore functionality.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 11:40:13 +02:00
Dmitry Shmidt b7997e01db Android: Remove obsolete WPA_UNICODE_SSID define
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-08 00:22:32 +02:00
Dmitry Shmidt 60cdfd7e25 Android: Fix compilation without BOARD_WPA_SUPPLICANT_DRIVER
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-07 14:04:30 +02:00
Dmitry Shmidt e40634e654 Prohibit PNO start during assoc process and in connect state
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-07 14:01:33 +02:00
Dmitry Shmidt 3526ff0fad Android: Add ANDROID_P2P define under BOARD_WLAN_DEVICE
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-07 14:01:28 +02:00
Dmitry Shmidt d0b2735240 Android: Fix CFLAGS -> L_CFLAGS
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-11-07 14:01:23 +02:00
Jouni Malinen 9ec876662b P2P: Allow GO P2P Device Address to be used for scan result matching
This is a better way of matching P2P groups based on the unique P2P
Device Address (e.g., from P2P Group ID) and SSID pair instead of using
the not necessarily unique P2P Interface Address.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-07 13:49:01 +02:00
Jouni Malinen 08b2677974 Interworking: Use SSID from the BSS entry
There is no need to parse the IE buffer again to find the SSID of the
BSS since that information is already stored in struct wpa_bss.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-07 00:17:48 +02:00
Jouni Malinen 50589751bf Interworking: Reject BSS based on disallow_aps
If a BSS is disallowed temporarily with disallow_aps, the network
connection is going to fail. As such, there is not much point in
allowing Interworking network selection to try to connect with such BSS.
As such, do not consider disallowed networks for automatic network
selection and reject requests to connect to them through
INTERWORKING_CONNECT.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-07 00:12:30 +02:00
Jouni Malinen 6ede8a7e4d Interworking: Avoid duplicated network blocks
Do not add multiple network blocks for the same network from a single
credential. INTERWORKING_CONNECT used to generate a new network block
for each instance regardless of what network blocks have already been
configured. While this allows the connection to go through, it is not
efficient to leave behind potentially large number of network blocks
with the same contents (or worse, changed contents). Address this by
removing an older network block for the same credential before adding a
new one.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-07 00:12:30 +02:00
Jouni Malinen d28f4e44f1 Interworking: Do not reconnect if already connected
If we are already connected to the selected AP with a network block
that was created based on the selected credential, do not force a
reconnection or network block update.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-07 00:12:30 +02:00
Jouni Malinen 217cf4991d P2P: Add more debug prints for frequency selection
This prints out get_shared_radio_freqs() results and related information
from P2P operations to make debug logs more helpful for figuring out
issues related to multi-channel concurrency.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-05 11:07:51 +02:00
Ilan Peer 4dd3f86834 P2P: Fix bug in GO frequency selection
When trying to choose a frequency that can be used for GO instantiation,
properly check if there are free channels that can be used.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-11-05 10:55:22 +02:00
Ilan Peer 9804873e53 wpa_supplicant: Fix bug in get_shared_radio_freqs
The idx variable was mistakenly set to 0 at the beginning of the
interface iteration. This could result in the operating channel of the
interface calling the function from being removed from the returned
frequency array if other interfaces were operating.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-11-05 10:55:22 +02:00
Haim Dreyfuss 3139270903 bgscan: Add global bgscan configuration
This option can be used to globally configure bgscan parameters
for all the network blocks.

Note that this configuration will not override a network block
specific bgscan settings, but will only be used in case that
the network block does not have a valid bgscan configuration.

Signed-hostap: Haim Dreyfuss <haim.dreyfuss@intel.com>
2013-11-05 10:26:31 +02:00
Naresh Jayaram efc58df29c eap_proxy: Re-read IMSI from proxy in Interworking functionality
Try to read the IMSI values through the eap_proxy layer for Interworking
functionality again if the value was not available at startup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-05 10:12:14 +02:00
Jouni Malinen 18ca733248 SAE: Fix group selection
Number of regressions had shown up in wpa_supplicant implementation of
SAE group selection due to different integer array termination (-1 in
hostapd, 0 in wpa_supplicant) being used for SAE groups. The
default_groups list did not seem to use any explicit termination value.
In addition, the sae_group_index was not cleared back to 0 properly
whenever a new SAE session was started.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-02 18:07:49 +02:00
Jouni Malinen 65015b2d8e Replace unnecessary UTF-8 characters with ASCII versions
There is no need for using UTF-8 in these files when perfectly fine
ASCII versions of these characters exist.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-11-02 16:01:32 +02:00
Jouni Malinen c092d83e26 P2P: Clear pending group formation data on group removal
It was possible for the wpa_s->show_group_started and wpa_s->go_params
to be left set when a P2P group was removed before group formation had
completed. In case a separate P2P group interface was not used, this
could rsult in all future scans using the hardcoded DIRECT-* SSID and as
such, not find the network they were trying to find. Fix this by
clearing these P2P parameters on group removal.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-01 10:31:55 +02:00
Jouni Malinen 9100b6607b P2P: Debug print reason for specific SSID for scan
It can be useful to see whether the specific P2P SSID was used for scan
based on p2p_in_provisioning or show_group_started when debugging issues
where this case shows up unexpectedly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-11-01 10:30:50 +02:00
Jouni Malinen 2aec4f3c0c Allow add-BSS operation to re-use existing netdev
When removing and re-adding the first wlan# netdev to hostapd
dynamically, the netdev is already present and should not be removed and
re-added to maintain its state as not-added-by-hostapd so that it does
not get removed automatically.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-31 22:34:25 +02:00
Vinay Krishna Eranna 731ca6364e Update regulatory change to all virtual interface for the phy
wpas_p2p_setup_channels function uses the per interface information
(wpa_s->hw.modes) for setting up the available channel list for P2P
operation, but if a separate P2P interface is used (e.g., p2p0 on
Android), the wpa_s instance for that interface may not get an updated
channel list. This can result in some operations, like "P2P_SET
disallow_freq", using old channel list information (e.g., world roaming
information with passive-scan/no-ibss flags) which was initialized
during the start-up. This could result in P2P functionality using
conflicting or obsolete channel information.

To resolve this issue, update channel list information on regulatory
change events to all of the virtual interfaces sharing the same phy for
which the event is received.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 23:03:23 +02:00
Jouni Malinen ebd79f07c4 hostapd: Make hostapd_config::bss array of pointers
This makes it more convenient to move BSS configuration entries between
struct hostapd_config instances to clean up per-BSS configuration file
design.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 16:58:21 +02:00
Jouni Malinen 7617388ea3 Interworking: Report STATUS:sp_type even if domain is not configured
This allows sp_type={home,roaming,unknown} to be used to determine
network type with SIM-based credentials even if the domain name
parameter is not configured explicitly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 13:57:02 +02:00
Jouni Malinen c20bc9d464 P2P: Remove compiler warning without CONFIG_IEEE80211N
Commit ca9bc5b566 added wpas_conf_ap_vht()
as a static function with the caller within CONFIG_IEEE80211N, but the
function outside. This resulted in a compiler warning for wpa_supplicant
AP/P2P builds when CONFIG_IEEE80211N=y was not used. Fix that by using
matching conditional block around the function.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-27 20:46:19 +02:00
Eliad Peller ca9bc5b566 P2P: Add VHT support
Start GO with VHT support if VHT option was requested
and the appropriate channels are available.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 20:08:36 +02:00
Eliad Peller 20ea1ca406 P2P: Add VHT parameter to P2P operations
Add the option to ask for VHT operation similarly to the way ht40 is
configured - either by adding 'vht' param to the relevant p2p_*
commands or by configuring p2p_go_vht=1 in the configuration file.

This patch only adds the configuration option (e.g., via control
interface). The actual handling of the VHT parameter (asking the driver
to use VHT, etc.) will be done by the following patch.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:46:17 +02:00
Eliad Peller f2112b2ac8 wpa_supplicant: Add CONFIG_IEEE80211AC
In order to support P2P GO with 11ac support, add CONFIG_IEEE80211AC
config option support to the Makefile.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:32:03 +02:00
Jouni Malinen 4d9fb08d23 WPS: Clear known_wps_freq in addition to after_wps
Both of these variables can result in optimized WPS scans, so better
clear these more consistently to avoid unexpected single-channel scans.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-27 12:56:56 +02:00
Jouni Malinen d20c340f7e Interworking: Clear known_wps_freq for network selection
This was forgotten from the previous commit which allowed some cases to
trigger single-channel scan incorrectly if an optimized WPS scan had not
yet been completed at the time network selection was started.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-27 12:55:09 +02:00
Jouni Malinen 1bd05d0423 Interworking: Force normal scan for network selection
Make sure special optimized scans (like WPS-single-channel or
sched_scan) do not get used during the network selection scan. This
could have been hit in cases where a previous operation has been stopped
in a state where special scan parameters were going to be used.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-27 11:26:58 +02:00
Jouni Malinen 51e9f22809 P2P: Add option to allow additional client channels
The new p2p_add_cli_chan=1 configuration parameter can be used to
request passive-scan channels to be included in P2P channel lists for
cases where the local end may become the P2P client in a group. This
allows more options for the peer to use channels, e.g., if the local
device is not aware of its current location and has marked most channels
to require passive scanning.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-26 17:49:10 +03:00
Jouni Malinen 556b30daca P2P: Add option to remove channels from GO use
The new p2p_no_go_freq frequency range list (comma-separated list of
min-max frequency ranges in MHz) can now be used to configure channels
on which the local device is not allowed to operate as a GO, but on
which that device can be a P2P Client. These channels are left in the
P2P Channel List in GO Negotiation to allow the peer device to select
one of the channels for the cases where the peer becomes the GO. The
local end will remove these channels from consideration if it becomes
the GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-26 17:49:10 +03:00
Jouni Malinen e7ecab4a3b Use ARRAY_SIZE() macro
Replace the common sizeof(a)/sizeof(a[0]) constructions with a more
readable version.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 17:49:05 +03:00
Jouni Malinen 29179b881e Stop ctrl_iface monitor send loop on reinit failure
There is no point trying to continue sending messages with sendmsg() if
socket reinitialization fails.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:59 +03:00
Jouni Malinen a2a535f897 Remove unnecessary wpa_s->conf checks
wpa_s->conf cannot be NULL because wpa_supplicant_init_iface() would not
allow wpa_supplicant_add_iface() to return wpa_s instance in such state.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:52 +03:00
Jouni Malinen 41c526f357 P2P: Fix snprintf buffer length for group ifname backup
Commit 2e5ba4b6d1 moved this to a function
and updated one of the os_snprintf() calls to use the len parameter, but
forgot the other one.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-24 21:22:30 +03:00
Naresh Jayaram 07041c6f99 eap_proxy: Confirm eap_proxy initialization before reading SIM info
Trying to access the SIM card details without checking if the eap_proxy
layer has been initialized can results in a crash. Address this by
sending the request for the IMSI through eapol_supp_sm.c which can
verify that eap_proxy has been initialized.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 20:51:39 +03:00
Po-Lun Lai 47d986e6ff P2P: Check Action frame payload match before accepted TX status
It is possible for there to be two pending off-channel TX frames, e.g.,
when two devices initiate GO Negotiation at more or less the same time.
This could result in the TX status report for the first frame clearing
wpa_s->pending_action_tx that included the newer frame that has not yet
been transmitted (i.e., is waiting to be sent out). Avoid losing that
frame by confirming that the TX status payload matches the pending frame
before clearing the pending frame and reporting the TX status callback.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 17:47:40 +03:00
Jouni Malinen d259249762 Fix ENABLE_NETWORK not to reconnect in disconnected state
DISCONNECT followed by ENABLE_NETWORK ended up starting a scan for a new
connection due to wpa_supplicant_enable_one_network() setting
wpa_s->reassociate = 1. This was done regardless of wpa_s->disconnected
being 1 which should imply that wpa_supplicant should not try to connect
before asked explicitly with REASSOCIATE or RECONNECT.

Fix this by making ENABLE_NETWORK setting of reassociate = 1 and
starting of scans for connection conditional on wpa_s->disconnected ==
0. This will make ENABLE_NETWORK trigger a connection only if
wpa_supplicant is already in a state where it would try to connect if
there are any enabled networks.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 12:09:46 +03:00
Jouni Malinen af8a827b90 Make frequency range list routines more general
This allows the frequency range list implementation to be shared for
other purposes.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 00:44:07 +03:00
Dan Williams 538922a628 dbus: Add boolean AllowRoam option to Scan() method options dictionary
To disallow roaming when a scan request's results are read, callers
of the D-Bus Scan() method may add a new "AllowRoam" boolean key
to the scan options dictionary and set that key's value to FALSE.

Signed-hostap: Dan Williams <dcbw@redhat.com>
2013-10-22 16:09:46 +03:00
Pontus Fuchs c6f5dec9c1 Don't start second scan when changing scan interval
If a scan is currently running and the scan interval is changed, a
second scan will be started before the current has finished. This will
in turn, if no networks are configured, cause wpa_s->state to be
forced to WPA_INACTIVE before the first scan has finished.

Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>
2013-10-22 15:57:21 +03:00
Jouni Malinen 313424d46e GAS: Add support for multiple pending queries for the same destination
Need to use the pointer to the current ongoing query instead of matching
from the pending list based on the destination address so that we get
the correct query instance when processing the TX status report.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-21 14:37:37 +03:00
Jouni Malinen cbc5484892 GAS: Do not start new scan operation during an ongoing GAS query
These operations can have conflicting offchannel requirements, so wait
with a new scan trigger until a pending GAS query has been completed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-21 13:20:38 +03:00
Kyeyoon Park c377514337 GAS: Delay GAS query Tx while scanning/connecting
Offchannel operations needed for a GAS query can conflict with ongoing
scan/connection progress, so delay GAS queries if such an operation is
in progress on the current interface or any virtual interface sharing
the same radio.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-21 13:15:45 +03:00
Kyeyoon Park 24c694b465 GAS: Delay GAS query Tx while another query is in progress
It would be possible to issue another GAS query when a previous one is
still in progress and this could result in conflicting offchannel
operations. Prevent that by delaying GAS query initiation until the
previous operation has been completed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-21 13:13:42 +03:00
Jouni Malinen 7255983b59 WPS: Clear after_wps from number of new locations
This makes it less likely to forget WPS single-channel scan optimization
in effect after having completed the WPS operation or in case WPS
operating gets cancelled.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:02 +03:00
Jouni Malinen 73b54d63fc P2P: Fix Operating Channel in Invitation Request for operating group
When a GO or P2P Client invites a peer device to join an already
operating group, the Operating Channel in Invitation Request needs to be
forced to the current operating channel of the group.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:02 +03:00
Jouni Malinen 0c92963656 D-Bus: Clean up debug print for P2P invitation result
wpa_printf() does not need '\n' so remove the extra newline. In
addition, drop the priority of this message from MSG_INFO to MSG_DEBUG
since this is in no way exceptional operation.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:02 +03:00
Jouni Malinen d2858883b0 P2P: Add GO BSS entry details to debug log on join-a-group
This makes it easier to debug issues related to selecting GO information
from the latest updated BSS table entry.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:01 +03:00
Jouni Malinen e241b1b4f2 eap_proxy: Fix IMSI fetch for home vs. visited network determination
Use similar mechanism to CONFIG_PCSC=y case to set the IMSI and MNC
length for eap_proxy. This allows automatic 3GPP realm comparison
against the domain list.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 13:12:04 +03:00
Jouni Malinen a5d44ac083 EAP peer: Add framework for external SIM/USIM processing
The new configuration parameter external_sim=<0/1> can now be used to
configure wpa_supplicant to use external SIM/USIM processing (e.g., GSM
authentication for EAP-SIM or UMTS authentication for EAP-AKA). The
requests and responses for such operations are sent over the ctrl_iface
CTRL-REQ-SIM and CTRL-RSP-SIM commands similarly to the existing
password query mechanism.

Changes to the EAP methods to use this new mechanism will be added in
separate commits.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 13:12:04 +03:00
Jouni Malinen 7e8bc7d6fb eapol_test: Initialize BSS lists
This is needed to avoid issues with control interface commands that
could request BSS list during an eapol_test run. wpa_cli tries to update
its internal BSS list and that could trigger eapol_test crashes without
this.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-19 16:28:56 +03:00
Jouni Malinen bceb843108 Send CTRL-RSP command response before processing EAPOL update
This is what the original implementation did years ago, but the move to
using separate control interface backends re-ordered the implementation
to process EAPOL notification first. Use a registered timeout to allow
the ctrl_iface response to be sent out first to get somewhat faster
response time and to avoid pending operations that could result in
ctrl_iface response and unsolicited event messages from getting mixed
up.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-19 16:26:01 +03:00
Jouni Malinen b6077964c2 eapol_test: Fix external EAP request mechanism
The eap_param_needed callback was forgotten from eapol_test and this
prevented external EAP request processing through ctrl_iface from being
tested.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-19 13:44:39 +03:00
Jouni Malinen 94de082b39 eapol_test: Initialize wpa_s->global to fix ctrl_iface
wpa_s->global is now dereferenced in number of places and at least one
of them hits in eapol_test cases. Fix issues with this by setting the
global pointer to empty data.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-19 13:08:37 +03:00
Jouni Malinen f07bba3255 Android: Add dfs.c into build
This fixes Android build after commit
e76da50529 that added the new dfs.c file.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 15:18:40 +03:00
Jouni Malinen f47c145285 Interworking: Add required_roaming_consortium parameter for credentials
This allows credentials to be limited from being used to connect to a
network unless the AP advertises a matching roaming consortium OI.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 14:13:45 +03:00
Jouni Malinen a83e5749ac GAS: Update timeout from TX status handler
This allow GAS operations to be fine-tuned based what happens with GAS
query TX. Failed queries are timed out immediately and acknowledged
queries are given some more time to account for possible TX queue
latencies.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 14:13:45 +03:00
Jouni Malinen 56f5af489c Interworking: Add support for QoS Mapping functionality for the STA
Indicate support for QoS Mapping and configure driver to update the QoS
Map if QoS Map Set elements is received from the AP either in
(Re)Association Response or QoS Map Configure frame.

This commit adds support for receiving the frames with nl80211 drivers,
but the actual QoS Map configuration command is still missing.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 14:13:45 +03:00
Jouni Malinen ac1bc54948 Interworking: Add domain_suffix_match for credentials
This allow domain_suffix_match to be specified for a cred block and then
get this copied for the network blocks generated from this credential as
part of Interworking network selection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 14:13:45 +03:00
Jouni Malinen 463c8ffbd5 Interworking: Add support for multiple home FQDNs
Credentials can now be configured with more than one FQDN ('domain'
field in the cred block) to perform Domain Name List matching against
multiple home domains.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 14:13:45 +03:00
Jouni Malinen 01f809c7db Add AAA server domain name suffix matching constraint
The new domain_suffix_match (and domain_suffix_match2 for Phase 2
EAP-TLS) can now be used to specify an additional constraint for the
server certificate domain name. If set, one of the dNSName values (or if
no dNSName is present, one of the commonName values) in the certificate
must have a suffix match with the specified value. Suffix match is done
based on full domain name labels, i.e., "example.com" matches
"test.example.com" but not "test-example.com".

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-18 13:34:26 +03:00
Janusz Dziedzic e76da50529 hostapd: Add AP DFS support
Add DFS structures/events handlers, CAC handling, and radar detection.
By default, after radar is detected or the channel became unavailable, a
random channel will be chosen.

This patches are based on the original work by Boris Presman and
Victor Goldenshtein. Most of the DFS code is moved to a new dfs.c/dfs.h
files.

Cc: Boris Presman <boris.presman@ti.com>
Cc: Victor Goldenshtein <victorg@ti.com>

Signed-hostap: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-10-17 21:05:15 +03:00
Pontus Fuchs 5079392954 Increase buffer size and prevent write beyond buffer end
wpa_config_write_key_mgmt has a buffer size of 50. This is not enough
to fit the longest case. I used a network with "WPA-PSK WPA-EAP
WPA-NONE" and CONFIG_IEEE80211R=y + CONFIG_IEEE80211W=y to produce
a string longer than 50 chars. Increase the buffer size to 100 to
prevent truncated output.

Truncated output is not the only problem. If the buffer end is
reached when adding certain key mgmt types the function does not
return immediately. This leaves pos > end. When a second os_sprintf
is called the calculation of end - pos yields a large positive
number for buffer size. End result is a write beyond the buffer end.
Fix this by bailing out if buffer end is reached.

Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>
2013-10-14 20:49:26 +03:00
Jithu Jance 7e910b7b51 WPS NFC: Cancel scheduled scan before attempting a scan
Cancel scheduled scan (if any) before attempting to scan for the newly
received configuration/credential in WPS NFC Config token case.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
2013-10-14 20:42:27 +03:00
Jouni Malinen b72e14e599 P2P: Do not allow P2P client connection without P2P IE from GO
P2P-GROUP-STARTED event depends on having enough information about the
group available. To avoid incomplete information from being delivered to
upper layers, do not accept scan results without P2P IE (e.g., from a
non-P2P scan) for P2P client association process. This can be of use for
some join-a-group cases where non-P2P scans have generated the BSS entry
for the GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 19:41:23 +03:00
Jouni Malinen 5df7414b04 P2P: Allow persistent group determination based on Beacon frame
P2P IE may be available from a Beacon frame from a GO even if we have
not yet received a Probe Response frame with P2P IE from that GO. Since
all the needed information for determining the GO's P2P Device Address
and group capabilities are available, use that information instead of
displaying incomplete group information.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 19:28:00 +03:00
Jouni Malinen aaeb9c98e6 P2P: Allow GO to be discovered based on Beacon frame
This fixes some P2P-join-a-group cases where GO may have been discovered
based on passive scan or non-P2P scan. P2P IEs may have been received
from a Beacon frame in such a case and that information can be used to
create a P2P peer entry, e.g., to allow provision discovery exchange to
be completed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 19:25:28 +03:00
Jouni Malinen b16696ff72 P2P: Show p2p flag in debug info for scan results
This makes it easier to confirm that P2P capabilities for a GO has been
discovered properly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 19:23:38 +03:00
Jouni Malinen bb50ae4396 P2P: Show P2P flag in BSS entries also based on Beacon frames
It is possible that a P2P GO has been discovered through a non-P2P scan
that did not return P2P IE in Probe Response frames. To cover those
cases, check also Beacon frame (if received) for P2P IE.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 19:22:09 +03:00
Jouni Malinen ff57398fca P2P: Do not drop P2P IEs from BSS table on non-P2P scans
This could happen when non-P2P station interface runs a scan without P2P
IE in the Probe Request frame. P2P GO would reply to that with a Probe
Response that does not include P2P IE. Do not update the IEs in this BSS
entry to avoid such loss of information that may be needed for P2P
operations to determine group information.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-14 17:34:41 +03:00
Jouni Malinen adeb4f59a2 P2P: Make sure wait for the first client gets stopped
If a group was removed before the wait for the first client had timed
out and the client had not yet connected, p2p_go_wait_client could have
been left set and with that, scan operations could be unnecessarily
delayed. This fixes some undesired delays from commit
c1c0b35fea.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-05 22:15:28 -07:00
Dmitry Shmidt f22f274bbf P2P: Clone 'disable_scan_offload' parameter for p2p group
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-10-05 18:18:20 -07:00
Deepthi Gowri acdd0fc84f P2P: Clear p2p_group_formation and p2p_in_provisioning on group removal
Commit 41f853235f extends group formation
timeout for the first data connection to complete and resets
p2p_go_group_formation_completed flag due to which p2p_in_provisioning
and p2p_group_formation flags are not cleared when
wpas_group_formation_completed() is called. This can result in both
station scan and p2p_find failures in the case where separate P2P group
interface is not used and the client does not complete 4-way handshake.
Fix this by clearing p2p_group_formation and p2p_in_provisioning when
such a P2P group is deleted.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-05 17:54:52 -07:00
Arif Hussain 8b3b803ab9 Include Extended Capabilities element based on scan results
Add Extended Capabilities element to association request only if the AP
included this element in Beacon/Probe Response frames. This is a
workaround to address interoperability issues with some older APs that
do not seem to be able to handle Extended Capabilities element in
(Re)Association Request frames.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-02 08:09:05 -07:00
Deepthi Gowri 6903ee6f62 P2P Extend postponing of concurrent scans for persistent GO
Update the p2p_go_wait_client timestamp in p2p_go_configured() to
address the case where the group is set up without the provisioning
step.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-02 07:32:17 -07:00
Sunil Dutt f130b105ec TDLS: Clean up wpa_tdls_teardown_link() uses
Making this function be used only for external setup case simplifies the
implementation and makes core wpa_supplicant calls in ctrl_iface.c and
events.c consistent.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-30 17:10:18 +03:00
Jouni Malinen 5388dc97e0 Document use of Linux capabilities instead of privileged process
Linux capabilities cap_net_admin and cap_net_raw can be used to replace
need for running wpa_supplicant as a root process.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-29 12:04:40 +03:00
Jouni Malinen a771c07dfc Add driver status information to control interface
STATUS-DRIVER command can now be used to fetch driver interface status
information. This is mainly for exporting low-level driver interface
information for debug purposes.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-28 17:19:30 +03:00
Jouni Malinen 298f51857d Get rid of compiler warning in no-CONFIG_CTRL_IFACE builds
no_ctrl_interface parsing was declared within ifdef CONFIG_CTRL_IFACE
block, so the parser function needs to be marked similarly.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-27 23:42:37 +03:00
Jouni Malinen ea61aa1de1 Add no_ctrl_interface config param to clear ctrl_interface
This can be used to override previously set ctrl_interface value in a
way that clears the variable to NULL instead of empty string. The only
real use case for this is to disable per-interface ctrl_interface from
the additional control file (-I<file>) in case ctrl_interface was set in
the main configuration file. It should be noted that zero-length
ctrl_interface parameter can be used to initiate some control interface
backends, so simpler designs were not available for this.

The format of the new parameter is not exactly cleanest due to
configuration file parsing assumptions. For example:

ctrl_interface=....
no_ctrl_interface=

would end up with ctrl_interface=NULL.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-27 23:34:35 +03:00
Jouni Malinen 25b65a142d Make sure updated BSS entry does not get added twice to the list
When the BSS table is being updated based on new scan results, a BSS
entry could end up getting added into last_scan_res list multiple times
if the scan results from the driver includes duplicated values. This
should not happen with driver_nl80211.c since it filter outs duplicates,
but in theory, other driver wrappers could indicate such scan results.
Anyway, it is safer to make sure this cannot happen by explicitly
verifying the last_scan_res list before adding an updated BSS entry
there. A duplicated entry in the list could potentially result in freed
memory being used if there is large enough number of BSSes in the scan
results to cause removal of old BSS entries.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-27 16:00:50 +03:00
Jouni Malinen a3cbf82e6d Fix possible freed-memory use in BSS table updates
If there are large number of BSSes in the scan results, BSS table update
could have added a BSS entry to the last_scan_res in a case where that
BSS entry got just deleted. This would happen only if there are more
than bss_max_count (by default 200) BSSes and if at least bss_max_count
of those BSSes are known (match a configured network). In such a case,
wpa_bss_add() could end up allocating a new BSS entry and return a
pointer to that entry even if it was the one that ended up getting freed
to keep the BSS table length within the limit. This could result in
freed memory being used and the process crashing (likely with segfault)
when trying to access information from that BSS entry.

Fix the issue by removing the oldest BSS entry before linking the new
entry to the table. This makes sure the newly added entry will never get
picked up as the one to be deleted immediately.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-27 15:56:06 +03:00
Jouni Malinen bbc6c729a5 P2P: Use group formation timeout on persistent group GO
Previously, GO considered the group to be fully re-invoked after
starting beaconing on successful invitation exchange. This would leave
the group running until idle timeout (which may not be enabled) or
explicit removal if the client fails to connect for any reason. Since
the client is expected to connect immediately after the invitation
exchange that ends with status=0 (i.e., either client initiated the
exchange or it responded with success), extend group formation timeout
to cover that period until the first successfully completed data
connection. This allows the GO to remove the group automatically if the
client devices does not connect within
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE (15) seconds.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-26 21:24:09 +03:00
Jouni Malinen 41f853235f P2P: Extend group formation timeout on GO to first data connection
Previously, GO considered the group to be fully formed at the completed
of WPS provisioning step. This would leave the group running until idle
timeout (which may not be enabled) or explicit removal if the client
fails to connect for any reason. Since the client is expected to connect
immediately after the WPS provisioning step, extend group formation
timeout to cover that period until the first successfully completed data
connection. This allows the GO to remove the group automatically if the
client devices does not connect within P2P_MAX_INITIAL_CONN_WAIT_GO (10)
seconds.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-26 20:32:44 +03:00
Jouni Malinen 20625e9753 P2P: Remove P2P groups on process termination
Killing the wpa_supplicant process or using TERMINATE ctrl_iface command
resulted in the process existing without cleaning up possibly added
dynamic P2P group interfaces. Clean this up by stopping each P2P group
before stopping eloop.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-26 01:38:30 +03:00
Jouni Malinen 76fe79ef2d Register wpa_msg callback even if only global ctrl_iface is used
Previously, wpa_msg_register_cb() was called only from successful
completion of per-interface control interface initialization. This would
leave the callback unregistered in case only the global control
interface is used which would result in not delivering control interface
events on the global interface. Fix this by registering the callback
handler also from successful initialization of the global control
interface.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-26 01:31:32 +03:00
Jouni Malinen 89286e91bf Re-open ctrl_iface socket on some failure cases as a workaround
If wpa_supplicant ctrl_iface clients are misbehaving and refusing to
read replies or event messages from wpa_supplicant, the single socket
used in wpa_supplicant to send messages can reach the maximum send
buffer limit. When that happens, no more responses to any client can be
sent. Work around this by closed and reopening the socket in case such a
failure state is detected. This is obviously not desirable since it
breaks existing connected sockets, but is needed to avoid leaving
wpa_supplicant completely unable to respond to any client. Cleaner fix
for this may require more considerable changes in the ctrl_iface design
to move to connection oriented design to allow each client to be handled
separately and unreachability to be detected more reliably.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-25 16:23:11 +03:00
Jouni Malinen 742e715b31 Simplify ctrl_iface sendto() use
Prepare reply buffer first for all cases and then use a single sendto()
call instead of three calls depending on reply type. This allows simpler
error handling for control interface send operations.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-23 17:52:10 +03:00
Jouni Malinen 6668efda58 Clear frequency list on empty value
Allow current frequency list of be cleared with an empty string value.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-23 16:22:16 +03:00
Masashi Honma 1a9f24714e Make scan_freq field to be saved by save_config
Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-09-23 16:06:06 +03:00
Kamath Vinayak 3cc247a78f Use configured sched_scan interval for the PNO scan
The interval for the PNO scan did not use the configured sched_scan
interval. This commit addresses the same by using the configured value
or the default of 10 seconds if configuration parameter is not used.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-15 15:21:42 -07:00
Jouni Malinen 79986bf69e Print ctrl_iface sendto() failures into debug log
This makes it easier to debug issues with control interface operations
failing.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-14 11:25:31 -07:00
Jouni Malinen eab2b50dc8 P2P: Cancel group formation timeout on client connection
It was possiblle for the group formation timeout to be left running even
after the P2P Client connected to the group if the WPS provisioning step
was not completed cleanly (e.g., due to WSC_Done not getting received
from the client). There is no need to remove the group in such case due
to the initial group formation timeout, so work around this by removing
that timeout on data connection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-14 11:25:10 -07:00
Jouni Malinen 00eb299396 P2P: Fix operation channel configuration update
There was already a CFG_CHANGED_P2P_OPER_CHANNEL handler function, but
this flag was not set when the p2p_oper_reg_class or p2p_oper_channel
parameters were changed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-14 11:24:56 -07:00
Vinay Krishna Eranna b2b688d18d P2P: Fix crash when failed to create GO interface
wpa_supplicant crashes if driver configuration for AP mode interface
configuration fails after group negotiation. This is because of a
regression from commit 1075b29571 that
ends up freeing the wpa_s instance from within
wpa_supplicant_create_ap() without the caller knowing.

Fix this by using an eloop timeout to free remove the P2P group so that
wpa_supplicant_create_ap() and especially wpa_supplicant_associate()
callers do not need to know about interface getting possibly removed. In
addition, move the P2P specific code into p2p_supplicant.c where it
really belongs. This allows the already existing group formation timeout
to be used by reducing the timeout to zero.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-03 12:43:12 +03:00
Jouni Malinen 61971697bb WPS NFC: Fix build without CONFIG_AP=y
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-03 11:27:24 +03:00
Jouni Malinen e1ae5d743f SAE: Fix build without CONFIG_AP=y
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-03 11:25:29 +03:00
Jouni Malinen 813e7b364f P2P: Remove group from timeout on PSK failure
Avoid potential issues with removing a P2P group on PSK failure directly
from the wpa_supplicant_event() call since the caller (in driver_*.c)
may not be prepared for the interface disappearing at that point in
time.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-09-02 16:33:42 +03:00
Jouni Malinen 5bf9a6c859 P2P: Add event messages for possible PSK failures on P2P groups
It is possible for the GO of a persistent group to change the PSK or
remove a client when per-client PSKs are used and this can happen
without the SSID changing (i.e., the group is still valid, but just not
for a specific client). If the client side of such persistent group ends
up trying to use an invalidated persistent group information, the
connection will fail in 4-way handshake. A new WPS provisioning step is
needed to recover from this.

Detect this type of case based on two 4-way handshake failures when
acting as a P2P client in a persistent group. A new
"P2P-PERSISTENT-PSK-FAIL id=<persistent group id>" event is used to
indicate when this happens. This makes it easier for upper layers to
remove the persistent group information with "REMOVE_NETWORK <persistent
group id>" if desired (e.g., based on user confirmation).

In addition to indicating the error cases for persistent groups, all
this type of PSK failures end up in the client removing the group with
the new reason=PSK_FAILURE information in the P2P-GROUP-REMOVED event.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 21:35:10 +03:00
Jouni Malinen eac8dab87c P2P: Document per-client keys and p2p_remove_client
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 21:35:10 +03:00
Jouni Malinen 43c693c21a P2P: Do not store duplicate PSK entries for the same device
If a client joins a P2P group multiple times, replace the previous
per-client PSK entry instead of adding a new entry each time.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 21:35:10 +03:00
Jouni Malinen f2c566027e P2P: Add a command for removing a client from all groups
The new control interface command P2P_REMOVE_CLIENT <P2P Device
Address|iface=Address> can now be used to remove the specified client
from all groups (ongoing and persistent) in which the local device is a
GO. This will remove any per-client PSK entries and deauthenticate the
device.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 21:35:10 +03:00
Jouni Malinen 01a57fe420 P2P: Maintain list of per-client PSKs for persistent groups
Record all generated per-client PSKs in the persistent group network
block and configure these for the GO Authenticator whenever re-starting
the persistent group. This completes per-client PSK support for
persistent groups.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 21:35:10 +03:00
Jouni Malinen 759fd76b7f P2P: Select PSK based on Device Address instead of Interface Address
When using per-device PSKs, select the PSK based on the P2P Device
Address of the connecting client if that client is a P2P Device. This
allows the P2P Interface Address to be changed between P2P group
connections which may happen especially when using persistent groups.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 11:30:26 +03:00
Jouni Malinen 94ddef3e72 P2P: Make peer's P2P Device Address available to authenticator
This can be used to implement per-device PSK selection based on the
peer's P2P Device Address instead of P2P Interface Address.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 11:05:19 +03:00
Jouni Malinen 52177fbb70 P2P: Store P2P Device Address in per-device PSK records
This makes the P2P Device Address of the Enrollee available with the PSK
records to allow P2P Device Address instead of P2P Interface Address to
be used for finding the correct PSK.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 10:47:34 +03:00
Jouni Malinen 05766ed8de P2P: Allow per-device PSK to be assigned
"wpa_cli p2p_set per_sta_psk <0/1>" can now be used to disable/enable
use of per-device PSKs in P2P groups. This is disabled by default.
When enabled, a default passphrase is still generated by the GO for
legacy stations, but all P2P and non-P2P devices using WPS will get
a unique PSK.

This gives more protection for the P2P group by preventing clients from
being able to derive the unicast keys used by other clients. This is
also a step towards allowing specific clients to be removed from a group
reliably without having to tear down the full group to do so.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-09-01 10:14:29 +03:00
Jouni Malinen 698e921b9e wpa_cli: Add tab completion for p2p_set field values
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-31 20:58:35 +03:00
Syed Asifful Dayyan Rafiuddeen 0b5fb86a24 P2P: Stop listen state when listen-only duration is over
Even after listen duration is over, P2P module remained in
P2P_LISTEN_ONLY state, which is blocking station mode scans. Fix this by
stopping P2P listen explicitly to update p2p_state to IDLE when listen
duration expires.

Signed-hostap: Syed Asifful Dayyan <syedd@broadcom.com>
2013-08-31 18:09:15 +03:00
Jouni Malinen 02a3e5c0d1 wpa_cli: Allow first DISCONNECTED event to be reported
wpa_cli filters out extra DISCONNECTED events from action scripts. This
ended up filtering out the first real DISCONNECT event in case wpa_cli
was started when wpa_supplicant was in connected state. Change wpa_cli
to allow the first disconnection event to be reported to the action
script in such case.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-31 17:27:20 +03:00
Jouni Malinen 731ef436d1 D-Bus: Fix per-iface object unregistration on not existing objects
If the private data for an object is not found, do not try to unregister
that object to avoid D-Bus errors.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-31 16:46:24 +03:00
Jouni Malinen 447969e034 D-Bus: Do not send network notification for all P2P groups
Previously, network added event was skipping during group formation.
However, this did not necessarily catch all cases of temporary P2P
network blocks. Check ssid->p2p_group to make this behavior more
consistent by avoiding all P2P groups.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-31 16:44:42 +03:00
Masashi Honma eb32460029 Fix switching from EAP-SIM to EAP-AKA/AKA'
Switching EAP method from EAP-SIM to EAP-AKA fails.
wpa_cli commands are below.

------------------
sudo wpa_cli add_network
sudo wpa_cli set_network 0 ssid '"eap-sim"'
sudo wpa_cli set_network 0 key_mgmt WPA-EAP
sudo wpa_cli set_network 0 eap SIM
sudo wpa_cli set_network 0 pin '"1234"'
sudo wpa_cli set_network 0 pcsc '""'
sudo wpa_cli select_network 0

sudo wpa_cli disable_network 0
sudo wpa_cli disconnect
sudo wpa_cli remove_network 0

sudo wpa_cli add_network
sudo wpa_cli set_network 0 ssid '"eap-sim"'
sudo wpa_cli set_network 0 key_mgmt WPA-EAP
sudo wpa_cli set_network 0 eap AKA
sudo wpa_cli set_network 0 pin '"1234"'
sudo wpa_cli set_network 0 pcsc '""'
sudo wpa_cli select_network 0
------------------

Then EAP-AKA connection resulted in fail.
wpa_supplicant log is below.

------------------
wlan0: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 23 (AKA) selected
SCARD: Non-USIM card - cannot do UMTS auth
EAP-AKA: UMTS authentication failed (AUTN)
wlan0: CTRL-EVENT-EAP-FAILURE EAP authentication failed
------------------

This occurs because on the first EAP-SIM authentication, the SIM/USIM
card in the device was recognized as SIM card even if it is USIM card.

So this patch changes it to recognize as USIM card even if EAP-SIM
authentication was required.

I have tested these switching cases.
EAP-SIM -> EAP-AKA
EAP-SIM -> EAP-AKA'
EAP-AKA -> EAP-SIM
EAP-AKA -> EAP-AKA'
EAP-AKA' -> EAP-SIM
EAP-AKA' -> EAP-AKA

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-08-31 16:11:48 +03:00
Sreenath Sharma f2b3f4de49 P2P: Allow P2P functionality to be disabled per interface
By default, P2P is initialized for all driver interfaces and this makes
P2P getting initialized for non-P2P station interface if the supplicant
is started first on this interface. If an interface is dedicated for
non-P2P station mode, it is now possible to disable P2P initialization
by adding 'p2p_disabled=1' in the configuration file of non-P2P station
interface, irrespective of the order in which supplicant is started.

Signed-hostap: Sreenath Sharma <sreenats@broadcom.com>
2013-08-31 11:59:05 +03:00
Sreenath Sharma 43ee470494 P2P: Immediate group removal in GC in case of deauthentication
Right now in case of deauthentication from GO, immediate group removal will
happen in GC only if the deauthentication packet has a valid IE. However,
the IE in deauthentication packet is mandated only for managed P2P group.
So in normal P2P group the group removal is delayed and will happen later
only in group idle timeout.

This fixes a regression from commit
d7df0fa727 that changed the previous check
for data->deauth_info != NULL to data->deauth_info->ie != NULL.

Signed-hostap: Sreenath Sharma <sreenats@broadcom.com>
2013-08-31 11:11:41 +03:00
Jouni Malinen add7add09d IBSS RSN: Add a timeout for Authentication frame exchange
It is possible for the peer device not to support Authentication frame
exchange even though this would be required functionality in the
standard. Furthermore, either Authentication frame may be lost. To
recover from cases where Authentication frame sequence 2 is not
received, start EAPOL Authenticator from one second timeout.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-27 16:26:33 +03:00
Jouni Malinen c1c0b35fea P2P: Postpone concurrent scans when waiting for first client as GO
Previously, concurrent station mode scans were postponed during an
ongoing P2P group formation up to the point of completed WPS
provisioning step. This would allow a scan to be started before the P2P
client has completed association for the data connection if a scan
request were timed to hit the window between the provisioning step and
the following association. Avoid this by extending P2P-in-progress state
to continue until the first data connection has been completed as part
of group formation. Use a ten second timeout for this to avoid leaving
scans disabled indefinitely if the client fails to connect completely.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-27 12:23:10 +03:00
Jouni Malinen 6fb7b58fe4 IBSS RSN: Work around Data RX vs. Authentication RX race condition
It is possible for the driver to report EAPOL frame RX before
Authentication frame RX even if the frames arrived in the opposite
order. This can result in issues in cases where both IBSS peers initiate
Authentication frame exchange at about the same time and one of the
EAPOL sessions is started before processing Authentication frame seq=1
RX. Work around this by not re-initializing EAPOL state on
Authentication (SEQ=1) RX if own Authentication frame was transmitted
within last 500 ms.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-27 02:54:35 +03:00
Jouni Malinen 99d7c76294 P2P: Add more debug info on operating channel selection
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-26 14:08:03 +03:00
Jouni Malinen 8d660e04e9 P2P: Add GO negotiation results into the P2P-GO-NEG-SUCCESS event
This provides status information about the negotiated group to
wpa_supplicant control interface monitors during group formation in a
form that is easier to use than having to fetch the information
separately.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-26 13:35:44 +03:00
Jouni Malinen 2c6f8cf6c8 Replace perror() with wpa_printf(strerror) in ctrl_iface calls
This replaces number of perror() calls with wpa_printf() to get the
error messages embedded within rest of the debug messages in the same
stream instead of pushing these to stderr which may get directed to
another location.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-26 11:46:21 +03:00
Jouni Malinen e743db4309 IBSS RSN: Add IBSS-RSN-COMPLETED event message
This new control interface event message is used to indicate when
both 4-way handshakes have been completed with a new IBSS peer.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 23:09:22 +03:00
Jouni Malinen 4c559019bd P2P: Add state info to global STATUS command
This can be used for debugging purposes to see what the current P2P
module state is.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 21:02:12 +03:00
Jouni Malinen ae8c27f79d Add STATUS command to global control interface
This provides global status information that is applicable to all
interfaces (e.g., P2P state). In addition, ifname/address pairs are
listed to get information of all the interfaces that are currently
managed through this wpa_supplicant instance.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 20:53:58 +03:00
Jouni Malinen 42868f1486 Add SAVE_CONFIG command to global control interface
This iterates through all interfaces and saves configuration file
updates for each interface that allows it (update_config=1).

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 20:41:39 +03:00
Jouni Malinen 1b9b31c153 Add SET command for global control interface
This allows global parameters to be set through the global control
interface without having to use IFNAME prefix. For now, this covers
only the wifi_display parameter.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 20:35:19 +03:00
Jouni Malinen 25a8f9e316 Clear EAPOL supplicant configuration info on current_ssid changes
There were some code paths that allowed obsolete configuration data
pointer to be maintained within EAPOL supplicant in case a network was
removed while not connection to it (i.e., wpa_s->current_ssid not
pointing to the network that was removed). This could result in use of
freed memory, e.g., from eap_sm_notify_ctrl_attached() when a new
control interface connected prior to the EAPOL supplicant configuration
pointer got updated.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-25 19:46:57 +03:00
Avraham Stern 973622cd44 wpa_supplicant: Fix AP mode frequency initialization
In AP mode the frequency was initialized only after trying to set up the
AP which caused failure. Move AP frequency initialization to the right
place. This allows an AP mode network block without the frequency
parameter to be used with the default channel 11 being selected in that
case.

Signed-hostap: Avraham Stern <avraham.stern@intel.com>
2013-08-25 11:24:29 +03:00
Ilan Peer d99ca89d98 P2P: Skip non-P2P interface in p2p_group_remove *
When 'p2p_group_remove *' is called while the station interface
is connected, the flow also disconnects the station interface.
Fix this by skipping non-P2P interfaces in the iteration.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-08-25 11:17:14 +03:00
David Spinadel 239abaf2ab WPS: Set currently used RF band in RF Bands attribute
According to WSC specification (Ver 2.0.2, section 8.3), RF Bands
attribute should be set to the specific RF band used for the current
message. Add an option to set wanted band in wps_build_rf_bands() and
add a callback to get the current band from wpa_supplicant and hostapd.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-08-25 10:55:53 +03:00
Ilan Peer e0591c3cfe wpa_supplicant: Reduce wait time for control interfaces
Reduce the wait time for the monitor control interfaces to get
messages on wpa_supplicant de-init etc., as this significantly delays
the shutdown of the wpa_supplicant.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-08-25 09:48:27 +03:00
Arik Nemtsov 5046eb4e4d P2P: Allow separate interface GO to disconnect low-ack STAs
Propagate the disassoc_low_ack setting from the main P2P interface to
the group interface.

Signed-hostap: Arik Nemtsov <arik@wizery.com>
2013-08-25 09:28:50 +03:00
Jouni Malinen a235aca316 Fix DETACH command debug prints to avoid use of freed memory
In case a control interface socket is detached because of sendmsg()
failing for the socket, function call to detach the socket uses a
pointer to the socket information in the structure to be freed. Reorder
code to print socket info before freeing the data to avoid use of freed
memory in case debug prints are enabled.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-24 23:31:06 +03:00
Jouni Malinen 8d6e035072 Make global UNIX socket non-blocking for ctrl_iface
This keeps wpa_supplicant from hanging forever if the other end of the
socket dies. This is similar to the earlier commit
4fdc8def88 to make the global control
interface befave in the same way.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-24 20:31:04 +03:00
Jouni Malinen 86bd141050 Change WEP network selection to reject WPA/WPA2 APs
Previously, wpa_supplicant behavior in WEP configuration was to try to
mimic a device that is not aware of WPA/WPA2 and as such, it tried to
connect to a WPA/WPA2 AP with the assumption that the AP could be
providing support for both WEP and WPA/WPA2 stations in the same BSS.
Such APs could have been used during transition from WEP to more secure
options, but that type of deployment have not been used in large number
and are not really of much use anymore taken into account that more or
less all new devices support WPA/WPA2. That combined with the preference
to deprecate WEP justifies removing this use case and making WEP
networking matching more strict by using the knowledge of AP advertising
WPA/WPA2 as an indication of WEP not being supported.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-23 19:27:25 +03:00
Jouni Malinen 2e145e91e7 WPS: Fix failure path to allow WSC_NACK and EAP-Failure to be exchanged
Commit c7a67a7719 forced disconnection
when wpas_clear_wps() is called. Call this function from a registered
timeout when processing a failure event in order to allow the WPS
handshake to be completed with WSC_NACK and EAP-Failure.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-23 17:49:01 +03:00
Jeffin Mammen 50396e29da WPS: Add PBC mode activated/disabled events
This makes it easier to track PBC state on the registrar.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-23 16:52:48 +03:00
Jouni Malinen 961750c1e8 WPS: Share a common function for error strings
This makes it easier to maintain the list of WPS_EI_* error values and
matching strings.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-23 16:32:34 +03:00
Jouni Malinen 85a6cdb571 Revert "P2P: Reject p2p_find while P2P connection is in progress"
This reverts commit ce970851af.

It turned out that this breaks lots of use cases where p2p_find is
issued while already in p2p_listen state. As such, we cannot reject
p2p_find this easily without checking for more specific cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-08-01 17:03:06 +03:00
Deepthi Gowri ce970851af P2P: Reject p2p_find while P2P connection is in progress
Though p2p_find is not expected during ongoing P2P connection, it is
possible that any third party application issues a p2p_find resulting in
connection failure. Address this by rejecting any p2p_find command while
connection is in progress.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-08-01 15:39:47 +03:00
Wei-Jen Lin a2ea8d64d1 P2P: Fix invalid remain-on-channel duration for frame TX
cfg80211 does not allow the zero duration of remain-on-channel. Instead,
use 20 ms as default waiting time when remain-on-channel is used to
schedule offchannel transmission that does not expect a response.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-31 23:22:04 +03:00
Sean Lin cbf41ca796 P2P: Do not delay retries on failure during group formation
4-way handshake may fail under extremely noisy environment and if this
happens during P2P group formation, the 10 second extra delay added in
wpas_auth_failed() can result in running over the 15 second timeout.

Avoid this by skipping the delay mechanism in wpas_auth_failed() for the
P2P group formation case. The P2P formation timeout will take care of
stopping the attempts if the failure condition does not get resolved.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-31 23:09:34 +03:00
Ilan Peer 0d08efa447 P2P: Use the number of concurrent channels in P2P flows
Change the P2P flows to use the number of concurrent channels
supported by the device and the number of currently used channels
for the P2P flows.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-07-21 20:48:09 +03:00
Jouni Malinen a21816a933 Use wpa_drv_shared_freq() if get_radio_name() is not supported
Some driver interfaces may not support the get_radio_name() design and
get_shared_radio_freqs() needs to be aware of such possibility when
determining shared radio frequencies.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-21 20:48:09 +03:00
Ilan Peer 53c5dfc2c4 Change share_vif_oper_freq() to handle multiple freqs
There are devices that can operate several channels concurrently.
Change shared_vif_oper_freq() to get_shared_radio_freqs() that can
return an array of frequencies currently used by all the virtual
interfaces that share the same radio.

In addition, move it to wpa_supplicant.c, so it can be used by other
modules.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-07-21 20:03:53 +03:00
Ilan Peer 4752147d88 nl80211: Report the number of concurrent support channels
Previously, drivers only reported if they support multiple concurrent
channels, but did not report the maximum number of supported channels.
Add this reporting to the driver capabilities and add the implementation
to driver_nl80211.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-07-21 19:49:47 +03:00
Jouni Malinen d7df0fa727 Clean up wpa_supplicant_event() with deauth/disassoc helper functions
wpa_supplicant_event() has grown overly large, so it is useful to split
it into smaller pieces.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-21 16:40:40 +03:00
Jouni Malinen fd9f170098 Remove unnecessary nested ifdef CONFIG_AP
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-21 16:01:29 +03:00
Antonio Quartulli 13adc57b39 IBSS RSN: Add peer restart detection
To better support the IBSS/RSN mechanism, wpa_supplicant has to be able
to detect a possible peer reboot and in this case it should start a new
EAPOL handshake.

To perform such reboot detection wpa_supplicant has to perform an Open
Authentication by sending an Authentication frame and then replying to
it. IF an Authentication frame is received when the key have already
been exchanged, wpa_supplicant understands that the peer has rebooted
and can reset its state machine.

Whenever a new peer is added to the IBSS wpa_supplicant will start the
Open Authentication and only after having accomplished it will start the
key exchange. If the driver does not support Authentication frame
exchange initiated from user space, this step is skipped to maintain
previous behavior (just go through EAPOL-Key frame processing).

The Open Authentication was partly supported by the Linux kernel but now
wpa_supplicant can register for Authentication frames, handle it in
userspace and so avoid any possible race condition.

Signed-hostap: Nicolas Cavallari <cavallar@lri.fr>
Signed-hostap: Antonio Quartulli <antonio@open-mesh.com>
2013-07-21 15:56:53 +03:00
Jouni Malinen ec384c566a IBSS RSN: Fix disconnect() with internal SME
Commit 1aef400bf0 implemented IBSS RSN
disconnect() call using sta_deauth() in a way that resulted in NULL
pointer dereference in driver_nl80211.c if SME was in user space. Fix
this by passing the own MAC address in the sta_deauth call.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-21 15:21:38 +03:00
Arend van Spriel 4ed8d954dd TDLS: Tear down TDLS using wpas_drv_tlds_oper() if not external
When the device indicates to take care of TDLS operations the TDLS
setup is done calling wpas_drv_tdls_oper(). This patch does a similar
thing for the teardown. This fixes failure of teardown:

"TDLS: Could not find peer <mac> for link Teardown"

Signed-hostap: Arend van Spriel <arend@broadcom.com>
2013-07-20 17:52:32 +03:00
Chengyi Zhao 831770bffe Cancel delayed scheduled scan when wpa_supplicant cleans up
Because a delayed scheduled scan will access the members of struct
wpa_supplicant which is freed and this can result in a crash,
wpa_supplicant needs to cancel delayed scheduled scan during cleanups.

Signed-hostap: Chengyi Zhao <chengyix.zhao@gmail.com>
2013-07-20 17:47:02 +03:00
Michal Kazior c8ebeda406 wpa_supplicant: Add support for VHT BSS membership selector
This allows wpa_supplicant to associate to an AP that has VHT BSS
membership selector set to indicate VHT support is required for the BSS.

Without the patch it was impossible to connect to, e.g., hostapd-based
AP that has require_vht=1. wpa_supplicant was complaining with:
  hardware does not support required rate 63.0 Mbps

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>
2013-07-20 17:28:42 +03:00
Jouni Malinen 1075b29571 P2P: Report group formation failure on error to start GO mode
There is no need to wait for the 15 second group formation timeout
before indicating P2P group formation failure if GO mode cannot be
started successfully for some reason.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-11 17:04:46 +03:00
Jouni Malinen b62b29ea87 Do not block on ctrl_iface monitor events
It looks like some of the global control interface cases ended up
blocking in sendmsg() when trying to send an event. Since this can block
all wpa_supplicant processing for multiple seconds, this is very
undesirable. Avoid this by requesting sendmsg() to return an error
rather than waiting for the message to be sent.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-11 17:04:29 +03:00
Jouni Malinen 0b9d3b22c8 Interworking: Relax 3GPP info PLMN matching for MNC
3GPP TS 24.232 Annex A.3 allows network operator to advertise only two
digits of MNC even if MNC has three digits. Allow such matches in
network selection. In addition, allow three digit matches of MNC even if
MNC length was assumed to be two to avoid missing networks if MNC length
cannot be determined reliably. Remove the '-' separator from simulated
SIM/USIM cases to allow the new matching rules to work.

Fix the PLMN List information element parsing loop to use the length of
the PLMN List instead of the length of the full 3GPP Cellular Info to
avoid unexpected matches should a new element ever be added by 3GPP.

Finally, add more debug prints from PLMN matching to make the logs
easier to understand.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-08 16:53:05 +03:00
Junli Zhao c7a67a7719 WPS: Disconnect when removing existing WPS network block
wpas_clear_wps() was just clearing the current wpa_s->current_ssid
pointer when removing a WPS network block which with the device was
associated. This could leave the association up even though the network
block had already been removed. Prevent this by explicitly disconnecting
from the network instead of such clearing current_ssid.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-07-08 12:09:18 +03:00
Jouni Malinen 7e7610d788 EAP-EKE: Add peer implementation
This adds a new password-based EAP method defined in RFC 6124.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-07 20:30:10 +03:00
Tomasz Bursztyka 06aeff5f8f dbus: Register the AutoScan method call at the right place
Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2013-07-01 19:11:34 +03:00
Jouni Malinen 78f79fe5fc P2P: Do not add ctrl interface for P2P_DEVICE (p2p-dev-*)
Adding a new wpa_supplicant control interface for the dedicated
P2P_DEVICE would be quite confusing for programs that manage P2P
operations. Remove this control interface and require the global control
interface to be used since it will provide consistent interface for both
the new dedicated P2P_DEVICE (non-netdev) and old style P2P management
through a netdev.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-07-01 00:36:33 +03:00
Jouni Malinen 1c42b42f6c P2P: Fix TDLS and l2_packet init without P2P Device interface
Commit c68f6200a7 made these calls
conditional on !p2p_mgmt, but forced p2p_mgmt=1 for cases where the
driver does not use the dedicated P2P Device. Fix this by making the
!p2p_mgmt condition apply only if the driver does indicate use of a
dedicated P2P Device.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-06-30 20:02:25 +03:00
Jouni Malinen 9e6a321815 Fix non-P2P build after the P2P_DEVICE changes
Commit c68f6200a7 added a call to a
function that exists only for P2P builds. Fix that with #ifdef
CONFIG_P2P.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-06-30 13:19:59 +03:00
Arend van Spriel 2e5ba4b6d1 P2P: Derive group interface name bit more sensibly
The interface name for the P2P group interface is derived from the
P2P management interface. When the P2P management interface is a
P2P Device interface, i.e., p2p-dev-wlanX, the name for the group
interface is abbreviated to p2p-X (X being group index). When the
P2P management interface starts with p2p-dev- use its postfix
instead. So P2P management interface p2p-dev-wlan3 results in group
interface name p2p-wlan3-0.

Signed-hostap: Arend van Spriel <arend@broadcom.com>
2013-06-30 10:50:14 +03:00
Arend van Spriel c68f6200a7 P2P: Create P2P Device interface if supported
If the capability flag of the driver indicates a dedicated P2P Device is
supported, a P2P Device interface is created.

Create the P2P Device in main interface creation loop when the added
interface flags support and P2P supplicant is not yet initialized
avoiding recursion of add_interface.

Do not register l2_packet for P2P Device interface (both for EAPOL and
for TDLS).

Signed-hostap: Arend van Spriel <arend@broadcom.com>
2013-06-30 10:50:14 +03:00
Arend van Spriel bb4028f165 P2P: Ignore p2p_no_group_iface when driver advertizes P2P_DEVICE support
Setting p2p_no_group_iface means 'use P2P management interface as P2P
connection interface' because it attempts to change the interface type.
The P2P_DEVICE is a dedicated interface and can not be changed. As such
ignore the configuration option.

Signed-hostap: Arend van Spriel <arend@broadcom.com>
2013-06-30 10:50:13 +03:00
Jouni Malinen 080585c01a Add support for OCSP stapling to validate server certificate
When using OpenSSL with TLS-based EAP methods, wpa_supplicant can now be
configured to use OCSP stapling (TLS certificate status request) with
ocsp=1 network block parameter. ocsp=2 can be used to require valid OCSP
response before connection is allowed to continue.

hostapd as EAP server can be configured to return cached OCSP response
using the new ocsp_stapling_response parameter and an external mechanism
for updating the response data (e.g., "openssl ocsp ..." command).

This allows wpa_supplicant to verify that the server certificate has not
been revoked as part of the EAP-TLS/PEAP/TTLS/FAST handshake before
actual data connection has been established (i.e., when a CRL could not
be fetched even if a distribution point were specified).

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-06-30 01:01:15 +03:00
Arend van Spriel 72950ed240 P2P: Remove a call to wpas_p2p_deinit_global()
In wpa_supplicant_deinit(), the function wpas_p2p_deinit_global()
was called. Remove it as it will be called from wpas_deinit_iface()
upon removal of the P2P management interface.

Signed-hostap: Arend van Spriel <arend@broadcom.com>
2013-06-25 13:56:28 +03:00
Chengyi Zhao 8a901d750b D-Bus: Emit signal when a station is authorized or deauthorized
Add "StaAuthorized" and "StaDeauthorized" D-Bus interface in AP mode.
After enabling the AP mode of wpa_supplicant, the other process need to
get the MAC address and authorization status of every station, so
wpa_supplicant emits signal when the station is authorized or
deauthorized.

Signed-hostap: Chengyi Zhao <chengyix.zhao@gmail.com>
2013-06-22 12:09:09 +03:00
Andrei Otcheretianski 9578329874 Add AVG_RSSI report in signal_poll
Add AVG_RSSI report to the signal_poll command if it is reported by
the kernel.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-06-22 12:01:05 +03:00
Andrei Otcheretianski 2cc8d8f4e8 Add bandwidth and center freq info to signal_poll
Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-06-22 12:00:46 +03:00
Alexander Bondar 1e0e943e19 Remove 802.11b rates only in case of P2P group operation
11b rates removal have had impact on SoftAP functionality in
wpa_supplicant. This patch verifies that only in case of P2P group
operation 11b rates will be eliminated. Refer also to commit
4c2c302893.

Signed-hostap: Alexander Bondar <alexander.bondar@intel.com>
Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-06-22 11:28:33 +03:00
Jouni Malinen ec7b97ab00 Interworking: Add support for using eap_proxy offload
Fetch IMSI through eap_proxy for Interworking network selection if
needed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-19 18:42:17 +03:00
Jouni Malinen aa20e1a1fb Remove CONFIG_NO_WPA2 build parameter
There is not much use for enabling WPA without WPA2 nowadays since most
networks have been upgraded to WPA2. Furthermore, the code size savings
from disabling just WPA2 are pretty small, so there is not much
justification for maintaining this build option. Remove it to get rid of
undesired complexity.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-07 20:13:25 +03:00
Jouni Malinen 5d5c4ee5e0 Remove compiler warnings with CONFIG_NO_SCAN_PROCESSING
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-07 20:04:56 +03:00
Jouni Malinen 9aaa6955a8 Remove compiler warnings if TDLS is enabled without WPA2
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-07 20:04:12 +03:00
Bharat Bhushan 1aef400bf0 IBSS RSN: Implement disconnect() callback using sta_deauth()
This allows driver wrappers to implement disconnection of IBSS peers in
cases operations, e.g., GTK update, fail.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-07 13:07:17 +03:00
Wei-Jen Lin 4abc0424ef P2P: Automatic channel selection at re-invocation of persistent GO
If the driver wrapper supports best operation channel indication, the
p2p_group_add command can now use special values (freq=2 and freq=5) to
indicate that the re-invoked persistent GO is to be started on the
specified band.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-06-05 02:06:29 +03:00
Jouni Malinen e78aaca0da Stop TKIP countermeasures on FLUSH command
This is needed to get wpa_supplicant into clean state during testing if
a test case triggers countermeasures.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-24 16:02:58 +03:00
Jouni Malinen 376204934d wpa_cli: Support tab completion with ifname= prefix
Enable tab completion for the cases where ifname= prefix is used in
interactive mode by skipping over that prefix before running through the
per-command completion routines. The ifname= prefix itself is also
covered by adding the possible interface names to the command list.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-23 20:35:02 +03:00
Jouni Malinen 13b11ba702 wpa_cli: Allow IFNAME= prefix to be used
Strip out the IFNAME=<ifname> prefix from commands before parsing them
through the normal processing and then add the prefix back to the
beginning of the actual control interface command to make per-interface
commands work through the global control interface without having to use
the 'raw' command.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-23 20:04:17 +03:00
Jouni Malinen ae8535b6e1 WNM: Make ESS Disassoc Imminent event more convenient to use
Define a proper event prefix and include additional information to allow
ESS Dissassociation Imminent event to be used in a wpa_cli action
script.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-23 16:51:03 +03:00
Jouni Malinen 6df634faf9 WNM: Do not reject ESS Disassoc Imminent
This indication is not expected to include candidates, so do not reject
it based on that.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-23 16:50:55 +03:00
Jouni Malinen 7b53acd395 WNM: Use defines for BSS Trans Mgmt field values
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-23 16:50:39 +03:00
Jouni Malinen dad153d16b Try to use fast-associate on ENABLE_NETWORK
This makes ENABLE_NETWORK behave similarily to SELECT_NETWORK by
allowing a scan to be skipped if recent scan results are available.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-22 16:10:59 +03:00
Jouni Malinen b06800170a Fix already-associated detection with driver-based BSS selection
wpa_s->pending_bssid is all zeros during connection attempt when
driver-based BSS selection is used. Take this into account when
determining whether new scan results should trigger a connection based
on wpa_s->current_ssid, i.e., a connection attempt with the selected
network instead of selected BSS.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-22 16:10:59 +03:00
Sean Lin 72728c6fa8 P2P: Relax channel forcing for invitation processing with MCC support
When STA interface is connected and P2P interface gets invited in a
different channel from previous P2P group, the invitiation would fail
because of no common channel found. Fix this by using different logic
when device support multi channel concurrency.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-22 13:29:46 +03:00
Jouni Malinen f65f539d9a GAS: Reduce query timeout to two seconds
The five second timeout for GAS queries is excessive and can result in
long waits in cases where APs are either misconfigured or frames are
lost.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-20 11:09:34 +03:00
Jouni Malinen 7a56af545a GAS: Assign new dialog token even if previous one is free
This makes the design more robust against unexpected duplicates since
each new GAS exchange gets a different dialog token compared to the
previous one.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-20 11:09:16 +03:00
Jouni Malinen 9e1ecab1c5 GAS: Ignore replays if previous frag_id without dropping GAS session
It looks like it may be possible for an older GAS response to get retransmitted
even after the first copy has been processed. While this should not really come
up all the way to wpa_supplicant due to sequence number being same (i.e.,
duplicate detection should from the frame), some cases have been observed where
this did cause issues. Drop such a frame silently without dropping the ongoing
GAS session to allow a frame with the next frag_id to be processed after this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-20 11:08:47 +03:00
Jouni Malinen fa7ae9501b Add test code for fetching the last configured GTK
This can be useful for some test cases, so allow wpa_supplicant to be
built with special test functionality to expose the current (last
configured) GTK. This is disabled by default and can be enabled by
adding following line into .config:
CFLAGS += -DCONFIG_TESTING_GET_GTK

The GTK can then be fetched with "wpa_cli get gtk".

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-20 11:00:56 +03:00
Jouni Malinen 576bce9c86 P2P: Direct global ctrl_iface commands automatically for P2P
The P2P management operations like P2P_FIND and P2P_CONNECT are not
really specific to any network interface. These are P2P Device level
operations that are in more global device context. Allow those to be
sent through the global control interface without IFNAME parameter.

For now, these commands are directed within wpa_supplicant to the
network interface that initialized the global P2P context. This may
change in the future if a special context is added for P2P operations.
Anyway, such changes can now be done internally within wpa_supplicant
without affecting this global control interface design from external
view point.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 19:41:08 +03:00
Jouni Malinen c4bf83a723 P2P: No duplicate AP-STA-CONNECTED/DISCONNECTED as global event
These events are sent as a special case to both the group interface and
"parent interface" (i.e., the interface that was used for managing P2P
negotiation). The latter is not really correct event, so get rid of it
with the new global control interface design where there is no need to
support legacy upper layer implementations.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 19:18:31 +03:00
Jouni Malinen 92c4465b75 P2P: Mark P2P events global (not specific to interface)
This removes the "IFNAME=<ifname> " prefix from P2P events that are
received through the global control interface since these events are not
really specific to any network interface, but the full device.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 18:59:51 +03:00
Jouni Malinen ed496f131f P2P: Clean up debug prints
Replace direct wpa_msg() calls with p2p_dbg(), p2p_info(), and p2p_err()
calls that use a new debug_print() callback to handle actual debug
printing outside the P2P module.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 18:47:36 +03:00
Jouni Malinen 710ae9ac1f P2P: Move p2p_find stopped event message into p2p_supplicant.c
This removes wpa_ctrl.h dependency from src/p2p/* and makes the P2P
events more consistent, i.e., everything that is aimed for upper layer
processing from the wpa_supplicant control interfaces is generated in
p2p_supplicant.c.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 16:06:40 +03:00
Jouni Malinen 47bfe49c31 Add wpa_msg_global() for global events
This function can be used instead of wpa_msg() and wpa_msg_ctrl() to
indicate that an event is not specific to a network interface.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 14:19:24 +03:00
Jouni Malinen 214e428b42 Allow global ctrl_iface monitors
The ATTACH/DETACH mechanism to request event messages from
wpa_supplicant can now be used through the global control interface,
too. This results in events from all interfaces being delivered through
a single monitor socket. "IFNAME=<ifname> " prefix is used on events
that are specific to an interface.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 14:07:28 +03:00
Dmitry Shmidt 89c7ac570b wpa_cli: Set buffer length the same as in wpa_supplicant_ctrl_iface_process()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-05-18 12:21:44 +03:00
Jouni Malinen faf9a8585d Add band option (2.4 vs. 5) for filtering scans
This can be used to implement filtering of channels for scan and based
on that, for connection, purposes.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-18 12:17:10 +03:00
Jouni Malinen b83b1b2da8 Android: Clarify keystore include directories
This updates hostapd to build using the new keystore header file
location and adds a note that the old frameworks/base/cmds/keystore can
be removed at some point in the future when old Android releases do not
need to be supported.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 12:03:35 +03:00
Jouni Malinen d2a9e2c76d Abstract and Android sockets for global ctrl_iface
The wpa_supplicant global control interface parameter can now be used to
explicitly specify an abstract UNIX domain socket (Linux specific
extension) with "@abstract:" prefix and an Android control socket with
"@android:" prefix.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 11:42:09 +03:00
Jouni Malinen 6fd5ceaf70 wpa_cli: Allow global interface to be used in interactive mode
This is mostly a corner case at this point, but if wpa_cli was started
with global control interface connection (-g) and interactive mode,
per-interface control interface was tried to be opened with the
previously opened global ctrl_iface connection gettign leaked.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 11:40:23 +03:00
Jouni Malinen 2925756575 wpa_supplicant: Add -G argument to specify global ctrl group
The optional -G<group> command line argument can be used to specify the
group that can access the global control interface.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 11:00:05 +03:00
Jouni Malinen cf3bebf28c Allow global ctrl_iface to be used for per-interface commands
"IFNAME=<ifname> " prefix can now be used on the wpa_supplicant global
control interface to direct a command to a specific interface instead of
having to use an interface specific control interface for this. This
allows a single socket to be used for controlling multiple virtual
interfaces.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-18 10:19:38 +03:00
Suryadevara Sudheer c6ccf12d3f P2P: Use preferred channel list during GO creation
This extends support for p2p_pref_Chan configuration parameter for
autonomous GO creation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-17 11:27:02 +03:00
Yufeng Wang 010b5f9bfc P2P: Fix p2p_pref_chan setting from configuration file
Commit 21d996f775 added p2p_pref_chan as a
configuration file parameter, but included only the case of dynamically
setting this at runtime through the control interface SET command.
Complete this functionality by taking this value into use directly from
the configuration file, too.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-17 11:03:52 +03:00
Daniel Gnoutcheff d7692b8d1c dbus: Terminate cleanly on messagebus shutdown
By default, dbus_connection_dispatch() will call _exit() if the bus
connection has been closed. This caused wpa_supplicant to terminate
without properly cleaning up after itself.

To ensure that we terminate cleanly when the messagebus terminates,
override the exit_on_disconnect behavior and install a filter to handle
libdbus's "Disconnected" signal.

[Bug 474]

Signed-hostap: Daniel Gnoutcheff <daniel@gnoutcheff.name>
2013-05-16 20:47:28 +03:00
Vinayak Kamath e2396a684e WNM: Enable CONFIG_WNM in Android.mk
Signed-hostap: Vinayak Kamath <vkamat@codeaurora.org>
2013-05-16 17:51:18 +03:00
Vinayak Kamath 65bcd0a92d WNM: Add sending of BSS Transition Management Query
The new control interface command can be used to send a
BSS Transition Management Query frame to the current AP.

Signed-hostap: Vinayak Kamath <vkamat@codeaurora.org>
2013-05-16 17:50:31 +03:00
Vinayak Kamath e27d20bb68 WNM: Add neighbor report processing for BSS Transition Management
Process the neighbor report received in BSS Management Request frames.

Signed-hostap: Vinayak Kamath <vkamat@codeaurora.org>
2013-05-16 17:48:59 +03:00
Jouni Malinen f3e907a745 WPS: Clear connection failure counts on WPS success
The WPS provisioning case does not result in successful connection by
design and as such, this can result in networks getting temporarily
disabled. Avoid this by clearing the failure counts on WPS success.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-15 17:33:50 +03:00
Jouni Malinen 170f5663dc WPS NFC: Connect using learnt credential after NFC Tag read
Instead of just adding the new network, prefer the network learnt from a
configuration token during the first connection attempt. This makes the
WPS NFC case behave similarly to the in-band provisioning cases if there
are more preferred networks in the scan results.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-15 16:46:45 +03:00
Jouni Malinen e679f140b9 Mark interface disconnected on removal request
This cleans up debug log by not trying to process the disconnection
event as a failure that could result in blacklist addition and auto
connect attempt. These are pointless operations since the interface is
going to removed immediately after this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-12 19:18:55 +03:00
Jouni Malinen 3636b891b7 Do not try auto connect mechanism in disconnected state
This cleans up debug log by not requesting the auto connect on
dissassociation event if we are already in disconnected state and would
not try to connect anyway.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-12 19:18:55 +03:00
Jouni Malinen 0cdb93fe9f Do not add BSS to blacklist on local disconnection request
There is no point in marking a BSS temporarily blacklisted based on a
connection failure or disconnection case if that happens as a result of
a local request to disconnect. The blacklist entry could result on
unexpected BSS getting selected on the next connection attempt. In
addition, the code to try to find another BSS within the ESS could
result in scanning a single channel on the next attempt. Fix these
issues by handling the connection failure events only if we are not in
disconnected state (i.e., would try to reconnect after this
automatically).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-12 19:18:55 +03:00
Deepthi Gowri 36b9883d84 Defer scan if connection is in progress on any of the shared interfaces
Scanning can delay concurrent operations considerably, so it is better
to avoid that while trying to connect on any of the virtual interfaces
that share the same radio.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-10 16:10:50 +03:00
Ben Greear 6124e858fd wpa_supplicant: Allow vifs to scan only current channel
If a VIF is already associated, then only scan on the associated
frequency if user requests such. This is a big help when using
lots of virtual stations.

Signed-hostap: Ben Greear <greearb@candelatech.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
2013-05-09 12:43:40 +03:00
Arend van Spriel 893a0a558c systemd: Fix systemd interface alias
In the systemd interface templated the alias entry was specified
with wlan0 hard coded. Changing it to %i in this patch. [Bug 477]

Reported-by: zg <ml@mail.tsaitgaist.info>
Signed-hostap: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
2013-05-09 11:25:48 +03:00
Jouni Malinen 6ea1f4135b Try to set WPA-None key after IBSS-joined event
cfg80211 rejects the set_key operations before the IBSS network has been
fully formed, so add one more attempt to set the key for WPA-None at
IBSS joined driver event.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-07 18:14:56 +03:00
Jouni Malinen 66562e9c75 Use cached driver capabilities instead of new fetch for each operation
There is no need to repeat the driver capability fetch for each
operation since we already cache driver flags in wpa_s->drv_flags.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-07 17:36:40 +03:00
Sheng Fang 4aa8186806 Add a configration parameter for sched_scan interval
The new sched_scan_interval parameter can be used to set the default
sched_scan interval, e.g., for power saving purposes.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-07 12:41:14 +03:00
Jouni Malinen f11b72c3e9 TDLS: Move AID=1 workaround into driver_nl80211.c
The use of AID=1 for the nl80211 dummy STA case is specific to the
driver (cfg80211), so better move this into the driver wrapper instead
of generic TDLS implementation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-06 15:57:03 +03:00
Sunil Dutt 785336998d TDLS: Pass peer's AID information to kernel
The information of the peer's AID is required for the driver to
construct partial AID in VHT PPDU's. Pass this information to the driver
during add/set station operations (well, as soon as the information is
available, i.e., with set station operation currently).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-05-06 15:47:44 +03:00
Jouni Malinen 55a2df4389 HS 2.0: Include HS 2.0 Indication element only for HS 2.0 association
The Hotspot 2.0 specification seems to mandate this element to be
included in all (Re)Association Request frames if the station is Hotspot
2.0 capable. However, that results in conflicts with other requirements
like no TKIP use when this element is present. The design is really
supposed to include the indication element only for Hotspot 2.0
associations regardless of what the current specification implies.
Remove the HS 2.0 Indication element from (Re)Association Request frame
whenever the connection is not for Hotspot 2.0 purposes.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-05 16:29:21 +03:00
Jouni Malinen 9be371437e wpa_cli: Fetch the current BSSID list when starting interactive mode
This makes tab completion work better in cases where wpa_cli is started
after wpa_supplicant has already discovered BSSes.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-05 12:38:55 +03:00
Jouni Malinen 69aa33411e wpa_cli: Add BSSID tab completion for set bssid_filter
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-05 12:20:35 +03:00
Jouni Malinen 215658726f wpa_cli: Replace set command help with completion routine
The old help text did not include most of the parameters and as such,
was not really helpful. Replace it with tab completion function that
includes more or less all available parameters.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-05 12:18:43 +03:00
Jouni Malinen f1fb042cec wpa_cli: Allow space in the set command value
Previously, interactive mode could not be used to enter space-separated
lists with the set command. This removes that restriction and allows
such commands to be encoded properly.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-05 11:53:20 +03:00
Ben Greear f5ffc348dc wpa_supplicant: Allow global scan frequencies configuration
This allows one to limit the channels that wpa_supplicant will
scan. This is a useful addition to the freq_list configurable
in the network {} section.

Signed-hostap: Ben Greear <greearb@candelatech.com>
2013-05-05 11:46:54 +03:00
Jouni Malinen abfc3ad9af Synchronize build config comments for wpa_supplicant
This updates number of comments in android.config to match the latest
version in defconfig and adds some of the entries that were previously
present only in android.config into defconfig.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-04 20:19:50 +03:00
Jouni Malinen a01e10da68 Android: Enable WPS ER and NFC support in the build
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-04 20:19:47 +03:00
Jouni Malinen 0f105f9e5f HS 2.0: Move Probe Request Indication IE addition to proper place
This needs to be in wpa_supplicant_extra_ies() to get consistent
behavior for both scan and sched_scan cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-05-04 11:57:56 +03:00
Ilan Peer 41b1a76a96 P2P: Clone beacon_int when initializing new group interface
Signed-hostap: Ilan Peer <ilan.peer@intel.com>
2013-05-04 11:25:29 +03:00
Vinayak Kamath 741ed9fc25 WPS: Remove duplicate networks after WPS
Each attempt to connect to the same network using WPS would result
in the duplicate configuration getting added. Avoid such redundant
additions by comparing the network configuration with an already
existing one and remove the older network if the new credential
provisioned through WPS is identical.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-30 13:35:50 +03:00
Jouni Malinen b57b560034 wpa_supplicant: Default to nl80211 instead of wext
nl80211 has obsoleted WEXT as the preferred kernel interface for
controlling wireless drivers. Update wpa_supplicant driver interface
list order so that nl80211 gets used first if both nl80211 and wext
interfaces are included in the build. In addition, update README to
reflect the fact that WEXT is obsolete.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-29 16:55:44 +03:00
Jouni Malinen a8a7890d7c Clear extra_blacklist_count on FLUSH command
This is needed to avoid old blacklist failure counts from being valid
after state flush.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-28 22:35:15 +03:00
Jouni Malinen 5e24dc8a4b Add dup_binstr() to help common binary string tasks
There are quite a few places in the current implementation where a nul
terminated string is generated from binary data. Add a helper function
to simplify the code a bit.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-27 23:44:59 +03:00
Jouni Malinen 04382f7d6f NFC: Add no waiting and no multiple operations options for scripts
The nfcpy script used to be run in a way that left them running for
multiple operations. This is not desired for some use cases, so provide
options to request only a single operation to be performed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-27 22:15:23 +03:00
Jouni Malinen 28fcfb67c0 NFC: Increase wpa_cli command buffer size
NFC connection handover messages may be longer than 100 octets, so
increase wpa_cli buffer size to allow longer messages to be reported.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-27 22:14:45 +03:00
Jouni Malinen e864c0aefe Use a common frequency to channel conversion function
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-27 22:11:51 +03:00
Deepthi Gowri 02db75b6c2 FT: Reset FT flag upon STA deauthentication
Reset ft_completed if STA receives deauthentication
between FT reassoc success and the subsequent initial
mobility authentication and association.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-26 17:56:24 +03:00
Jouni Malinen dd57970477 Disable network temporarily on repeated connection failures
Previously, only explicit indications of authentication failures were
used to disable a network block temporarily. Extend this to use multiple
failed connection attempts as a sign of a possible authentication or
authorization failure to reduce the frequency of connection attempts
with a network that does not seem to allow connection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-04-25 17:28:50 +03:00
Jouni Malinen 06b7f58def RSN: Update preauth scan results only based on new scan results
The fast-connect optimization to skip a new scan did not update how the
RSN preauthentication callback is used. There is no point in trying to
add preauthentication candidates from cases where scan was skipped, so
skip this call, too, in such cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-23 18:24:00 +03:00
Jouni Malinen 18e00b5e4d Move wpa_s freeing into wpa_supplicant_deinit_iface()
All wpa_supplicant_deinit_iface() callers ended up freeing wpa_s
immediately after this call. Move os_free(wpa_s) into the deinit
function to share the same call and make the deinit sequence clearer.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-23 18:07:41 +03:00
Paul Stewart 754632c965 dbus_new: Add EAP logon/logoff
Add "EAPLogoff" and "EAPLogon" interface DBus commands which
parallel the "logoff" and "logon" wpa_ctrl commands which terminate
and restart EAP authentication.  Slightly enhance the "logon" case
by expiring any running "startWhile" timer.

Signed-hostap: Paul Stewart <pstew@chromium.org>
2013-04-23 17:57:55 +03:00
Dmitry Shmidt e6304cad47 wpa_supplicant: Add option -I for additional config file
This option can be used only for global parameters that are not going
to be changed from settings.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-04-23 17:38:57 +03:00
Bruno Randolf 060605226f wpa_supplicant: Add get_capability freq
Add "get_capability freq" command to print a more verbose list of
channels and frequencies in MHz. The tag "NO_IBSS" is added, if IBSS
mode is not allowed on a channel. This allows userspace programs to get
the frequencies and limitations associated with each channel.

This extends the information already provided in "get_capability
channels" but a new interface is chosen because of backwards
compatibility considerations.

Signed-hostap: Bruno Randolf <br1@einfach.org>
2013-04-23 16:55:54 +03:00
Chris Hessing c7a39ba4e1 Provide TLS alerts to CLI/UI over control interface
Harmonize EAP status events over control interface to provide same
functionality as existing D-Bus callback.

Signed-hostap: Chris Hessing <chris.hessing@cloudpath.net>
2013-04-23 16:46:02 +03:00
Jouni Malinen 2a07a276ec P2P: Increase GTK rekeying period to 24 hours
Strong ciphers do not need frequent rekeying, so increase the default
GTK rekeying period to 24 hours.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-23 14:11:10 +03:00
Jouni Malinen 88c8bf311e WPS NFC: Allow configuration token to be built from network block
"WPS_NFC_CONFIG_TOKEN <WPS/NDEF> <network id>" can now be used to build
an NFC configuration token from a locally configured network.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 21:28:57 +03:00
Jouni Malinen e205401c72 WPS ER: Allow Enrollee to be specified with MAC address
wps_er_pbc and wps_er_pin can now be used with both the UUID and MAC
Address of the Enrollee.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 20:52:44 +03:00
Jouni Malinen c44a19c1f9 WPS ER: Document additional NFC command for ER operations
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 20:36:15 +03:00
Jouni Malinen 59307b3007 WPS ER: Allow AP to be specified with BSSID
This extends the WPS ER commands that previously accepted only UUID as
an identifier for an AP to use either UUID or BSSID for this.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 20:32:09 +03:00
Jouni Malinen 5c9d63d46f WPS: Be more careful with pre-configured DH parameters
Make the implementation more robust against error cases with
pre-configured DH parameters.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 19:27:32 +03:00
Jouni Malinen 17b8995cf5 Interworking: Try to use same BSS entry for storing GAS results
There may be cases where multiple BSS entries for a single BSSID are in
the table. This is mostly in automated test cases due to the AP
configuration changes, but something similar could potentially happen as
a corner case in more realistic networks, too, e.g., when an AP changes
its operating channel. Make network selection more robust by trying to
find the exact BSS entry instead of any BSS entry with a matching BSSID
when storing GAS/ANQP response.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-01 11:44:04 +03:00
Jouni Malinen 3db5439a5f Optimize Extended Capabilities element to be of minimal length
Leave out zero octets from the end of the element.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-31 21:58:17 +03:00
Johannes Berg 8cd6b7bce8 hostapd/wpa_s: Use driver's extended capabilities
Some extended capabilities (I'm currently interested in "Operating Mode
Notification" for VHT) are implemented by the kernel driver and exported
in nl80211. Use these in hostapd/wpa_supplicant.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-03-31 21:51:44 +03:00
Jouni Malinen acb546436a Add ctrl_iface command FLUSH for clearing wpa_supplicant state
This is mainly for testing purposes where it is convenient to have an
easy way of getting wpa_supplicant state cleared between test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-31 20:31:07 +03:00
Masashi Honma 97236cee6a WPS: Skip rescanning after provisioning if AP was configured
If WPS provisioning step is completed with an AP that is in WPS
configured state, we can skip a second scan after the provisioning step
since the AP is unlikely to change its configuration in such a case.
This can speed up WPS connection a bit by removing an unneeded scan.

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-03-31 20:06:42 +03:00
Jouni Malinen 4342326fc7 Add ignore_old_scan_res configuration parameter
This can be used to configure wpa_supplicant to ignore old scan results
from the driver cache in cases where such results were not updated after
the scan trigger from wpa_supplicant. This can be useful in some cases
where the driver may cache information for a significant time and the AP
configuration is changing. Many such cases are for testing scripts, but
this could potentially be useful for some WPS use cases, too.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-31 18:05:42 +03:00
Jouni Malinen 9599ccc2dd WPS: Clear after_wps on new WPS connection
The after_wps counter could have potentially be left in its old non-zero
value in some WPS sequences which could result in a single-channel scan
being used based on obsolete information. Clear after_wps in
wpas_wps_reassoc() to make sure this does not happen.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-31 18:05:42 +03:00
Jouni Malinen 702621e6dd WPS: Use latest updated BSS entry if multiple BSSID matches found
If the AP (P2P GO) has changes its channel of SSID recently, the BSS
table may have multiple entries for a BSSID. Select the one which was
most recently updated for WPS/P2P operations in such case to increase
the likelihood of using current information.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-31 18:05:42 +03:00
Jouni Malinen 2f9b66d3ab Extend ROAM command to handle multiple SSIDs per BSS
Select the BSS entry based on BSSID,SSID pairs instead of just BSSID to
avoid selecting an unexpected SSID for the ROAM command.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-30 11:49:05 +02:00
Jouni Malinen ef8151ac57 P2P: Write p2p_ignore_shared_freq to configuration file on updates
Commit b277a2bebc added a new global
configuration parameter, but forgot to update configuration file saving
to store this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-26 22:24:41 +02:00
Jouni Malinen 18a2eaabe3 Add ap_vendor_elements for wpa_supplicant AP/P2P GO mode
This new parameter allows wpa_supplicant AP mode operations to use
similar design to the vendor_elements parameter in hostapd to add
vendor_elements into Beacon/Probe Response IE parameters.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-21 15:52:41 +02:00
Jouni Malinen 407be00b6c P2P: Postpone P2P scan only if station mode scan is pending
sta_scan_pending was supposed to be accurate enough for determining
whether a P2P scan needs to be postponed. However, it has turned out
that there were cases where sta_scan_pending was not cleared properly.
While the known cases have now been addressed, it is possible that some
other cases may still exist. To avoid issues with P2P operationg getting
stuck, verify more carefully that there is a real pending station mode
scan (either in progress or scheduled to be requested).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-18 17:32:31 +02:00
Jouni Malinen cfd31b5026 Use special scan result processing steps only on requesting interface
Scan result events are shared between all virtual interfaces sharing the
same radio. However, some of the steps are not really appropriate on
virtual interfaces that did not issue the scan request. Fix this by
making these steps conditional on the scan results being processed on
the interface that requested them.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-18 17:32:31 +02:00
Jouni Malinen b1cd021e29 P2P: Re-start P2P operation if station mode scanning is stopped
There were couple of code paths that could end up stopping station mode
scanning without clearing sta_scan_pending. This could result in P2P
search getting stuck waiting for completion of station mode scan which
would never show up. Fix this by calling wpas_p2p_continue_after_scan()
in cases where station mode scans are stopped. This allows
sta_scan_pending to be cleared and P2P search operation continued.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-18 17:32:31 +02:00
Jouni Malinen f85f545e71 P2P: Use common function for re-starting P2P scan after station scan
Make the implementation more consistent and cleaner by using a single
function for addressing all the cases where completion of a station mode
scan operation allows a P2P operation (search) to be re-started.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-18 17:32:31 +02:00
Jouni Malinen 095da179de Android: Enable WNM in the build
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-17 20:19:44 +02:00
Jouni Malinen ce9283a401 Android: Use CONFIG_WNM mode consistently
Replace CONFIG_IEEE80211V with CONFIG_WNM to get more consistent build
options for WNM-Sleep Mode operations. This is similar to the Makefile
change in commit ad3872a372.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-17 20:13:46 +02:00
Jouni Malinen 69586aa312 Android: Fix CONFIG_WNM use in Android.mk
This code was within ifdef CONFIG_AP and did not get included unless
AP mode support was also enabled. This is similar to the Makefile
change in commit 2dfb9a447c.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-17 20:10:44 +02:00
Jouni Malinen 3b335329b9 Android: Update Android.mk based on Makefile changes
This brings the Android makefiles a bit closer to the Makefile changes
that had been missed in the past.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-17 20:08:23 +02:00
Jouni Malinen c3aa4da94d Convert WPS NFC python scripts from using wpactrl to wpaspy
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-16 21:47:10 +02:00
Partha Narasimhan b2a12c4f93 wpa_supplicant: Fix lookup of cached PMKSA
This fixes the lookup of a usable PMKSA entry in the cache. Using
wpa_s->current_ssid often returns nothing when a usable PMKSA exists in
the cache since wpa_s->current_ssid does not necessarily point to the
correct network entry at this point in time (prior to association).

Signed-hostap: Partha Narasimhan <parthan@gmail.com>
2013-03-16 12:45:31 +02:00
Bruno Randolf 65d52fc103 Add capability flag for IBSS and add get_capability modes
Add a driver capability flag for drivers which support IBSS mode and set
it for nl80211 drivers which have set the NL80211_IFTYPE_ADHOC.

Add a new option "modes" to "get_capability" which will return "AP" and
"IBSS" if the corresponding capability flags are set.

The idea is that this can be used for UIs to find out if the driver
supports IBSS mode.

Signed-hostap: Bruno Randolf <br1@einfach.org>
2013-03-16 12:42:15 +02:00
Jouni Malinen 21f01a8e3d Fix build with CONFIG_NO_CONFIG_BLOBS
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-16 12:20:21 +02:00
Solomon Peachy 7d37a357fa Fix build without CONFIG_CTRL_IFACE or CONFIG_NO_STDOUT_DEBUG
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2013-03-16 12:07:18 +02:00
Jouni Malinen dbca75f82a P2P: Remove persistent group peer if it rejects invitation
If a peer replies to persistent group invitation with status code 8
(unknown group), remove the peer from the p2p_client_list if we are the
GO or remove the persistent group if we are the P2P client since it
looks like that the peer has dropped persistent group credentials and
the provisioning step needs to be executed again.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-15 16:43:06 +02:00
Jouni Malinen b277a2bebc P2P: Allow shared interface channel preference to be ignored
p2p_ignore_shared_freq=1 in the configuration file (or "SET
p2p_ignore_shared_freq 1" on control interface) can now be used to
configure wpa_supplicant to ignore the preference on shared operating
channel when the driver support multi-channel concurrency. The default
behavior is to try to start any new P2P group on an operating channel
that is already in use on another virtual interface to avoid extra cost
from hopping between multiple channels. If this new parameter is set to
1, such preference is not used and instead, the channel for the new P2P
group is selected based on other preferences while ignoring operating
channels of any concurrent connection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-14 16:32:35 +02:00
Jouni Malinen 6cb27aa85f P2P: Fix shared frequency preference for concurrent operations
Commit 50285f5ca8 changed number of rules
in channel selection and among other things, it broke the design where
the currently used operating channel on a virtual interface that is
shared by the same radio is preferred to avoid costs related to
multi-channel concurrency. Fix this regression by making the P2P module
aware of the shared channel and using that preference as the highest
priority when re-selecting the channel during negotiation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-14 16:26:55 +02:00
Jouni Malinen a70a52c316 P2P: Allow all channels for multi-channel concurrency (no negotiation)
Commit 79879f4ae8 enabled all channels to
be used when negotiating channel with a driver that supports
multi-channel concurrency. Extend that to cover cases where the channel
is not being negotiated (e.g., p2p_group_add to start a GO).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-14 15:38:11 +02:00
Jouni Malinen b6714ca1bb Fix compiler warning when CONFIG_IEEE80211R is not included
Commit 6a1ce39599 moved the bssid
variable declaration to be outside CONFIG_IEEE80211R block and
triggered a compiler warning about unused variable.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-13 12:40:57 +02:00
Jouni Malinen 94d7acf3df WPS NFC: Fix build without CONFIG_WPS_ER
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-13 00:02:52 +02:00
Deepthi Gowri ee9a95c34e Android: Enable IEEE 802.11r in wpa_supplicant builds
Signed-off-by: Deepthi Gowri <deepthi@codeaurora.org>
2013-03-12 20:09:41 +02:00
Deepthi Gowri 6a1ce39599 FT: Add support for IEEE 802.11r with driver-based SME
Add NL80211_CMD_UPDATE_FT_IES to support update of FT IEs to the
WLAN driver. Add NL80211_CMD_FT_EVENT to send FT event from the
WLAN driver. This will carry the target AP's MAC address along
with the relevant Information Elements. This event is used to
report received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE).

Signed-off-by: Deepthi Gowri <deepthi@codeaurora.org>
2013-03-12 20:08:53 +02:00
Vivek Natarajan c9c77083b3 P2P: Clear p2p_in_provisioning flag on group removal
Commit 77dfafd07d cancels group formation
timeout on group removal case but failed to reset the
p2p_in_provisioning flag. This can lead to repeated p2p_find failures if
the group gets removed before completion of the WPS provisioning step
(e.g., GO tears down the group). Fix this by clearing
p2p_pin_provisioning when cancelling group formation.

Signed-hostap: Vivek Natarajan <nataraja@qca.qualcomm.com>
2013-03-11 20:47:24 +02:00
Chet Lanctot 9210bea172 Android: Enable IEEE 802.11w support in the build
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-11 13:52:13 +02:00
Chet Lanctot 3ee9ade6cf Allow SME SA Query to be used by all drivers
The unprotected disconnection events were previously processed only for
drivers that used the wpa_supplicant SME implementation (separate
authentication and association commands). However, this can be useful
for drivers that use the connect API, so remove the limitation and allow
the same IEEE 802.11w SA Query mechanism to be used even without full
use of the wpa_supplicant SME.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-11 13:49:40 +02:00
Jouni Malinen 5139008b51 Android: Sync makefile changes for HT/VHT overrides
CONFIG_HT_OVERRIDES and CONFIG_VHT_OVERRIDES were already mentioned in
android.config, but Android.mk did not yet know about them.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-10 18:05:40 +02:00
Johannes Berg e9ee8dc394 wpa_supplicant: Support VHT capability overrides
Add support for VHT capability overrides to allow testing connections
with a subset of the VHT capabilities that are actually supported by
the device. The only thing that isn't currently supported (by mac80211
and this code) is the RX/TX highest rate field.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-03-10 18:04:39 +02:00
Johannes Berg eae3a584f5 wpa_supplicant: Parse int values in different bases and reject invalid
Instead of using atoi(), use strtol() which allows checking if
the configuration values are valid integers and can understand
more than just decimal (also hexadecimal and octal). This not
only allows specifying some fields in hex (which can be useful)
but also rejecting invalid configurations, e.g.,
        disassoc_low_ack=27 * 2
which was previously read as just 27.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-03-10 17:55:24 +02:00
David Spinadel 725fc39e07 wpa_supplicant: Reschedule sched scan after network change
Stop sched scan, if running, after any disabling or removing of
a network, and request a new scan if needed.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-03-10 17:51:13 +02:00
Jouni Malinen 14f7907890 Remove unnecessary local variable
The ssid parameter (if NULL) can be used for the loop, too, to make the
code look a bit prettier.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-03-10 17:45:15 +02:00
David Spinadel dca1a51149 wpa_supplicant: Handle enabling of one or all networks equally
Move enabling a network to a separate function. Try to reconnect if not
associated to an AP. Abort scheduled scan in any case of a new scan.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-03-10 17:43:00 +02:00
David Spinadel 7ed52f678b wpa_supplicant: Save prev_sched_ssid only if needed
If the whole ssid list was scanned, don't save the prev scheduled ssid
since we are going to start from beginning. Thos avoids starting sched
scan from prev_sched_ssid after scanning the full list, in case of
adding a network to ssid during scheduled scan.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-03-10 17:32:03 +02:00
David Spinadel a09fc1ccf8 wpa_supplicant: Do not allow too short sched scan
In case that the ssid list is longer than max number of ssids,
ths scheduled scan aborted after timeout and rescheduled again
with shorter timeout and longer interval. In case that the timeout
is shorter than the interval, only one scan iteration will
be run. In this case, go back to the initial values.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
2013-03-10 17:27:48 +02:00
Jouni Malinen 77e4e85321 P2P: Mark peer authorized for persistent group invitation
When p2p_invite persistent=<id> is used to request a persistent group to
be re-invoked, the peer may reply with status=1 (info not yet available)
if upper layer processing of the invitiation is requested. The peer is
ten expected to start another invitation exchanged within 120 seconds if
the user authorizes the connection. Allow this process to be used more
easily by automatically authorizing the peer that we tried to invite to
use this second invitation sequence even if persistent_reconnect=0.

For this mechanism to work, the device that starts the invitation needs
to start listen mode to be able to receive the invitation request from
the peer. At least for now, this is not done automatically, but future
changes could potentially enable this automatically at least if there
are no concurrent operations in progress.

Example sequence on the initiator:

cmd: P2P_INVITE persistent=1 peer=<addr>
event: P2P-INVITATION-RESULT status=1
cmd: P2P_LISTEN 120
wait for peer to start another invitiation round.. group will be
re-invoked automatically

On the peer (with persistent_reconnect=0):

event: P2P-INVITATION-RECEIVED sa=<addr> persistent=1 [freq=<MHz>]
wait for user approval
cmd: P2P_INVITE persistent=1 peer=<addr>
group will be re-invoked automatically

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 21:32:33 +02:00
Jouni Malinen cd1e2309a2 P2P: Indicate frequency for upper layer invitation processing
When a device that is a GO in a persistent group receives an Invitation
Request from a P2P client and persistent_reconnect=0, upper layer is
notified of this with P2P-INVITATION-RECEIVED event. The upper layer is
supposed to run another invitation exchange is this case, but if that
does not happen and the GO is started without successful (status=0)
invitation exchange, the operating channel for the group may end up
getting set in a way that the P2P client is not able to support. Provide
optional freq parameter in the P2P-INVITATION-RECEIVED event on the GO
side. If this parameter is received and the upper layer decides to issue
P2P_GROUP_ADD command, that command should include this freq parameter
to make sure the operating channel gets selected from the set that the
peer can support.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 21:27:31 +02:00
Jouni Malinen 18206e02c5 Allow wpa_supplicant AP mode to configure Beacon interval
beacon_int (in TU) can now be used to configure Beacon interval for AP
mode operations (including P2P GO) in wpa_supplicant. This can be set
either in a network block or as a global parameter in the configuration
file (or with "SET beacon_int <value>" control interface command) to
apply for all networks that do not include the beacon_int parameter to
override the default.

In addition, this commits extends the dtim_period parameter to be
available as a global parameter to set the default value. dtim_period is
now stored in the configuration file, too, if it was set.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 20:50:08 +02:00
Jouni Malinen 5473362458 P2P: Use peer's channel list to limit GO freq on invitation
Peer device includes its list of allowed operating channels in the
Invitation Response frame. When we are becoming the GO, use that list
from the peer to filter out acceptable channels to avoid selecting a
channel that the peer is unable to use.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 20:01:01 +02:00
Jouni Malinen f5877af01e P2P: Allow P2P client to specify preferred group channel
When re-invoking a persistent group in P2P client role, the new
pref=<MHz> parameter can now be used with the p2p_invite command to
indicate a preferred operating frequency. Unlike the older freq=<MHz>
parameter, this leaves GO an option to select another channel (from our
supported channels) if the GO cannot accept the channel.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 19:40:54 +02:00
Jouni Malinen 5de4b72177 P2P: Use shared function for setting up frequencies
p2p_connect() and p2p_invite() cases used more or less identical
implementatin. Use a shared function to avoid duplicated code.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 18:40:39 +02:00
Deepthi Gowri 79879f4ae8 P2P: Allow all channels in case of multi channel concurrency
If multi channel concurrency is supported, we have to populate the
p2p_channels with list of channels that we support. Use the same design
that was previously added for GO Negotiation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-03-01 18:40:39 +02:00
Jouni Malinen ff48691368 Avoid partial BSS entries in control interface
Most of the print_bss_info() cases were already returning zero lenth to
avoid returning partial returns to the BSS commands, but the HS 2.0 and
Wi-Fi Display entries behaved differently. Make those consistent with
rest of the items.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-28 18:49:33 +02:00
Dmitry Shmidt cfd42c94ee Mark last BSS entry by #### instead of ====
This allows ctrl_iface users to iterate through the BSS entries by
fetching multiple BSS entries with "BSS RANGE=N-" without having to use
one extra round to get empty return value as the indication of the last
entry having been found.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-02-28 18:46:06 +02:00
Dmitry Shmidt c667342933 Add WPA_BSS_MASK_DELIM flag to BSS command
This flag will add ==== delimiter between to separate bss results.
Unlike the other BSS command MASK values, this delimiter is not
included by default to avoid issues with existing users of the BSS
command.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-02-28 18:43:05 +02:00
Masashi Honma 5e24beae02 Use scan results for reconnection
This patch uses existing scan results for fast connection on REASSOCIATE
and RECONNECT commands.

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-02-28 16:34:08 +02:00
Masashi Honma ad5dda8222 Interworking: Remove unused variable warnings
This patch removes these warnings.

interworking.c: In function 'interworking_credentials_available_3gpp':
interworking.c:1330:6: warning: unused variable 'ret' [-Wunused-variable]
interworking.c:1329:19: warning: unused variable 'cred' [-Wunused-variable]

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
2013-02-28 16:34:06 +02:00
Jouni Malinen aec309c407 wpa_cli: Increase receive buffer from 2048 to 4096 bytes
wpa_supplicant uses 4096 byte buffer for control interface responses, so
wpa_cli should do the same to avoid truncating responses unnecessarily.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-27 15:59:55 +02:00
Sunil Dutt f8361e3d68 TDLS: Pass peer's VHT Capability information during sta_add
The information of the peer's VHT capability is required for the
driver to establish a TDLS link in VHT mode with a compatible peer.
Pass this information to the driver when the peer station is
getting added.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-25 10:31:50 +02:00
Jouni Malinen f23ce1f032 WPS: Add AP mode NFC connection handover with wpa_supplicant/nfcpy
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-24 10:57:06 +02:00
Jouni Malinen f3f2ba2e6e WPS NFC: Add connection handover support for ER
wpa_supplicant can now generate the WPS carrier record for connection
handover response when acting as an ER. The AP whose configuration is
provided in this way is identified with an UUID as an argument to
wps-nfc.py.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-24 10:56:29 +02:00
Jouni Malinen c39fdb8529 WPS: Add wps-er-config command for writing config token from ER
UUID of the AP is specified on the command line to select which
configuration is used.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-24 10:54:18 +02:00
Jouni Malinen b618a469c4 Interworking: Select highest priority cred if multiple matches
Previously, the credential to use for a connection with a specific BSS
was picked arbitrary based on first found match of each matching
mechanism. While the credential priorities were used elsewhere, this did
not take into account that different mechanisms could find multiple
matching credentials. As such, the highest priority credential was not
always used in case more than one credential matched with the selected
BSS. Fix this by checking credential priorities again during connection
request.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-02-16 19:57:35 +02:00