Commit graph

2435 commits

Author SHA1 Message Date
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