mech_eap.git
8 years agoMake sure configuration is saved to storage device
Mitchell Wills [Tue, 25 Aug 2015 00:24:30 +0000 (17:24 -0700)]
Make sure configuration is saved to storage device

Config file is written to a temp file and then it is renamed to the
original config file. However, it is possible that the rename operation
will be commited to storage while file data will be still in cache
causing original config file to be empty or partially written in case of
a system reboot without a clean shutdown. Make this less likely to occur
by forcing the data to be written to the storage device before renaming
the file.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
8 years agotests: More WPS ER coverage
Jouni Malinen [Mon, 24 Aug 2015 21:19:52 +0000 (00:19 +0300)]
tests: More WPS ER coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: BSS entry expiration when AP changes SSID
Jouni Malinen [Tue, 25 Aug 2015 17:43:01 +0000 (20:43 +0300)]
tests: BSS entry expiration when AP changes SSID

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDo not mark BSS entry in use if SSID has changed
Jingxiang Ge [Tue, 25 Aug 2015 17:31:40 +0000 (20:31 +0300)]
Do not mark BSS entry in use if SSID has changed

This allows a BSS entry to be expired if the AP has changed its SSID
while maintaining the same BSSID and we are associated with the BSS.
Previously, the same BSSID was enough to mark all BSS entries from the
BSSID as in use regardless of the SSID and as such, they could remain in
the wpa_supplicant BSS table indefinitely as long as the association
remaining.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWPS: Fix HTTP body length check
Jouni Malinen [Mon, 24 Aug 2015 21:17:00 +0000 (00:17 +0300)]
WPS: Fix HTTP body length check

Commit 7da4f4b4991c85f1122a4591d8a4b7dd3bd12b4e ('WPS: Check maximum
HTTP body length earlier in the process') added too strict check for
body length allocation. The comparison of new_alloc_nbytes against
h->max_bytes did not take into account that HTTPREAD_BODYBUF_DELTA was
added to previous allocation even if that ended up going beyond
h->max_bytes. This ended up rejecting some valid HTTP operations, e.g.,
when checking AP response to WPS ER setting selected registrar.

Fix this by taking HTTPREAD_BODYBUF_DELTA into account.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Write PKCS#12 extra cert errors into debug log
Jouni Malinen [Mon, 24 Aug 2015 16:36:34 +0000 (19:36 +0300)]
OpenSSL: Write PKCS#12 extra cert errors into debug log

Commit de2a7b796d82d92120aa9532450863f503e1885a ('OpenSSL: Use
connection certificate chain with PKCS#12 extra certs') added a new
mechanism for doing this with OpenSSL 1.0.2 and newer. However, it did
not poinr out anything in debug log if SSL_add1_chain_cert() failed. Add
such a debug print and also silence static analyzer warning on res being
stored without being read (since the error case is ignored at least for
now).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Catch RTNL assertions in the kernel check
Johannes Berg [Fri, 17 Jul 2015 13:19:02 +0000 (15:19 +0200)]
tests: Catch RTNL assertions in the kernel check

Catch RTNL assertions made by ASSERT_RTNL() in the kernel message
checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agotests: EAP-TLS/TTLS/PEAP session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:54:51 +0000 (22:54 +0300)]
tests: EAP-TLS/TTLS/PEAP session resumption

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Enable support for server side TLS session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:08:27 +0000 (22:08 +0300)]
OpenSSL: Enable support for server side TLS session resumption

This allows TLS-based EAP server methods to use session resumption.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-TLS server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:08:02 +0000 (22:08 +0300)]
EAP-TLS server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-TTLS server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:07:47 +0000 (22:07 +0300)]
EAP-TTLS server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake and skipping of Phase 2.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-PEAP server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:06:55 +0000 (22:06 +0300)]
EAP-PEAP server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake and skipping of Phase 2.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Set per-EAP method session context
Jouni Malinen [Sun, 23 Aug 2015 19:05:14 +0000 (22:05 +0300)]
EAP server: Set per-EAP method session context

This can be used to limit TLS session resumption within a TLS library
implementation to apply only for the cases where the same EAP method is
used. While the EAP server method matching will be enforced separately
by EAP server method implementations, this additional steps can optimize
cases by falling back to full authentication instead of having to reject
attempts after having completed session resumption successfully.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add functions for managing cached session state
Jouni Malinen [Sun, 23 Aug 2015 19:01:37 +0000 (22:01 +0300)]
TLS: Add functions for managing cached session state

The new tls_connection_set_success_data(),
tls_connection_set_success_data_resumed(),
tls_connection_get_success_data(), and tls_connection_remove_session()
functions can be used to mark cached sessions valid and to remove
invalid cached sessions. This commit is only adding empty functions. The
actual functionality will be implemented in followup commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Add tls_session_lifetime configuration
Jouni Malinen [Sun, 23 Aug 2015 18:26:39 +0000 (21:26 +0300)]
EAP server: Add tls_session_lifetime configuration

This new hostapd configuration parameter can be used to enable TLS
session resumption. This commit adds the configuration parameter through
the configuration system and RADIUS/EAPOL/EAP server components. The
actual changes to enable session caching will be addressed in followup
commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Disable TLS session ticket with EAP-TLS/TTLS/PEAP
Jouni Malinen [Sun, 23 Aug 2015 18:22:22 +0000 (21:22 +0300)]
EAP server: Disable TLS session ticket with EAP-TLS/TTLS/PEAP

The EAP server is not yet capable of using TLS session ticket to resume
a session. Explicitly disable use of TLS session ticket with
EAP-TLS/TTLS/PEAP to avoid wasting resources on generating a session
ticket that cannot be used for anything.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Allow server connection parameters to be configured
Jouni Malinen [Sun, 23 Aug 2015 18:14:16 +0000 (21:14 +0300)]
OpenSSL: Allow server connection parameters to be configured

This extends OpenSSL version of tls_connection_set_verify() to support
the new flags argument.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add new arguments to tls_connection_set_verify()
Jouni Malinen [Sun, 23 Aug 2015 18:11:01 +0000 (21:11 +0300)]
TLS: Add new arguments to tls_connection_set_verify()

The new flags and session_ctx arguments will be used in followup
commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Add wrapper struct for tls_init() result
Jouni Malinen [Sun, 23 Aug 2015 16:22:13 +0000 (19:22 +0300)]
OpenSSL: Add wrapper struct for tls_init() result

This new struct tls_data is needed to store per-tls_init() information
in the followup commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRemove unnecessary NULL check from LOG_LEVEL handler
Jouni Malinen [Fri, 21 Aug 2015 17:02:10 +0000 (20:02 +0300)]
Remove unnecessary NULL check from LOG_LEVEL handler

cmd cannot be NULL here, so there is no need to check it before calling
os_strlen().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Request fresh scan results after GO Negotiation
Jouni Malinen [Fri, 21 Aug 2015 15:40:23 +0000 (18:40 +0300)]
P2P: Request fresh scan results after GO Negotiation

The P2P group is not yet operating when going through GO Negotiation
exchange. Previously, an old cached scan result could be used to skip
the scan immediately after the GO Negotiation. While this is quite
unlikely to happen in practice, we can easily force a scan here now with
the generic scan_min_time mechanism. Do that to avoid any corner cases
that a previous instance of the group could have if found in cached scan
results.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Require fresh scan results for persistent group re-invocation
Jouni Malinen [Fri, 21 Aug 2015 15:28:28 +0000 (18:28 +0300)]
P2P: Require fresh scan results for persistent group re-invocation

The P2P group is not yet operating when going through invitation
exchange for re-invocation. Previously, an old cached scan result could
be used to skip the scan immediately after the invitation exchange.
While this may result in the fastest possible connection, it does have
some issues with cases where the GO takes some time to start up. It
would also be at least theoretically possible for some of the BSS
parameters to be different, so having a fresh scan result from the new
GO instance may be desired in any case.

Add a mechanism to skip scan results that have been last updated before
a specific point in time and as the first user for this mechanism,
require chan results to be more recent than the invitation message
exchange for the P2P Client role in persistent group re-invocation case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoeapol_test: Add an example controller script for RADIUS testing
Jouni Malinen [Thu, 20 Aug 2015 22:21:18 +0000 (01:21 +0300)]
eapol_test: Add an example controller script for RADIUS testing

This new script can be used as an example of load testing for RADIUS
authentication servers. It can control multiple eapol_test processes
over the control interface to run EAP-TLS authentication. As an example,
the following commands would run eight instances of eapol_test
concurrently:

for i in 0 1 2 3 4 5 6 7; do
    ./eapol_test -T /tmp/eapol_test -i $i > eapol_test.log$i &
done

time ./eapol_test.py --ctrl /tmp/eapol_test --num 8 --iter 100
0: PASS 100
1: PASS 100
2: PASS 100
3: PASS 100
4: PASS 100
5: PASS 100
6: PASS 100
7: PASS 100

real 0m0.339s

time ./eapol_test.py --ctrl /tmp/eapol_test --num 8 --iter 100 --no-fast-reauth
0: PASS 100
1: PASS 100
2: PASS 100
3: PASS 100
4: PASS 100
5: PASS 100
6: PASS 100
7: PASS 100

real 0m1.876s

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoeapol_test: Add a new operation mode for control interface use
Jouni Malinen [Thu, 20 Aug 2015 21:21:20 +0000 (00:21 +0300)]
eapol_test: Add a new operation mode for control interface use

The -T<ctrl_iface> command line argument can now be used to start
eapol_test in mode where the configuration file is not needed and the
authentication operations are started through the control interface.
Network profile is also managed through the control interface in this
case. This can be used to provide more control for scripted RADIUS
authentication server testing.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoeapol_test: Allow interface name to be specified
Jouni Malinen [Thu, 20 Aug 2015 20:13:33 +0000 (23:13 +0300)]
eapol_test: Allow interface name to be specified

The new -i<ifname> command line argument can be used to specify the name
of the interface to use. This is mainly to allow unique control
interface names to be defined without having to use multiple
directories.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: More WPS ER HTTP protocol testing
Jouni Malinen [Tue, 18 Aug 2015 22:36:48 +0000 (01:36 +0300)]
tests: More WPS ER HTTP protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip TLS OCSP stapling test cases with BoringSSL builds
Jouni Malinen [Tue, 18 Aug 2015 17:02:57 +0000 (20:02 +0300)]
tests: Skip TLS OCSP stapling test cases with BoringSSL builds

BoringSSL removed the OpenSSL API used to implement OCSP stapling
support.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow AES-WRAP-192 test cases to be commented out with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:58:13 +0000 (19:58 +0300)]
tests: Allow AES-WRAP-192 test cases to be commented out with BoringSSL

BoringSSL does not support 192-bit AES, so these parts of the
wpa_supplicant module tests would fail.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow group 25 to fail in ap_wpa2_eap_pwd_groups with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:52:38 +0000 (19:52 +0300)]
tests: Allow group 25 to fail in ap_wpa2_eap_pwd_groups with BoringSSL

It looks like NID_X9_62_prime192v1 is not available, so allow that group
to fail without failing the full ap_wpa2_eap_pwd_groups test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Use group 26 instead of 25 in sae_oom_wpas with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:46:56 +0000 (19:46 +0300)]
tests: Use group 26 instead of 25 in sae_oom_wpas with BoringSSL

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow group 25 to fail in sae_groups if running with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:43:23 +0000 (19:43 +0300)]
tests: Allow group 25 to fail in sae_groups if running with BoringSSL

It looks like NID_X9_62_prime192v1 is not available, so allow that group
to fail without failing the full sae_groups test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoOpenSSL: Reject OCSP-required configuration if no OCSP support
Jouni Malinen [Mon, 17 Aug 2015 23:24:06 +0000 (02:24 +0300)]
OpenSSL: Reject OCSP-required configuration if no OCSP support

This is needed at least with BoringSSL to avoid accepting OCSP-required
configuration with a TLS library that does not support OCSP stapling.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Fix PKCS12_parse() segfault when used without password
Jouni Malinen [Mon, 17 Aug 2015 23:06:02 +0000 (02:06 +0300)]
BoringSSL: Fix PKCS12_parse() segfault when used without password

Unlike OpenSSL PKCS12_parse(), the BoringSSL version seems to require
the password pointer to be non-NULL even if no password is present. Map
passwrd == NULL to passwd = "" to avoid a NULL pointer dereference
within BoringSSL.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoOpenSSL: Handshake completion and resumption state into debug log
Jouni Malinen [Mon, 17 Aug 2015 22:53:17 +0000 (01:53 +0300)]
OpenSSL: Handshake completion and resumption state into debug log

This new debug log entry makes it more convenient to check how TLS
handshake was completed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Fix session resumption
Jouni Malinen [Mon, 17 Aug 2015 19:50:41 +0000 (22:50 +0300)]
BoringSSL: Fix session resumption

BoringSSL commit 533ef7304d9b48aad38805f1997031a0a034d7fe ('Remove
SSL_clear calls in handshake functions.') triggered a regression for
EAP-TLS/TTLS/PEAP session resumption in wpa_supplicant due to the
removed SSL_clear() call in ssl3_connect() going away and wpa_supplicant
not calling SSL_clear() after SSL_shutdown(). Fix this by adding the
SSL_clear() call into wpa_supplicant after SSL_shutdown() when preparing
the ssl instance for another connection.

While OpenSSL is still call SSL_clear() in ssl3_connect(), it looks to
be safe to add this call to wpa_supplicant unconditionally.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Make SSL_set_ssl_method() conditional on EAP-FAST
Jouni Malinen [Mon, 17 Aug 2015 18:35:44 +0000 (21:35 +0300)]
BoringSSL: Make SSL_set_ssl_method() conditional on EAP-FAST

This function does not seem to be available in BoringSSL. Since it is
needed for EAP-FAST (which is not currently working with BoringSSL),
address this by commenting out the EAP-FAST specific step from builds
that do not include EAP-FAST support.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Comment out SSL_build_cert_chain() call
Jouni Malinen [Mon, 17 Aug 2015 18:34:11 +0000 (21:34 +0300)]
BoringSSL: Comment out SSL_build_cert_chain() call

It looks like BoringSSL does include that function even though it claims
support for OPENSSL_VERSION_NUMBER where this is available (1.0.2). For
now, comment out that call to fix build.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Allow internal AES key wrap to be used with "OpenSSL" build
Jouni Malinen [Mon, 17 Aug 2015 18:31:17 +0000 (21:31 +0300)]
BoringSSL: Allow internal AES key wrap to be used with "OpenSSL" build

It looks like BoringSSL has removed the AES_wrap_key(), AES_unwrap_key()
API. This broke wpa_supplicant/hostapd build since those functions from
OpenSSL were used to replace the internal AES key wrap implementation.
Add a new build configuration option
(CONFIG_OPENSSL_INTERNAL_AES_WRAP=y) to allow the internal
implementation to be used with CONFIG_OPENSSL=y build to allow build
against the latest BoringSSL version.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WPS ER protocol testing
Jouni Malinen [Sat, 15 Aug 2015 19:41:13 +0000 (22:41 +0300)]
tests: WPS ER protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoSet NORMAL_SCAN_REQ on SELECT_NETWORK/ENABLE_NETWORK
Jouni Malinen [Sun, 16 Aug 2015 21:16:46 +0000 (00:16 +0300)]
Set NORMAL_SCAN_REQ on SELECT_NETWORK/ENABLE_NETWORK

wpa_s->scan_req needs to be set in these cases to get correct scanning
behavior. This is mainly needed for starting of AP mode operation
immediately in ap_scan=2 case.

This fixes an issue that was found with mac80211_hwsim test cases in the
following sequence: dbus_autoscan dbus_ap_scan_2_ap_mode_scan

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Trigger failure on exceptions in the dbus_p2p_autogo thread
Jouni Malinen [Sun, 16 Aug 2015 20:55:14 +0000 (23:55 +0300)]
tests: Trigger failure on exceptions in the dbus_p2p_autogo thread

This makes the test case more robust in reporting failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRemove duplicated sta_authorized_cb call
Jouni Malinen [Sun, 16 Aug 2015 20:51:07 +0000 (23:51 +0300)]
Remove duplicated sta_authorized_cb call

Commit 6959145b86318710d0186b618d54bce2991a6e6f ('FST: Integration into
hostapd') introduced this duplicated call due to an incorrect merge
conflict resolution in ap_sta_set_authorized(). An earlier commit
61fc90483fec17b69a26b16e42723474daccec24 ('P2P: Handle improper WPS
termination on GO during group formation') had moved this call to an
earlier location in the function and there is no point in re-introducing
another copy of the call at the end of the function.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS and non-WPS AP in single hostapd process
Jouni Malinen [Sun, 16 Aug 2015 19:41:21 +0000 (22:41 +0300)]
tests: WPS and non-WPS AP in single hostapd process

This is a regression test case for WPS_AP_PIN triggered hostapd segfault
when a non-WPS interface was enabled.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Fix multi-interface WPS operations in hostapd
Jouni Malinen [Sun, 16 Aug 2015 19:38:31 +0000 (22:38 +0300)]
WPS: Fix multi-interface WPS operations in hostapd

Couple of the for-each-interface loops used incorrect return value when
skipping over non-WPS interfaces. This could result in skipping some WPS
interfaces in the loop and returning error. Setting AP PIN did not check
for WPS being enabled at all and trigger a NULL pointer dereference if
non-WPS interface was enabled.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix FST tests to remove hostapd instance
Jouni Malinen [Sun, 16 Aug 2015 19:30:54 +0000 (22:30 +0300)]
tests: Fix FST tests to remove hostapd instance

These test cases added a new radio for the non-FST AP and while they
removed the radio itself, they did not remove the hostapd instance for
that radio. Remove that to avoid leaving behind invalid instances.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix WPS HTTP test case exceptions
Jouni Malinen [Sun, 16 Aug 2015 18:25:35 +0000 (21:25 +0300)]
tests: Fix WPS HTTP test case exceptions

resp.status is an integer, not a string.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS ER: Fix SSDP CACHE-CONTROL line parser
Jouni Malinen [Sat, 15 Aug 2015 19:24:15 +0000 (22:24 +0300)]
WPS ER: Fix SSDP CACHE-CONTROL line parser

Incorrect number of bytes was skipped from the beginning of the line
which resulted in the loop skipping spaces doing nothing. However, the
following operation was simply looking for the max-age parameter with
os_strstr(), so this did not have any effect on functionality. Fix the
number of bytes to skip and remove the unneeded loop to skip spaces.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: P2P group formation response during p2p_find
Jouni Malinen [Fri, 14 Aug 2015 21:15:57 +0000 (00:15 +0300)]
tests: P2P group formation response during p2p_find

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoP2PS: Consider WPS P2PS method when joining a group
Andrei Otcheretianski [Mon, 13 Jul 2015 06:49:16 +0000 (09:49 +0300)]
P2PS: Consider WPS P2PS method when joining a group

If P2PS PD concludes to use default P2PS method wpas_p2p_scan_res_join()
ignores this value and tries to perform a redundant legacy PD.
Fix this by considering WPS_P2PS method too.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agosystemd: Order wpa_supplicant before network.target
Mike Gilbert [Wed, 12 Aug 2015 14:44:42 +0000 (10:44 -0400)]
systemd: Order wpa_supplicant before network.target

Ordering the units before network.target causes them to be stopped
after network.target on shutdown. This ensures that any network
filesystems will be unmounted before wpa_supplicant is killed.

Adding Wants=network.target ensures that network.target will be included
in the active dependency graph. This is typical of units which are
involved in networking setup functions.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
8 years agotests: Control interface output buffer limit
Jouni Malinen [Fri, 14 Aug 2015 16:24:15 +0000 (19:24 +0300)]
tests: Control interface output buffer limit

This verifies wpa_supplicant behavior in number of cases where the
external program opening a control interface socket does not behave
properly.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd debug prints for wpa_supplicant ctrl_iface socket send operations
Jouni Malinen [Fri, 14 Aug 2015 16:22:08 +0000 (19:22 +0300)]
Add debug prints for wpa_supplicant ctrl_iface socket send operations

This makes it easier to track the output queue state on a control
interface socket and determine what could be causing issues with running
out of space in the buffer.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAndroid: Use more flexible userid when launching browser popup
Kanchanapally, Vidyullatha [Thu, 13 Aug 2015 07:34:25 +0000 (13:04 +0530)]
Android: Use more flexible userid when launching browser popup

It was possible for the Hotspot 2.0 case of OSU user interaction to fail
with wpadebug browser due to permission denial in the "start" command
("java.lang.SecurityException: Permission Denial: startActivity asks to
run as user -2 but is calling from user 0; this requires
android.permission.INTERACT_ACROSS_USERS_FULL"). Avoid this by using
more flexible USER_CURRENT_OR_SELF (-3) value with the --user argument.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDo not stop ongoing PNO sched_scan on association/disconnection
Mahesh A Saptasagar [Tue, 30 Jun 2015 07:11:27 +0000 (12:41 +0530)]
Do not stop ongoing PNO sched_scan on association/disconnection

PNO was stopped by the wpa_supplicant during the connection attempts or
while handling disassociation indication. External entities, mainly, the
Android Wi-Fi framework, does not expects PNO to be stopped by other
modules. Hence, do not stop the sched_scan in these scenarios if it is
triggered externally for PNO.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Scan and TSF updates from Beacon/Probe Response frames
Jouni Malinen [Thu, 13 Aug 2015 17:57:23 +0000 (20:57 +0300)]
tests: Scan and TSF updates from Beacon/Probe Response frames

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Use beacon TSF if it is newer than Probe Response TSF
Srinivas Dasari [Wed, 12 Aug 2015 10:24:54 +0000 (15:54 +0530)]
nl80211: Use beacon TSF if it is newer than Probe Response TSF

cfg80211 sends TSF information with the attribute NL80211_BSS_BEACON_TSF
if the scan results include information from Beacon frame. Probe
Response frame information is included in NL80211_BSS_TSF. If the device
receives only Beacon frames, NL80211_BSS_TSF might not carry updated
TSF, which results an older TSF being used in wpa_supplicant. Fetch both
possible TSF values (if available) and choose the latest TSF for the BSS
entry.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: ap_scan=2 AP mode operation and scan failure
Jouni Malinen [Tue, 11 Aug 2015 18:48:55 +0000 (21:48 +0300)]
tests: ap_scan=2 AP mode operation and scan failure

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoDo not allow ap_scan=2 scan processing to stop AP mode operation
Jouni Malinen [Tue, 11 Aug 2015 18:46:38 +0000 (21:46 +0300)]
Do not allow ap_scan=2 scan processing to stop AP mode operation

wpa_supplicant_assoc_try() would result in the currently operating AP to
get stopped if wpa_supplicant_scan() ends up getting triggered without
MANUAL_SCAN_REQ while operating an AP. With ap_scan=2, this could
resulted in unintentional stopping of AP mode operations, so check
explicitly for that case and skip the wpa_supplicant_assoc_try() call if
needed to avoid this.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoD-Bus: Set last_scan_req to MANUAL_SCAN_REQ on Scan() trigger paths
Jouni Malinen [Tue, 11 Aug 2015 18:44:31 +0000 (21:44 +0300)]
D-Bus: Set last_scan_req to MANUAL_SCAN_REQ on Scan() trigger paths

The D-Bus Scan() handler was setting wpa_s->scan_req = MANUAL_SCAN_REQ
on the code path that used wpa_supplicant_req_scan(). However, it did
not do anything similar for the cases where
wpa_supplicant_trigger_scan() is called directly. This could result in
unexpected wpa_s->last_scan_req value and incorrect behavior especially
when using ap_scan=2 and running a scan while operating in AP mode. Fix
this by explicitly setting wpa_s->last_scan_req = MANUAL_SCAN_REQ when
using wpa_supplicant_trigger_scan() from the Scan() handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoP2P: Support driver preferred freq list for invitation case
Ahmad Kholaif [Tue, 11 Aug 2015 01:09:27 +0000 (18:09 -0700)]
P2P: Support driver preferred freq list for invitation case

When using P2P invitation to re-invoke a persistent P2P group without
specifying the operating channel, query the driver for the preferred
frequency list, and use it to select the operating channel of the group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoOpenSSL: Use connection certificate chain with PKCS#12 extra certs
Jouni Malinen [Mon, 10 Aug 2015 22:02:27 +0000 (01:02 +0300)]
OpenSSL: Use connection certificate chain with PKCS#12 extra certs

When using OpenSSL 1.0.2 or newer, this replaces the older
SSL_CTX_add_extra_chain_cert() design with SSL_add1_chain_cert() to keep
the extra chain certificates out from SSL_CTX and specific to each
connection. In addition, build and rearrange extra certificates with
SSL_build_cert_chain() to avoid incorrect certificates and incorrect
order of certificates in the TLS handshake.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Fix PKCS#12 extra certificate handling
Jouni Malinen [Mon, 10 Aug 2015 21:40:27 +0000 (00:40 +0300)]
OpenSSL: Fix PKCS#12 extra certificate handling

Previously, the possible extra certificate(s) from a PKCS#12 file was
added once for each authentication attempt. This resulted in OpenSSL
concatenating the certificates multiple time (add one copy for each try
during the wpa_supplicant process lifetime). Fix this by clearing the
extra chain certificates before adding new ones when using OpenSSL 1.0.1
or newer that include the needed function.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Try users2.pkcs12 twice to add coverage
Jouni Malinen [Mon, 10 Aug 2015 21:38:44 +0000 (00:38 +0300)]
tests: Try users2.pkcs12 twice to add coverage

This allows manual verification of extra PKCS#12 certificate processing.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: AP with open mode and wpa_supplicant ENABLE/DISABLE_NETWORK
Jouni Malinen [Mon, 10 Aug 2015 19:08:08 +0000 (22:08 +0300)]
tests: AP with open mode and wpa_supplicant ENABLE/DISABLE_NETWORK

ap_open_sta_enable_disable verifies that DISABLE_NETWORK that is issued
while connect/sme-connect radio work is pending is effective, i.e.,
prevents connection to disabled network.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDrop connection attempt if network is disabled before radio work starts
Hu Wang [Mon, 10 Aug 2015 19:12:59 +0000 (22:12 +0300)]
Drop connection attempt if network is disabled before radio work starts

With the radio work design, it is possible for a network entry to get
disabled (e.g., DISABLE_NETWORK <id>) during the time the connect or
sme-connect radio work waits to start. Previously, only the validity of
the BSS entry and BSSID/SSID was verified when starting the actual
connection step. Add call to wpas_network_disabled() to those checks to
catch the case where the network profile is disabled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Support driver preferred freq list for Autonomous GO case
Ahmad Kholaif [Mon, 10 Aug 2015 00:44:12 +0000 (17:44 -0700)]
P2P: Support driver preferred freq list for Autonomous GO case

When starting an autonomous GO without specifying the operating channel,
query the driver for the preferred frequency list, and use it to select
the operating channel of the GO (if supported).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Properly pass the num of channels to start.sh
Ilan Peer [Sun, 9 Aug 2015 13:00:41 +0000 (16:00 +0300)]
tests: Properly pass the num of channels to start.sh

The number of channels was not properly passed from the
run-all.sh script to the start.sh script. Fix it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Various wpa_supplicant ctrl_iface OOM cases
Jouni Malinen [Sat, 8 Aug 2015 17:48:30 +0000 (20:48 +0300)]
tests: Various wpa_supplicant ctrl_iface OOM cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFix a typo in enum wpa_states comment
Amit Khatri [Thu, 6 Aug 2015 07:04:51 +0000 (07:04 +0000)]
Fix a typo in enum wpa_states comment

Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
Signed-off-by: Rahul Jain <rahul.jain@samsung.com>
8 years agotests: Verify FAIL-BUSY return on SCAN during gas_comeback_delay
Jouni Malinen [Sat, 8 Aug 2015 17:51:25 +0000 (20:51 +0300)]
tests: Verify FAIL-BUSY return on SCAN during gas_comeback_delay

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: RSN element protocol testing for STA side
Jouni Malinen [Sat, 8 Aug 2015 15:20:29 +0000 (18:20 +0300)]
tests: RSN element protocol testing for STA side

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFix PMKID addition to RSN element when RSN Capabilities are not present
Jouni Malinen [Sat, 8 Aug 2015 16:19:57 +0000 (19:19 +0300)]
Fix PMKID addition to RSN element when RSN Capabilities are not present

This code path could not be hit with the RSNE generated by hostapd or
wpa_supplicant, but it is now possible to reach when using
own_ie_override test functionality. The RSNE and IE buffer length were
not updated correct in case wpa_insert_pmkid() had to add the RSN
Capabilities field.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agohostapd: Add testing option to override own WPA/RSN IE(s)
Jouni Malinen [Sat, 8 Aug 2015 15:18:03 +0000 (18:18 +0300)]
hostapd: Add testing option to override own WPA/RSN IE(s)

This allows the new own_ie_override=<hexdump> configuration parameter to
be used to replace the normally generated WPA/RSN IE(s) for testing
purposes in CONFIG_TESTING_OPTIONS=y builds.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFT: Remove optional fields from RSNE when using PMF
Jouni Malinen [Thu, 6 Aug 2015 13:41:38 +0000 (16:41 +0300)]
FT: Remove optional fields from RSNE when using PMF

The PMKIDCount, PMKID List, and Group Management Cipher Suite fields are
optional to include in the RSNE in cases where these would not have
values that are different from the default values. In practice,
PMKIDCount is always 0 in Beacon and Probe Response frames, so the only
field of these that could have a non-default value is Group Management
Cipher Suite. When BIP is used, that field is not needed either due to
BIP being the default cipher when PMF is enabled.

Remove these fields from RSNE when BIP is used to save six octets in
Beacon and Probe Response frames. In addition to reduced frame length,
this is a workaround for interoperability issues with iOS 8.4 in cases
where FT and PMF are enabled. iOS seems to be rejecting EAPOL-Key msg
3/4 during FT initial mobility domain association if the RSNE includes
the PMKIDCount field.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agowlantest: Add support for FT-PSK initial association key derivation
Jouni Malinen [Thu, 6 Aug 2015 12:51:36 +0000 (15:51 +0300)]
wlantest: Add support for FT-PSK initial association key derivation

This adds minimal support for deriving keys for FT-PSK to allow the
initial mobility domain association to be analyzed in more detail.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: AP config using wps_config command with invalid passphrase
Jouni Malinen [Wed, 5 Aug 2015 21:02:47 +0000 (00:02 +0300)]
tests: AP config using wps_config command with invalid passphrase

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWPS: Reject AP settings with invalid network key (PSK/passphrase)
Jouni Malinen [Wed, 5 Aug 2015 20:52:10 +0000 (23:52 +0300)]
WPS: Reject AP settings with invalid network key (PSK/passphrase)

This is similar to the earlier commit
b363121a208e3d18fe80682430a5f50cefaa3595 ('WPS: Reject invalid
credential more cleanly'), but for the AP cases where AP settings are
being replaced. Previously, the new settings were taken into use even if
the invalid PSK/passphrase had to be removed. Now, the settings are
rejected with such an invalid configuration.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2PS with group interface and intended iface addr in PD
Jouni Malinen [Thu, 6 Aug 2015 16:54:12 +0000 (19:54 +0300)]
tests: P2PS with group interface and intended iface addr in PD

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Add P2PS PD feature capability CPT tests
Max Stepanov [Thu, 30 Jul 2015 06:00:01 +0000 (09:00 +0300)]
tests: Add P2PS PD feature capability CPT tests

Add tests verifying a Coordination Protocol Transport exchange and
selection during P2PS provision discovery.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Re-factor PD and connection flows in P2PS tests
Andrei Otcheretianski [Wed, 8 Jul 2015 12:55:27 +0000 (15:55 +0300)]
tests: Re-factor PD and connection flows in P2PS tests

Reuse p2ps_provision() and p2ps_connect_pd() methods, and
remove the previous PD helper functions which are no longer used.

This fixes the previously "broken"
p2ps_connect_keypad_method_nonautoaccept and
p2ps_connect_display_method_nonautoaccept.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Use p2ps_provision() and p2ps_connect_pd() in p2ps_connect_p2ps_method()
Andrei Otcheretianski [Thu, 30 Jul 2015 06:00:02 +0000 (09:00 +0300)]
tests: Use p2ps_provision() and p2ps_connect_pd() in p2ps_connect_p2ps_method()

Re-factor p2ps_connect_p2ps_method() so it reuses generic P2PS provision
and connection flows.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2PS: Authorize any peer for P2PS method if interface address not known
Andrei Otcheretianski [Thu, 30 Jul 2015 06:00:06 +0000 (09:00 +0300)]
P2PS: Authorize any peer for P2PS method if interface address not known

When P2PS PD with default P2PS method is done, the peer that becomes GO
should authorize the client. However, P2PS specification doesn't require
the client to include its intended interface address in PD
Request/Response. As a result, the P2P Client's interface address may not
be known and any address may need to be authorized.

Previously, client's P2P Device Address was used for authorization,
which is not correct when a dedicated interface is used for P2P Client.
This is not resulting in a connection failure, however it causes a
significant delay (until WPS_PIN_TIME_IGNORE_SEL_REG elapses). Fix this
by authorizing the intended interface address, if known; or any address,
if not known.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
8 years agoP2PS: Clean up intended interface address passing to p2ps_prov_complete
Jouni Malinen [Thu, 6 Aug 2015 17:43:25 +0000 (20:43 +0300)]
P2PS: Clean up intended interface address passing to p2ps_prov_complete

Use NULL to indicate if the address is not available instead of fixed
00:00:00:00:00:00. wpas_p2ps_prov_complete() already had code for
converting NULL to that all zeros address for event messages.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2PS: Fix PD PIN event notifications
Max Stepanov [Thu, 30 Jul 2015 06:00:00 +0000 (09:00 +0300)]
P2PS: Fix PD PIN event notifications

Change P2PS P2P-PROV-SHOW-PIN/P2P-PROV-ENTER-PIN event notifications
on PD Request/Response handling to meet required P2PS behavior.

The new implemented scheme:
1. For a legacy P2P provision discovery the event behavior remains
   without changes
2. P2PS PD, advertiser method: DISPLAY, autoaccept: TRUE:
   Advertiser: SHOW-PIN on PD request replied with a status SUCCESS
   Seeker: ENTER-PIN on PD response received with a status SUCCESS
3. P2PS PD, advertiser method: DISPLAY, autoaccept: FALSE:
   Advertiser: SHOW-PIN on PD request replied with a status
     INFO_CURRENTLY_UNAVAILABLE
   Seeker: ENTER-PIN on Follow-on PD request with a status
     SUCCESS_DEFERRED
4. P2PS PD, advertiser method: KEYPAD, autoaccept: TRUE/FALSE:
   Advertiser: ENTER-PIN on PD request replied with a status
     INFO_CURRENTLY_UNAVAILABLE
   Seeker: SHOW-PIN on PD response received with a status
     INFO_CURRENTLY_UNAVAILABLE

This change in behavior breaks the existing test cases
p2ps_connect_keypad_method_nonautoaccept and
p2ps_connect_display_method_nonautoaccept. Those will be fixed in a
followup commit.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Add P2P GO frequency change policy tests
Ilan Peer [Mon, 27 Jul 2015 19:24:34 +0000 (22:24 +0300)]
tests: Add P2P GO frequency change policy tests

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Increase timeouts when MCC is enabled
Ilan Peer [Mon, 27 Jul 2015 19:24:33 +0000 (22:24 +0300)]
tests: Increase timeouts when MCC is enabled

When MCC is enabled, the remain of channel scheduling might
incur additional delays, so increase the timeouts to be able
to receive delays frames.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agotests: Skip some test cases when MCC is enabled
Ilan Peer [Mon, 27 Jul 2015 19:24:32 +0000 (22:24 +0300)]
tests: Skip some test cases when MCC is enabled

Some tests assume that only a single channel is used. Skip,
such tests/checks when MCC is enabled.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Fix P2P_FLUSH clearing of p2p_go_avoid_freq
Ilan Peer [Mon, 27 Jul 2015 19:24:30 +0000 (22:24 +0300)]
P2P: Fix P2P_FLUSH clearing of p2p_go_avoid_freq

P2P_FLUSH command did not cleanly clear the p2p_go_avoid_freq data
structure, and left it in an inconsistent state, where the range field
was NULL but the num field was not 0. This would have resulted in an
invalid memory access in freq_range_list_includes().

Fix this.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Do not perform P2P GO CS in some cases
Ilan Peer [Mon, 27 Jul 2015 19:24:27 +0000 (22:24 +0300)]
P2P: Do not perform P2P GO CS in some cases

A P2P GO channel switch should not be triggered in all cases that
require channel list update. Specifically, a P2P GO CS should not
be triggered in case that the P2P GO state changed or in case that
that the P2P GO has just completed a CS.

To fix this, add reason code to wpas_p2p_channel_list_update() and
trigger CS flow only for the relevant cases.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Disallow GO CS immediately after GO Negotiation or invitation
Ilan Peer [Mon, 27 Jul 2015 19:24:26 +0000 (22:24 +0300)]
P2P: Disallow GO CS immediately after GO Negotiation or invitation

A newly created GO might move to another channel before the client was
able to connect to it. This creates a situation where the client
searches the GO on the channel agreed upon during GO Negotiation or
invitation signaling, while the GO is on another channel. This in turn
might lead to delayed connection or connection failure and group
removal.

Fix this by disallowing a GO CS as long as there is some activity that
should delay the switch. If a GO move is not allowed, set a timeout to
re-attempt the move.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Consider channel optimizations for additional cases
Ilan Peer [Mon, 27 Jul 2015 19:24:25 +0000 (22:24 +0300)]
P2P: Consider channel optimizations for additional cases

Re-factor the code, so channel optimizations would be also triggered
upon the following changes: channel updates from the kernel,
disallow_freq interface, etc.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoRefactor channel list update event in wpa_supplicant
Arik Nemtsov [Mon, 27 Jul 2015 19:24:24 +0000 (22:24 +0300)]
Refactor channel list update event in wpa_supplicant

Update hardware features for all interfaces inside the loop, don't treat
the calling wpa_s instance specially. Perform the P2P channel list
updates after the hardware features are updated. This will prevent P2P
from relying on stale information.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
8 years agoP2P: Modify wpas_p2p_init_go_params()
Ilan Peer [Mon, 27 Jul 2015 19:24:23 +0000 (22:24 +0300)]
P2P: Modify wpas_p2p_init_go_params()

Not all paths in wpas_p2p_init_go_params() verified that the candidate
frequency can be used for GO purposes. Fix this, and in addition
re-factor the code to put better emphasis on the frequency selection
priorities.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Remove GO handling in avoid frequency event
Ilan Peer [Mon, 27 Jul 2015 19:24:22 +0000 (22:24 +0300)]
P2P: Remove GO handling in avoid frequency event

Remove the code that considers removing GOs from their current
channel due to frequency interference, as this is already handled
as part of the P2P channels update.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Move a GO to a frequency that is also supported by the client
Ilan Peer [Mon, 27 Jul 2015 19:24:21 +0000 (22:24 +0300)]
P2P: Move a GO to a frequency that is also supported by the client

A P2P GO interface that was instantiated after a GO Negotiation or
Invitation holds the intersection of frequencies between the GO and the
client. In case the GO is going to move to another frequency, allow it
to move only to a frequency that is also supported by the client.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Add a function to compute the group common freqs
Ilan Peer [Mon, 27 Jul 2015 19:24:20 +0000 (22:24 +0300)]
P2P: Add a function to compute the group common freqs

Add a function to compute the group common frequencies, and
use it to update the group_common_frequencies as part of the
channel switch flows.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoP2P: Move a GO from its operating frequency
Ilan Peer [Mon, 27 Jul 2015 19:24:19 +0000 (22:24 +0300)]
P2P: Move a GO from its operating frequency

Upon any change in the currently used channels evaluate if a GO should
move to a different operating frequency, where the possible scenarios:

1. The frequency that the GO is currently using is no longer valid,
   due to regulatory reasons, and thus the GO must be moved to some
   other frequency.
2. Due to Multi Concurrent Channel (MCC) policy considerations, it would
   be preferable, based on configuration settings, to prefer Same
   Channel Mode (SCM) over concurrent operation in multiple channels.
   The supported policies:

   - prefer SCM: prefer moving the GO to a frequency used by some other
     interface.
   - prefer SCM if Peer supports: prefer moving the GO to a frequency
     used by some other station interface iff the other station
     interface is using a frequency that is common between the local and
     the peer device (based on the GO Negotiation/Invitation signaling).
   - Stay on the current frequency.

Currently, the GO transition to another frequency is handled by a
complete tear down and re-setup of the GO. Still need to add CSA flow to
the considerations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
8 years agoShare freq-to-channel conversion function
Andrei Otcheretianski [Mon, 27 Jul 2015 19:24:18 +0000 (22:24 +0300)]
Share freq-to-channel conversion function

Add ieee80211_freq_to_channel_ext() conversion function into
ieee802_11_common.c. This function converts freq to channel and
additionally computes operating class, based on provided HT and VHT
parameters.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
8 years agotests: Make dbus_p2p_group_termination_by_go more robust
Jouni Malinen [Mon, 3 Aug 2015 15:52:10 +0000 (18:52 +0300)]
tests: Make dbus_p2p_group_termination_by_go more robust

Set peer_group_removed only if peer_group_added has already been set.
This fixes an issue where a propertiesChanged event triggered by an
earlier test case was able to get dbus_p2p_group_termination_by_go
terminated too early. This happened, e.g., with sequence
"dbus_p2p_two_groups dbus_p2p_group_termination_by_go".

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Avoid exception in dbus_p2p_two_groups
Jouni Malinen [Mon, 3 Aug 2015 15:35:35 +0000 (18:35 +0300)]
tests: Avoid exception in dbus_p2p_two_groups

Only run peerJoined() steps once to avoid trying to use GetAll() on an
already removed group and double-removal of a group. This did not make
the test case fail, but the exception is printed out in pretty confusing
way to stdout, so better get rid of it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>