Commit graph

110 commits

Author SHA1 Message Date
Jouni Malinen 0fb337c121 Extend load balancing optimization in BSS blacklisting
Move the previously SME specific optimization code into generic
function that can be used from non-SME code, too, and use it to
handle disconnection events. In other words, allow disconnection
event to trigger similar optimized scanning case to handle a
common load balancing mechanism. If there is another BSS in the
same ESS when we receive a disconnection event, scan only the
known frequencies of such other BSSes on the next attempt to
speed up recovery.
2010-11-26 11:36:03 +02:00
Jouni Malinen 5471c3434e Blacklist BSS on first failure if only a single network is enabled
The special case of requiring blacklisting count to be 2 or higher
is only needed when more than a single network is currently enabled.
As such, we should not do that when only a single network is enabled.
This make the station more likely to follow network side load
balancing attempts where the current AP may disassociate us with
an assumption that we would move to another AP.
2010-11-26 11:23:50 +02:00
Jouni Malinen 3c85f144ce P2P: Fix Action frame sending after disconnection
assoc_freq needs to be cleared when an interface gets disconnected.
This fixes an issue where P2P Action frame transmission may fail
because of missing remain-on-channel operation when using the same
interface for group operations (or non-P2P connections) and P2P
management operations.
2010-11-25 16:04:07 +02:00
Jouni Malinen 7a80af658d Fix CONFIG_AP=y build without CONFIG_P2P=y 2010-11-24 16:55:17 +02:00
Albert Liu 1d39378a0b P2P: Fix RX ack status on Action frames sent via interface in GO mode
The wpa_supplicant_event() EVENT_TX_STATUS ack field needs to be
converted to use wpas_send_action_tx_status()
enum p2p_send_action_result in this case, too, to avoid getting
incorrect TX status for P2P processing.
2010-11-24 14:25:33 +02:00
Jouni Malinen bbb921daaa Maintain internal entropy pool for augmenting random number generation
By default, make hostapd and wpa_supplicant maintain an internal
entropy pool that is fed with following information:

hostapd:
- Probe Request frames (timing, RSSI)
- Association events (timing)
- SNonce from Supplicants

wpa_supplicant:
- Scan results (timing, signal/noise)
- Association events (timing)

The internal pool is used to augment the random numbers generated
with the OS mechanism (os_get_random()). While the internal
implementation is not expected to be very strong due to limited
amount of generic (non-platform specific) information to feed the
pool, this may strengthen key derivation on some devices that are
not configured to provide strong random numbers through
os_get_random() (e.g., /dev/urandom on Linux/BSD).

This new mechanism is not supposed to replace proper OS provided
random number generation mechanism. The OS mechanism needs to be
initialized properly (e.g., hw random number generator,
maintaining entropy pool over reboots, etc.) for any of the
security assumptions to hold.

If the os_get_random() is known to provide strong ramdom data (e.g., on
Linux/BSD, the board in question is known to have reliable source of
random data from /dev/urandom), the internal hostapd random pool can be
disabled. This will save some in binary size and CPU use. However, this
should only be considered for builds that are known to be used on
devices that meet the requirements described above. The internal pool
is disabled by adding CONFIG_NO_RANDOM_POOL=y to the .config file.
2010-11-24 01:29:40 +02:00
Anil Gathala Sudha 7cfc4ac319 P2P: Add support for automatic channel selection at GO
The driver wrapper may now indicate the preferred channel (e.g., based
on scan results) on both 2.4 GHz and 5 GHz bands (and an overall best
frequency). When setting up a GO, this preference information is used
to select the operating channel if configuration does not include
hardcoded channel. Similarly, this information can be used during
GO Negotiation to indicate preference for a specific channel based
on current channel conditions.

p2p_group_add command can now use special values (freq=2 and freq=5)
to indicate that the GO is to be started on the specified band.
2010-11-10 13:33:47 +02:00
Jouni Malinen 43882f1efc Allow TSN AP to be selected when configured for WEP
Commit d8d940b746 introduced a regression
that prevented TSN APs from being used with WEP since the AP was
rejected if it advertised WPA or RSN IE when we were configured to use
WEP. Resolve this by checking whether the AP is advertising a TSN, i.e.,
whether the AP allows WEP to be used as a group cipher. If so, allow
the AP to be selected if we are configured to use static WEP or
IEEE 802.1X (non-WPA).

It should be noted that this is still somewhat more restricted in AP
selection than earlier wpa_supplicant branches (0.7.x or older) that
ignore the WPA/RSN IE completely when configured for non-WPA.
2010-11-08 21:14:32 +02:00
Jouni Malinen ea78c315a2 Add ctrl_interface event for association rejected 2010-10-27 20:28:16 +03:00
Jouni Malinen c973f3868a P2P: Remove P2P group on driver resource becoming unavailable
Add a new driver event, EVENT_INTERFACE_UNAVAILABLE, for indicating
that the driver is not able to continue operating the virtual
interface in its current mode anymore, e.g., due to operating
channel for GO interface forced to a DFS channel by another virtual
interface.

When this happens for a P2P group interface, the P2P group will
be terminated and P2P-GROUP-REMOVED event shows the reason for
this as follows:
P2P-GROUP-REMOVED wlan0 GO reason=UNAVAILABLE
2010-10-25 19:16:11 +03:00
Jouni Malinen 35c5d61037 Fix crash on channel list changed event during driver init
The driver wrapper may indicate EVENT_CHANNEL_LIST_CHANGED before
completing init(). This would likely result in segfault when driver
channel list is being read as part of processing this event when
P2P is enabled.
2010-10-20 19:30:55 +03:00
Jouni Malinen 93b7ddd032 P2P: Skip GO Neg Conf ack failure workaround of send failures
The workaround to ignore no ctrl::ack received for GO Negotiation
Confirmation frame was only supposed to be used when the frame was
actually transmitted and just the ack was not received. However, due
to the way the driver failure on transmitting the frame were reported,
this ended up getting applied for all failures in sending the GO
Negotiation Confirmation frame.

Improve this by providing a mechanism to indicate whether send_action
operations fail locally before the frame was actually transmitted or
because of not receiving ack frame after having transmitted the frame.
2010-10-19 12:47:33 +03:00
Jouni Malinen b5c9da8db3 P2P: Add mechanism for updating P2P channel list based on driver events
This allows P2P channel list to be updated whenever the driver changes
its list of allowed channels, e.g., based on country code from scan
results.
2010-10-15 18:55:22 +03:00
Paul Stewart 174fa7898e bgscan: Add new channel condition parameters to signal change events
bgscan modules can potentially get a richer feel for the channel
condition and make better choices about scan/no-scan and roam/no-roam.
2010-10-12 20:03:36 +03:00
Ben Greear 199716adb3 Fix wpa_supplicant build without CONFIG_WPS and CONFIG_AP 2010-10-07 10:41:58 +03:00
Johannes Berg 9919f7a22b Fix AP mode in wpa_supplicant with interface events
Needs to not trigger a scan here when the AP mode setup sets
interface down/up.
2010-10-06 17:10:07 +03:00
Jouni Malinen f648bc7d0d WPS: Use blacklist more aggressively during WPS provisioning
This allows more APs to be tried during the WPS timeout.
2010-09-22 11:50:15 -07:00
Jouni Malinen 7736f18bef WPS: Cancel WPS operation on PBC session overlap detection
Previously, wpa_supplicant remaining in scanning state without
trying to connect, but there is no particular need to do that.
Instead, cancel WPS operation completely whenever PBC session
overlap is detected.
2010-09-19 17:04:04 -07:00
Jouni Malinen ea184114ca Allow auto-connect to request scan in associating state
Disconnection event may be received while in associating state.
Previously, wpa_supplicant could get stuck not trying to reconnect
in that case at least with nl80211. Allow scan request in this
state to avoid the issue. This helps especially with APs that do
load balancing by sending Deauthentication frame as a response to
Reassociation Request frame after successful Authentication frame
exchange.
2010-09-14 00:07:54 -07:00
Ardong Chen 0d0a8ca1cc Add option for disabling automatic reconnection on disconnection
ctrl_interface STA_AUTOCONNECT command can now be used to disable
automatic reconnection on receiving disconnection event. The default
behavior is for wpa_supplicant to try to reconnect automatically, i.e.,
to maintain previous behavior.
2010-09-10 10:30:26 -07:00
Jouni Malinen b73bf0a74b P2P: Stop connection attempt on PBC session overlap
The overlap condition cannot disappear before group formation timeout
hits, so there is no point in continuing in this case and failure can
be indicated immediately.
2010-09-10 10:30:25 -07:00
Jouni Malinen 9fdd0fada7 P2P: Add disassociation/deauthentication IE notifications 2010-09-09 07:17:18 -07:00
Jouni Malinen 9bae1be0a1 P2P: Map driver events to P2P event notifications 2010-09-09 07:17:18 -07:00
Jouni Malinen 0817de904e P2P: Optimize scan timeouts for group formation 2010-09-09 07:17:17 -07:00
Jouni Malinen 73e492693d P2P: Add TODO note for Group Formation bit use in AP selection 2010-09-09 07:17:17 -07:00
Jouni Malinen 54f489be45 WPS 2.0: Validate WPS attributes in management frames and WSC messages
If CONFIG_WPS_STRICT is set, validate WPS IE(s) in management frames and
reject the frames if any of the mandatory attributes is missing or if an
included attribute uses an invalid value. In addition, verify that all
mandatory attributes are included and have valid values in the WSC
messages.
2010-09-09 06:07:48 -07:00
Jouni Malinen 7f5420691e wpa_supplicant AP: Make sure deauth/disassoc event is valid
Verify that the driver wrapper is using a valid deauth/disassoc
event before dereferencing the addr pointer. The address is required
to be set in AP mode, but it is safer to verify this here than to
trust on all driver wrappers doing the correct thing.
2010-09-04 21:50:12 +03:00
Jouni Malinen 0c703df32d Fix BSS selection with multiple configured networks
Commit d8d940b746 broke the logic on
iterating through all configured network blocks. This was supposed
to continue the loop on mismatch to allow other than the first
configured network to be found.
2010-08-28 12:04:21 +03:00
Jouni Malinen d8d940b746 Merge WPA and non-WPA network selection routines
This removes quite a bit of duplicated code and allows network block
priority configuration to be used to prefer unprotected networks and
also allows use on open network with good signal strength even if
scan results show a protected network with marginal signal strength
that does not allow it to be used.
2010-08-27 20:05:49 +03:00
Jouni Malinen 60a972a68d Add current signal strength into signal quality change events 2010-08-27 16:58:06 +03:00
Jouni Malinen 2e75a2b3a6 Add more debug info on deauth/disassoc events and commands 2010-08-17 21:04:38 +03:00
Jouni Malinen 24f7694062 Remove get-first-scan-results-before-request optimization
This has already been disabled in most use cases and can result
in problems with some drivers, so better just remove it completely.
2010-07-18 16:11:03 -07:00
Jouni Malinen 9b7124b27f Add some more debug for driver events 2010-07-17 20:33:34 -07:00
Jouni Malinen 5bc0cdb721 Ignore scan results in wpa_supplicant AP mode
This is needed to avoid trying to reassociate based on new scan
results when using wpa_supplicant to control AP mode. This could
happen if something external triggered the driver to run a scan.
2010-07-17 20:32:25 -07:00
Jouni Malinen 3f967fe055 Verify that l2_packet is initialized before notification call
It is possible that l2_packet is not used with wpa_supplicant
in some cases, so better make sure we do not end up notifying
l2_packet code about authentications unless it was actually
initialized in the first place.
2010-07-17 20:26:47 -07:00
Jouni Malinen c2594c3677 bgscan: Provide scan results to the notify_scan handler 2010-07-10 15:43:44 -07:00
Sam Leffler 3b038d7968 Fix bgscan stopping after dissassociation
Clear bgscan_ssid on disassoc event so bgscan is initialized the next
time we reach COMPLETED state.
2010-07-10 14:43:48 -07:00
Jouni Malinen f62c2315f7 Show signal level and WPS support in scan results debug dump
This makes it easier to debug AP selection for WPS provisioning.
2010-06-11 13:47:33 -07:00
Jouni Malinen 8401a6b028 Add Linux rfkill support
Add a new wpa_supplicant state: interface disabled. This can be used
to allow wpa_supplicant to be running with the network interface even
when the driver does not actually allow any radio operations (e.g.,
due to rfkill).

Allow driver_nl80211.c and driver_wext.c to start while rfkill is in
blocked state (i.e., when ifconfig up fails) and process rfkill
events to block/unblock WLAN.
2010-05-23 10:27:32 +03:00
Jouni Malinen 0544b24248 Add BSSID and reason code (if available) to disconnect event
This adds more details into the CTRL-EVENT-DISCONNECTED event to
make it easier to figure out which network was disconnected in some
race conditions and to what could have been the reason for
disconnection. The reason code is currently only available with
the nl80211 driver wrapper.
2010-04-11 21:25:15 +03:00
Jouni Malinen 64e58f5189 Add option for overriding scan result handler for a single scan 2010-04-11 19:53:31 +03:00
Jouni Malinen 977b11747f Allow sub-second resolution for scan requests
This is in preparation to use cases that may benefit from more frequent
scanning.
2010-04-11 19:10:01 +03:00
Jouni Malinen 86d4f806da Add ctrl_iface command for triggering a roam to a specific BSS
'wpa_cli roam <bssid>' can now be used to test roaming within an ESS
(e.g., for FT over-the-air). This command will bypass a new scan and
will select the BSS based on the specified BSSID. It is responsibility
of the caller to make sure that the target AP is in the BSS table.
This can be done, e.g., by running a scan before the roam command,
if needed.
2010-04-10 22:56:55 +03:00
Jouni Malinen e7846b6859 FT: Clean up wpa_sm_set_ft_params() by using common parse
Instead of parsing the IEs in the callers, use the already existing
parser in wpa_ft.c to handle MDIE and FTIE from initial MD association
response. In addition, this provides more complete access to association
response IEs to FT code which will be needed to fix FT 4-way handshake
message 2/4.
2010-04-10 11:36:35 +03:00
Jouni Malinen 579ce77122 FT: Deauthenticate in case of Reassoc Response validation error
If validation of the Reassociation Response frame fails during FT
Protocol, do not allow association to be completed; instead, force
deauthentication.
2010-04-09 16:59:27 +03:00
Jouni Malinen e2f74005f5 bgscan: Add signal strength change events
This allows bgscan modules to use more information to decide on when
to perform background scans. bgscan_simple can now change between
short and long background scan intervals based on signal strength
and in addition, it can trigger immediate scans when the signal
strength is detected to be dropping.

bgscan_simple takes following parameters now:
short interval:signal strength threshold:long interval
For example:
	bgscan="simple:30:-45:300"
2010-03-28 15:32:34 -07:00
Jouni Malinen b766a9a293 Add freq_list network configuration parameter
This can be used to limit which frequencies are considered when
selecting a BSS. This is somewhat similar to scan_freq, but will
also affect any scan results regardless of which program triggered
the scan.
2010-03-26 22:45:50 -07:00
Jouni Malinen 62c72d7299 FT: Process reassoc resp FT IEs when using wpa_supplicant SME 2010-03-13 21:13:18 +02:00
Jouni Malinen fe1919856c FT: Update SME frequency info before sme_associate() call
This is needed to allow FT-over-DS to request correct channel for
the reassociation with the target AP.
2010-03-13 18:26:25 +02:00
Jouni Malinen 71024cb255 FT: Request reassociation after successful FT Action frame exchange 2010-03-13 17:14:41 +02:00