mech_eap.git
9 years agotests: Use group control interface in autogo
Ilan Peer [Fri, 6 Feb 2015 01:30:57 +0000 (20:30 -0500)]
tests: Use group control interface in autogo

P2P-PRESENCE-RESPONSE is a group event, and thus need
to use the group control interface.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use global control interface in wpas_ctrl_global
Ilan Peer [Fri, 6 Feb 2015 01:30:56 +0000 (20:30 -0500)]
tests: Use global control interface in wpas_ctrl_global

Use the global control interface to set/get the status of the
P2P Device.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Remove unnecessary use of sudo from test cases
Jouni Malinen [Fri, 6 Feb 2015 22:22:32 +0000 (00:22 +0200)]
tests: Remove unnecessary use of sudo from test cases

run-tests.py is running as root, so sudo does not need to be used
anymore from within each test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Replace subprocess.call for rm with os.remove()
Jouni Malinen [Fri, 6 Feb 2015 22:15:01 +0000 (00:15 +0200)]
tests: Replace subprocess.call for rm with os.remove()

There is no need to use sudo and external rm to remove files now that
run-tests.py is required to run as root.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Fix wpas_config_file after implementation change
Jouni Malinen [Fri, 6 Feb 2015 22:10:04 +0000 (00:10 +0200)]
tests: Fix wpas_config_file after implementation change

The new wpa_supplicant configuration writing design (rename instead of
write to original file) did not fail with the symlink-to-self case, so
replace this with the config file being replaced with a directory. In
addition, get rid of unnecessary use of subprocess since run-tests.py is
running as root nowadays.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoDon't write to wpa_supplicant.conf directly
Vinit Deshpande [Thu, 5 Feb 2015 20:48:02 +0000 (12:48 -0800)]
Don't write to wpa_supplicant.conf directly

There is a chance that wpa_supplicant may get killed during
the time it is writing config file. If this happens, user
information like SSIDs and passwords can be lost forever.

This change works around that by writing config to a
temporary file and then renaming the file to the correct name.

Signed-off-by: Vinit Deshpande <vinitd@google.com>
9 years agotests: IBSS with WEP and TKIP
Jouni Malinen [Fri, 6 Feb 2015 19:43:50 +0000 (21:43 +0200)]
tests: IBSS with WEP and TKIP

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoIBSS: Do not enable HT with WEP or TKIP
Janusz Dziedzic [Fri, 6 Feb 2015 12:11:24 +0000 (13:11 +0100)]
IBSS: Do not enable HT with WEP or TKIP

We should not enable HT if WEP or TKIP is configured.
Without the patch and WEP configuration we will get message:
Association request to the driver failed

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoACS: Accept channel if any (rather than all) survey results are valid
Jouni Malinen [Fri, 6 Feb 2015 16:36:13 +0000 (18:36 +0200)]
ACS: Accept channel if any (rather than all) survey results are valid

Previously, a channel with even a single scan/survey result missing
information was skipped in ACS. This may not be desirable in cases when
multiple scan iterations are used (which is the case by default in
hostapd). Instead, use all channels that provided at least one complete
set of results. Calculate the average interference factor as an average
of the iterations that did provide complete values.

This seems to help with some cases, e.g., when ath9k may not be able to
report the noise floor for all channels from the first scan iteration
immediately after the driver has been loaded, but then returns it for
all other scan iterations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: ACS with acs_chan_bias parameter
Jouni Malinen [Fri, 6 Feb 2015 16:02:33 +0000 (18:02 +0200)]
tests: ACS with acs_chan_bias parameter

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoACS: Allow specific channels to be preferred
Jouni Malinen [Fri, 6 Feb 2015 15:59:57 +0000 (17:59 +0200)]
ACS: Allow specific channels to be preferred

The new acs_chan_bias configuration parameter is a space-separated list
of <channel>:<bias> pairs. It can be used to increase (or decrease) the
likelihood of a specific channel to be selected by the ACS algorithm.
The total interference factor for each channel gets multiplied by the
specified bias value before finding the channel with the lowest value.
In other words, values between 0.0 and 1.0 can be used to make a channel
more likely to be picked while values larger than 1.0 make the specified
channel less likely to be picked. This can be used, e.g., to prefer the
commonly used 2.4 GHz band channels 1, 6, and 11 (which is the default
behavior on 2.4 GHz band if no acs_chan_bias parameter is specified).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoACS: Use weighted average for 2.4 GHz adjacent channel interference
Jouni Malinen [Thu, 5 Feb 2015 15:57:06 +0000 (17:57 +0200)]
ACS: Use weighted average for 2.4 GHz adjacent channel interference

The interference factors for adjacent 2.4 GHz channels were summed
together without doing any kind of weighted average on them. This
resulted in the channels at the band edges getting undue preference due
to only including interference factors from three channels vs. five for
the channels in the middle of the band.

While it is somewhat unclear whether the design here was supposed to
count overlapping channels together in this way or whether that is
already covered in channel survey results, it is clear that this summing
of three to five values together and then comparing the sum rather than
average of some kind gives too much preference to the channels at the
edges of the band by assuming that there is no interference whatsoever
outside the band.

Use weighted average of the interference factors rather than a sum from
different number of values. For now, the adjacent 2.4 GHz channels get
weight of 0.85 (1.0 for the main channel itself) and the neighboring
channels to those adjacent ones get 0.55 weight. Band-edge channels are
handled in a way that takes average over the channels that were actually
considered instead of assuming zero interference from neighboring bands.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Use global control interface in test_p2p_concurrency
Ilan Peer [Wed, 4 Feb 2015 09:30:36 +0000 (04:30 -0500)]
tests: Use global control interface in test_p2p_concurrency

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use global control interface in test_p2p_service
Ilan Peer [Wed, 4 Feb 2015 09:30:35 +0000 (04:30 -0500)]
tests: Use global control interface in test_p2p_service

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Modify test_p2p_discovery to use global control interface
Ilan Peer [Wed, 4 Feb 2015 09:30:34 +0000 (04:30 -0500)]
tests: Modify test_p2p_discovery to use global control interface

1. Modify discovery_stop to use global control interface when calling
   P2P_FLUSH.
2. Modify p2p_listen_and_offchannel_tx to use the global control
   interface when waiting for P2P PD event.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Add printk tracer to trace-cmd
Eliad Peller [Wed, 4 Feb 2015 09:30:33 +0000 (04:30 -0500)]
tests: Add printk tracer to trace-cmd

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agotests: Modify tests in test_ap_pmf to use own_addr()
Ben [Wed, 4 Feb 2015 09:30:32 +0000 (04:30 -0500)]
tests: Modify tests in test_ap_pmf to use own_addr()

Some of the tests used p2p_dev_addr() that can be different from
own_addr() if a dedicated P2P Device interface is used.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
9 years agotests: Modify tests in test_hapd_ctrl to use own_addr()
Ben [Wed, 4 Feb 2015 09:30:31 +0000 (04:30 -0500)]
tests: Modify tests in test_hapd_ctrl to use own_addr()

Some of the tests used p2p_dev_addr() that can be different from
own_addr() if a dedicated P2P Device interface is used.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
9 years agotests: Fix ap_wps_per_station_psk to use own_addr()
Ben [Wed, 4 Feb 2015 09:30:30 +0000 (04:30 -0500)]
tests: Fix ap_wps_per_station_psk to use own_addr()

The test used p2p_dev_addr() that can be different from own_addr()
if a dedicated P2P Device interface is used.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
9 years agotests: Fix ap_wpa2_psk_file to use own_addr
Ben [Wed, 4 Feb 2015 09:30:27 +0000 (04:30 -0500)]
tests: Fix ap_wpa2_psk_file to use own_addr

The test used p2p_dev_addr() that can be different from own_addr()
if a dedicated P2P Device interface is used.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
9 years agotests: Fix destination address in ap_hs20_remediation_required_ctrl
Matti Gottlieb [Wed, 4 Feb 2015 09:30:26 +0000 (04:30 -0500)]
tests: Fix destination address in ap_hs20_remediation_required_ctrl

Fix the destination address that is sent in the WNM-Notification to be
the BSS address opposed to the P2P address.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
9 years agotests: Use get_bss() with ifname in autogo
Ilan Peer [Wed, 4 Feb 2015 09:30:25 +0000 (04:30 -0500)]
tests: Use get_bss() with ifname in autogo

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Add option to specify ifname to get_bss()
Ilan Peer [Wed, 4 Feb 2015 09:30:24 +0000 (04:30 -0500)]
tests: Add option to specify ifname to get_bss()

This is needed for cases that the group interface differs from the main
interface, i.e., when a dedicated P2P Device interface is used.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use the global control interface in test_p2p_grpform
Ilan Peer [Wed, 4 Feb 2015 09:30:23 +0000 (04:30 -0500)]
tests: Use the global control interface in test_p2p_grpform

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use global_request for SET commands in test_p2p_grpform
Ilan Peer [Wed, 4 Feb 2015 09:30:22 +0000 (04:30 -0500)]
tests: Use global_request for SET commands in test_p2p_grpform

When the 'SET' command is used to configure parameters related to P2P
operation use the global control interface and not the per interface one
as otherwise the setting will only have effect on the interface and will
work if a dedicated P2P_DEVICE is used.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Update group ifname in p2p_go_invite_auth
Ilan Peer [Wed, 4 Feb 2015 09:30:21 +0000 (04:30 -0500)]
tests: Update group ifname in p2p_go_invite_auth

Once the connection is established need to call group_form_result() on
the invited device, as otherwise the group interface name is not updated
and the connectivity test is done with the main interface instead of the
group interface.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use global control interface in discovery_dev_id
Ilan Peer [Wed, 4 Feb 2015 09:30:20 +0000 (04:30 -0500)]
tests: Use global control interface in discovery_dev_id

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Modify autogo_legacy to use the group interface
Ilan Peer [Wed, 4 Feb 2015 09:30:17 +0000 (04:30 -0500)]
tests: Modify autogo_legacy to use the group interface

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Use global control interface in wait_go_ending_session()
Ilan Peer [Wed, 4 Feb 2015 09:30:13 +0000 (04:30 -0500)]
tests: Use global control interface in wait_go_ending_session()

P2P_EVENT_GROUP_REMOVED is a global event, so use
wait_global_event() instead of wait_event().

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: Verify SD TX callback processing after P2P find is stopped
Jouni Malinen [Wed, 4 Feb 2015 18:47:14 +0000 (20:47 +0200)]
tests: Verify SD TX callback processing after P2P find is stopped

These are far from perfect since timing is quite difficult to match for
the case that behaved incorrectly. Anyway, it looks loke
p2p_service_discovery_peer_not_listening was able to hit the error now
and then, so this should be sufficient as a regression test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Fix stopping on search after SD callback
Krishna Vamsi [Wed, 4 Feb 2015 11:47:23 +0000 (17:17 +0530)]
P2P: Fix stopping on search after SD callback

If p2p_find_timeout triggers after starting SD but before getting TX
status for send action, unwanted search could get triggered again when
TX status arrives though p2p_find_timeout moved the state to P2P_IDLE by
then. p2p_continue_find() would then move the state to P2P_SEARCH again.
Do not trigger the find operation from this context if state is
P2P_IDLE to avoid this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoOpenSSL: Use SSL_cache_hit() when available
Jouni Malinen [Wed, 4 Feb 2015 00:04:35 +0000 (02:04 +0200)]
OpenSSL: Use SSL_cache_hit() when available

This is going to be required for OpenSSL 1.1.0 which makes the SSL
structure opaque. Older versions starting from OpenSSL 1.0.1 include
this function, so start using it now based on OPENSSL_VERSION_NUMBER.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoOpenSSL: Use library wrapper functions to access cert store
Jouni Malinen [Tue, 3 Feb 2015 23:58:37 +0000 (01:58 +0200)]
OpenSSL: Use library wrapper functions to access cert store

OpenSSL 0.9.8 and newer includes SSL_CTX_get_cert_store() and
SSL_CTX_set_cert_store() helper functions, so there is no need to
dereference the SSL_CTX pointer to cert ssl_ctx->cert_store. This helps
in working with the future OpenSSL 1.1.0 release that makes the SSL_CTX
structure opaque.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: P2PS and persistent group
Jouni Malinen [Tue, 3 Feb 2015 15:00:56 +0000 (17:00 +0200)]
tests: P2PS and persistent group

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Increase grpform_ext_listen coverage
Jouni Malinen [Tue, 3 Feb 2015 14:43:02 +0000 (16:43 +0200)]
tests: Increase grpform_ext_listen coverage

Include actual extended listen period in the test and confirm that the
device was available on a social channel during such period by using
non-social operating channel.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P_PROV_DISC error case
Jouni Malinen [Tue, 3 Feb 2015 14:30:27 +0000 (16:30 +0200)]
tests: P2P_PROV_DISC error case

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P listen channel optimization
Jouni Malinen [Tue, 3 Feb 2015 14:14:52 +0000 (16:14 +0200)]
tests: P2P listen channel optimization

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Clean up Listen channel optimization debug prints
Jouni Malinen [Tue, 3 Feb 2015 14:13:35 +0000 (16:13 +0200)]
P2P: Clean up Listen channel optimization debug prints

Do not claim to change the Listen channel in a debug message when
previously configured channel prevents this. In addition, fix a typo in
another related debug print.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: OBSS scanning report processing
Jouni Malinen [Tue, 3 Feb 2015 10:33:51 +0000 (12:33 +0200)]
tests: OBSS scanning report processing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoFix hostapd obss_interval documentation
Jouni Malinen [Tue, 3 Feb 2015 10:32:37 +0000 (12:32 +0200)]
Fix hostapd obss_interval documentation

This parameter has been available for more than just testing purposes,
i.e., OBSS scanning has already been used to enable 20-to-40 MHz channel
changes on 2.4 GHz.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoFix 20/40 MHz co-ex report processing with obss_interval=0
Jouni Malinen [Tue, 3 Feb 2015 10:29:37 +0000 (12:29 +0200)]
Fix 20/40 MHz co-ex report processing with obss_interval=0

If OBSS scan interval is not set, the AP must not schedule a timeout to
restore 40 MHz operation immediately after having moved to a 20 MHz
channel based on an unsolicited co-ex report. Fix this by scheduling the
timeout only if obss_interval is non-zero.

Since we do not currently support AP doing OBSS scans after the initial
BSS setup, this means practically that 40-to-20 MHz transition is
allowed, but 20-to-40 MHz is not with obss_interval=0. The latter gets
enabled if obss_interval is set to a non-zero value so that associated
STAs can take care of OBSS scanning.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P services
Rajiv Ranjan [Wed, 22 Oct 2014 21:11:16 +0000 (00:11 +0300)]
tests: P2P services

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Restore p2ps config_method in dbus_get_set_wps
Jouni Malinen [Mon, 2 Feb 2015 22:33:45 +0000 (00:33 +0200)]
tests: Restore p2ps config_method in dbus_get_set_wps

This test case is modifying the list of enabled config_method values and
needs to restore "p2ps" option that is included by default. Without
this, P2PS executed after dbus_get_set_wps could fail.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Do not remove pending interface on p2p_stop_find
Krishna Vamsi [Tue, 30 Dec 2014 12:27:38 +0000 (17:57 +0530)]
P2PS: Do not remove pending interface on p2p_stop_find

The pending interface created during provision discovery should
not be removed on stopping p2p_find. This pending interface has
to be used after completing GO negotiation. Earlier the pending
interface is created just before GO negotiation so there was no
problem.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Allow PD retry in SEARCH and LISTEN_ONLY also
Krishna Vamsi [Fri, 30 Jan 2015 13:36:01 +0000 (19:06 +0530)]
P2PS: Allow PD retry in SEARCH and LISTEN_ONLY also

p2p_timeout_prov_disc_req is getting triggered in P2P_IDLE,
P2P_SEARCH and P2P_LISTEN_ONLY states. Retry logic should not be
limited to only P2P_IDLE state.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add commands to control interface redir list
Krishna Vamsi [Tue, 2 Dec 2014 09:12:32 +0000 (14:42 +0530)]
P2PS: Add commands to control interface redir list

This is needed to allow P2PS related new control interface commands to
be redirected for proper context processing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Send P2P_FIND_STOPPED event during P2P SD also
Krishna Vamsi [Fri, 17 Oct 2014 11:44:48 +0000 (17:14 +0530)]
P2PS: Send P2P_FIND_STOPPED event during P2P SD also

During service discovery if P2P_FIND times out, P2P_FIND_STOPPED event
is sent to upper layers to allow follow up P2P_FIND commands. This needs
to be done also in case an SD was in progress during the find operation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Start WPS registrar upon GO formation
Krishna Vamsi [Mon, 15 Dec 2014 11:40:31 +0000 (17:10 +0530)]
P2PS: Start WPS registrar upon GO formation

If P2PS config method is used for provisioning, upon forming a new GO,
start WPS registrar for the provisioned peer automatically.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: PD Response processing
Krishna Vamsi [Wed, 10 Dec 2014 11:53:00 +0000 (17:23 +0530)]
P2PS: PD Response processing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Provision Discovery fail event
Krishna Vamsi [Wed, 10 Dec 2014 11:51:09 +0000 (17:21 +0530)]
P2PS: Provision Discovery fail event

This extends P2P-PROV-DISC-FAILURE with adv_id and deferred_session_resp
in P2PS cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: PD Request processing and PD Response building
Krishna Vamsi [Wed, 10 Dec 2014 10:53:54 +0000 (16:23 +0530)]
P2PS: PD Request processing and PD Response building

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Callback to send P2PS provisioning events
Krishna Vamsi [Wed, 10 Dec 2014 13:43:23 +0000 (19:13 +0530)]
P2PS: Callback to send P2PS provisioning events

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Callback to create pending group after sending PD Response
Krishna Vamsi [Wed, 10 Dec 2014 11:29:29 +0000 (16:59 +0530)]
P2PS: Callback to create pending group after sending PD Response

This introduces a P2P module callback function that will be used to
create the pending P2PS group after sending PD Response and receiving
ACK status for it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Callback to remove stale persistent groups
Krishna Vamsi [Wed, 10 Dec 2014 13:38:17 +0000 (19:08 +0530)]
P2PS: Callback to remove stale persistent groups

When the peer device is trying to form a new group despite having
old persistent group with same roles, remove the stale persistent
group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: ASP provisioning commands to control interface
Krishna Vamsi [Wed, 10 Dec 2014 09:34:32 +0000 (15:04 +0530)]
P2PS: ASP provisioning commands to control interface

This adds new wpa_supplicant control interface commands
P2P_ASP_PROVISION and P2P_ASP_PROVISION_RESP.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Process P2PS provisioning commands
Krishna Vamsi [Wed, 10 Dec 2014 14:25:18 +0000 (19:55 +0530)]
P2PS: Process P2PS provisioning commands

This extends wpas_p2p_prov_disc() implementation to accept P2PS
parameters. None of the callers are yet using this functionality; the
following commit introduces a user.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add P2PS attributes into PD Request if requested
Krishna Vamsi [Wed, 10 Dec 2014 08:38:56 +0000 (14:08 +0530)]
P2PS: Add P2PS attributes into PD Request if requested

This adds a data structure for storing P2PS PD information and code to
add the related attributes into PD Request. The actual operation to
trigger this behavior will be added in a separate commit.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Allow p2p_build_ssid() to use pre-set SSID
Krishna Vamsi [Wed, 10 Dec 2014 10:14:18 +0000 (15:44 +0530)]
P2PS: Allow p2p_build_ssid() to use pre-set SSID

This is needed to allow P2PS PD to prepare SSID for the group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add support to send ASP-RESP events
Krishna Vamsi [Tue, 9 Dec 2014 15:35:41 +0000 (21:05 +0530)]
P2PS: Add support to send ASP-RESP events

Send P2P-SERV-ASP-RESP events upon receiving GAS responses with
ASP services.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Logic to parse GAS requests for ASP services
Krishna Vamsi [Tue, 9 Dec 2014 15:25:08 +0000 (20:55 +0530)]
P2PS: Logic to parse GAS requests for ASP services

Add support to parse received GAS requests for ASP services and
prepare GAS responses accordingly.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add support to send ASP service requests
Krishna Vamsi [Tue, 9 Dec 2014 15:12:27 +0000 (20:42 +0530)]
P2PS: Add support to send ASP service requests

This extends the P2P_SERV_DISC_REQ control interface command with a new
"asp" service type. This takes service id, service string, and optional
service info as arguments.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add Application Service Info to device found events
Brian Gix [Thu, 11 Sep 2014 15:18:50 +0000 (18:18 +0300)]
P2PS: Add Application Service Info to device found events

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add Advertised Service Info into Probe Response frames
Brian Gix [Fri, 5 Sep 2014 14:06:25 +0000 (17:06 +0300)]
P2PS: Add Advertised Service Info into Probe Response frames

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Parse Probe Request frames for matching ASP hashes
Krishna Vamsi [Tue, 9 Dec 2014 14:25:29 +0000 (19:55 +0530)]
P2PS: Parse Probe Request frames for matching ASP hashes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Extend add/del services logic to support ASP
Krishna Vamsi [Tue, 9 Dec 2014 14:02:50 +0000 (19:32 +0530)]
P2PS: Extend add/del services logic to support ASP

In addition, add a new P2P_SERVICE_REP command that can be used to
replace existing ASP advertisements.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Allow p2p_get_group_num_members() to be called with NULL
Brian Gix [Thu, 11 Sep 2014 15:47:03 +0000 (18:47 +0300)]
P2P: Allow p2p_get_group_num_members() to be called with NULL

This make it easier to use wpa_s->p2p_group without having to check
whether there is a group initialized on this wpa_s instance.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: WPS changes needed for P2PS default PIN
Brian Gix [Thu, 11 Sep 2014 15:27:44 +0000 (18:27 +0300)]
P2PS: WPS changes needed for P2PS default PIN

This provides additional WPS definitions and rules for negotiating use
of P2PS default PIN configuration method.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add service hash to Probe Request frames
Brian Gix [Fri, 5 Sep 2014 14:20:18 +0000 (17:20 +0300)]
P2PS: Add service hash to Probe Request frames

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add option to specify seek strings into P2P_FIND
Brian Gix [Fri, 5 Sep 2014 14:27:20 +0000 (17:27 +0300)]
P2PS: Add option to specify seek strings into P2P_FIND

P2PS seek strings can now be specified in the P2P_FIND control interface
command with one or more optional "seek=<str>" parameters.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Helper functions to build new P2P attributes
Krishna Vamsi [Wed, 10 Dec 2014 06:56:33 +0000 (12:26 +0530)]
P2PS: Helper functions to build new P2P attributes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add parsing of new P2P attributes
Brian Gix [Fri, 5 Sep 2014 14:12:46 +0000 (17:12 +0300)]
P2PS: Add parsing of new P2P attributes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2PS: Add new P2P identifier assignments from P2P spec v1.5
Brian Gix [Fri, 5 Sep 2014 13:20:44 +0000 (16:20 +0300)]
P2PS: Add new P2P identifier assignments from P2P spec v1.5

These will be used for P2P Services.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd helper functions for escaping and unescaping UTF-8
Brian Gix [Fri, 5 Sep 2014 13:43:57 +0000 (16:43 +0300)]
Add helper functions for escaping and unescaping UTF-8

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoFix driver-offloaded offchannel TX done processing
Jouni Malinen [Mon, 2 Feb 2015 12:00:00 +0000 (14:00 +0200)]
Fix driver-offloaded offchannel TX done processing

It was possible for a Action frame sequence completion to stop an
ongoing offchannel remain-on-channel operation unexpectedly in cases
where TX operation was offloaded to the driver and such an operation
happened to occur during a previously started remain-on-channel (e.g.,
for P2P listen state).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Add P2P state into p2p_send_action_cb() debug entry
Jouni Malinen [Mon, 2 Feb 2015 11:48:48 +0000 (13:48 +0200)]
P2P: Add P2P state into p2p_send_action_cb() debug entry

This makes it easier to debug issues related to ongoing P2P operations
getting stopped due to Action frame exchanges.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Ignore remain-on-channel callback event if not waiting for one
Jouni Malinen [Mon, 2 Feb 2015 11:32:06 +0000 (13:32 +0200)]
P2P: Ignore remain-on-channel callback event if not waiting for one

It was possible for the previously requested remain-on-channel for P2P
listen state to get canceled before having received driver event
indicating start of that remain-on-channel operation. In such a case,
the event was able to trigger P2P module to start processing listen
timeout even though there was not supposed to be a following listen
operation anymore. Skip the driver event if we are not waiting for a new
listen state.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoHS 2.0R2: Add password to DB in case of machine managed subscription
Sreenath S [Thu, 10 Apr 2014 10:46:45 +0000 (16:16 +0530)]
HS 2.0R2: Add password to DB in case of machine managed subscription

Add password and machine_managed flag to database in case of machine
managed subscription to fix EAP-TTLS connection failure to production
AP. In case of user managed subscription, the entered password is added
to DB from the PHP script. However in machine managed subscription,
machine generated password is added only in SOAP messages and PPS MO. So
connection to production will fail as the generated password is not
present in the database used by AAA server.

Signed-off-by: Sreenath Sharma <sreenath.mailing.lists@gmail.com>
9 years agoImprove BSS selection with default noise floor values
Mukesh Agrawal [Wed, 9 Apr 2014 00:54:49 +0000 (17:54 -0700)]
Improve BSS selection with default noise floor values

When noise floor measurements are not available, compute SNR
using default values for the noise floor. This helps steer us
towards 5 GHz BSSes in high signal strength environments.

In more detail...

Existing code prefers a 5 GHz BSS when the 5 GHz BSS's signal
strength is "close" to that of the 2.4 GHz BSS, or when both SNRs
are large. However, the mwifiex driver does not provide noise
floor measurements, so we can't compute SNRs.

Because mwifiex doesn't provide NF measurements, the "large SNR"
code wasn't effective. By using default values for the noise floor,
we can again compute SNRs, and decide that the SNR is high enough
that we shouldn't worry about the exact difference in SNR.

The default noise floor values (one for 2.4 GHz, and one for 5 GHz)
were chosen by measurement in a noisy environment, so they should be
conservative.

Note that while this patch is motivated by mwifiex, it affects
ath9k as well. Although ath9k provides noise floor measurements
in general, it will sometimes fail to provide a measurement for
one or more specific channels.

As a result of this patch, we'll always compare BSSes based on SNR
(either measured or estimated), rather than sometimes comparing
based on signal strength. ("Always" assumes that the
WPA_SCAN_LEVEL_DBM flag is set. It is for mwifiex and ath9k.)

While there:
- fix a whitespace issue (spaces -> tab)
- clean up existing comments
- update dump_scan_res to indicate whether the noise floor is
  measured, or default

Signed-hostap: mukesh agrawal <quiche@chromium.org>

9 years agoAdd an option allow canned EAP-Success for wired IEEE 802.1X
Jouni Malinen [Sun, 1 Feb 2015 17:22:54 +0000 (19:22 +0200)]
Add an option allow canned EAP-Success for wired IEEE 802.1X

For wired IEEE 802.1X authentication, phase1="allow_canned_success=1"
can now be used to configure a mode that allows EAP-Success (and
EAP-Failure) without going through authentication step. Some switches
use such sequence when forcing the port to be authorized/unauthorized or
as a fallback option if the authentication server is unreachable. By
default, wpa_supplicant discards such frames to protect against
potential attacks by rogue devices, but this option can be used to
disable that protection for cases where the server/authenticator does
not need to be authenticated.

When enabled, this mode allows EAP-Success/EAP-Failure as an immediate
response to EAPOL-Start (or even without EAPOL-Start) and EAP-Success is
also allowed immediately after EAP-Identity exchange (fallback case for
authenticator not being able to connect to authentication server).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-MSCHAPv2 peer: Add option to disable password retry query
Jouni Malinen [Sun, 1 Feb 2015 15:45:19 +0000 (17:45 +0200)]
EAP-MSCHAPv2 peer: Add option to disable password retry query

wpa_supplicant used to request user to re-enter username/password if the
server indicated that EAP-MSCHAPv2 (e.g., in PEAP Phase 2)
authentication failed (E=691), but retry is allowed (R=1). This is a
reasonable default behavior, but there may be cases where it is more
convenient to close the authentication session immediately rather than
wait for user to do something.

Add a new "mschapv2_retry=0" option to the phase2 field to allow the
retry behavior to be disabled. This will make wpa_supplicant abort
authentication attempt on E=691 regardless of whether the server allows
retry.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-PEAP/MSCHAPv2 password failure
Jouni Malinen [Sun, 1 Feb 2015 15:37:35 +0000 (17:37 +0200)]
tests: EAP-PEAP/MSCHAPv2 password failure

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agohostapd: Simplify vlan_add_dynamic error paths
Helmut Schaa [Mon, 17 Mar 2014 13:16:24 +0000 (14:16 +0100)]
hostapd: Simplify vlan_add_dynamic error paths

Preparation for upcoming changes.
No functional changes.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
9 years agoInterworking: Convert wpa_printf() to wpa_msg()
Ben Greear [Thu, 6 Mar 2014 00:19:51 +0000 (16:19 -0800)]
Interworking: Convert wpa_printf() to wpa_msg()

Also adds a few messages that helped me track down why things
were not working as expected.

Signed-off-by: Ben Greear <greearb@candelatech.com>
9 years agoAdd a variable to handle extra CFLAGS values
Roger Zanoni [Tue, 25 Feb 2014 19:06:08 +0000 (15:06 -0400)]
Add a variable to handle extra CFLAGS values

Some packages don't install its headers in the default directory
(e.g.: In Arch Linux libiberty and libn13 includes are installed)
in their own subdirectory under /usr/include) and the build fails
trying to find the headers.

This patch will allow passing extra CFLAGS values without discarding
the assignments made in the Makefile. The CFLAGS values in the Makefile
are ignored, if defined directly in the make command line.

Signed-off-by: Roger Zanoni <roger.zanoni@openbossa.org>
9 years agotests: Make *_key_lifetime_in_memory more robust
Jouni Malinen [Sat, 31 Jan 2015 16:06:06 +0000 (18:06 +0200)]
tests: Make *_key_lifetime_in_memory more robust

It was possible for the GTK-found-in-memory case to be triggered due to
a retransmission of EAPOL-Key msg 3/4 especially when running test cases
under heavy load (i.e., timeout on hostapd due to not receiving the 4/4
response quickly enough). Make this false failure report less likely by
waiting a bit longer after the connection has been completed before
fetching the process memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: wpa_supplicant and station interface in a bridge
Jouni Malinen [Sat, 31 Jan 2015 15:28:08 +0000 (17:28 +0200)]
tests: wpa_supplicant and station interface in a bridge

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWork around Linux packet socket regression
Jouni Malinen [Sat, 31 Jan 2015 15:21:58 +0000 (17:21 +0200)]
Work around Linux packet socket regression

Linux kernel commit 576eb62598f10c8c7fd75703fe89010cdcfff596 ('bridge:
respect RFC2863 operational state') from 2012 introduced a regression
for using wpa_supplicant with EAPOL frames and a station interface in a
bridge. Since it does not look like this regression is going to get
fixed any time soon (it is already two years from that commit and over
1.5 from a discussion pointing out the regression), add a workaround in
wpa_supplicant to avoid this issue.

The wpa_supplicant workaround uses a secondary packet socket to capture
all frames (ETH_P_ALL) from the netdev that is in a bridge. This is
needed to avoid the kernel regression. However, this comes at the price
of more CPU load. Some of this is avoided with use of Linux socket
filter, but still, this is less efficient than a packet socket bound to
the specific EAPOL ethertype. The workaround gets disabled
automatically, if the main packet socket interface on the bridge
interface turns out to be working for RX (e.g., due to an old kernel
version being used or a new kernel version having a fix for the
regression). In addition, this workaround is only taken into use for the
special case of running wpa_supplicant with an interface in a bridge.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: RSN pre-authentication OOM in wpa_supplicant
Jouni Malinen [Sat, 31 Jan 2015 11:45:52 +0000 (13:45 +0200)]
tests: RSN pre-authentication OOM in wpa_supplicant

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix resource leaks on rsn_preauth_init() error paths
Jouni Malinen [Sat, 31 Jan 2015 11:44:48 +0000 (13:44 +0200)]
Fix resource leaks on rsn_preauth_init() error paths

The l2_packet instances were not freed on some of the rsn_preauth_init()
error paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: RSN pre-authentication timeout
Jouni Malinen [Sat, 31 Jan 2015 11:35:31 +0000 (13:35 +0200)]
tests: RSN pre-authentication timeout

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: PMKSA cache size limit in wpa_supplicant
Jouni Malinen [Sat, 31 Jan 2015 11:26:46 +0000 (13:26 +0200)]
tests: PMKSA cache size limit in wpa_supplicant

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Invalid NFC NDEF record handling
Jouni Malinen [Sat, 31 Jan 2015 00:00:02 +0000 (02:00 +0200)]
tests: Invalid NFC NDEF record handling

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add capture file validation for IPv6 in proxyarp_open
Jouni Malinen [Fri, 30 Jan 2015 19:55:46 +0000 (21:55 +0200)]
tests: Add capture file validation for IPv6 in proxyarp_open

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Add capture file validation for IPv4 in proxyarp_open
Jouni Malinen [Fri, 30 Jan 2015 14:23:26 +0000 (16:23 +0200)]
tests: Add capture file validation for IPv4 in proxyarp_open

Verify that the expected frames were seend and unexpected frames
weren't.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Add another bridge port to proxyarp_open
Jouni Malinen [Fri, 30 Jan 2015 11:53:34 +0000 (13:53 +0200)]
tests: Add another bridge port to proxyarp_open

Use another AP instance as a separate bridge port in the proxyarp_open
test cases to increase testing coverage for kernel proxyarp
functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Add brctl showmacs output to proxyarp_open test cases
Jouni Malinen [Fri, 30 Jan 2015 11:33:32 +0000 (13:33 +0200)]
tests: Add brctl showmacs output to proxyarp_open test cases

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Run the proxyarp_open test case both with and without ebtables
Jouni Malinen [Fri, 30 Jan 2015 11:26:12 +0000 (13:26 +0200)]
tests: Run the proxyarp_open test case both with and without ebtables

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Fix tshark refactoring
Jouni Malinen [Fri, 30 Jan 2015 13:28:59 +0000 (15:28 +0200)]
tests: Fix tshark refactoring

Commit 2e1d7386e2766b57bc295702af543cc784a0d2be ('tests: Refactor tshark
running') added a helper function for running tshark. However, it did
not use the filter argument correctly, added an extra -Tfields on the
command line, and failed to use global variable. In practice, this ended
up disabling all the tshark sniffer checks. Fix that by using the filter
argument from the caller and marking the _tshark_filter_arg global.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agodhcp_snoop: Make IPv4 addresses human readable in debug log
Jouni Malinen [Fri, 30 Jan 2015 16:38:47 +0000 (18:38 +0200)]
dhcp_snoop: Make IPv4 addresses human readable in debug log

Use standard numbers-and-dots format for IPv4 in debug logs instead
of hexdump in two different byte orders.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: RADIUS server changing VLAN ID assignment
Jouni Malinen [Thu, 29 Jan 2015 23:11:56 +0000 (01:11 +0200)]
tests: RADIUS server changing VLAN ID assignment

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