Commit graph

136 commits

Author SHA1 Message Date
Paul Stewart cfe53c9aa5 wpa_supplicant: Start bgscan on COMPLETED, not ASSOCIATED
Move the code snippet to switch on bgscan over to wpa_supplicant.c
from event.c, so that it can be activated on wpa_supplicant_set_state().
Also create a centralized place to switch off bgscan. bgscan is now
turned on in COMPLETED, not ASSOCIATED.
2011-03-20 12:27:03 +02:00
Johannes Berg c202f19c68 wpa_s AP mode: propagate scan event
When wpa_s scans in AP mode, it doesn't propagate the scan event to the
AP code, so that code can get stuck if it uses the callbacks there.
Simply call them where appropriate.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2011-03-19 13:08:08 +02:00
Xi Chen ea244d2156 IBSS RSN: Clear IBSS RSN peers based on peer lost events 2011-03-18 17:04:46 +02:00
Xi Chen df41824501 IBSS RSN: Do not start if not yet connected to IBSS
This is used to avoid starting IBSS RSN processing with a peer before
the IBSS connection itself has been completed.
2011-03-16 16:26:26 +02:00
Jouni Malinen 52c9e6f3f5 TDLS: Do not allow setup to be started if AP prohibits TDLS 2011-03-06 14:54:49 +02:00
Ganesh Prasadh 281ff0aa76 TDLS: Add initial support for TDLS (IEEE Std 802.11z-2010) 2011-03-06 14:53:49 +02:00
Shan Palanisamy 39b08b5fc0 Indicate assoc vs. reassoc in association event
This allows driver wrappers to indicate whether the association was
done using Association Request/Response or with Reassociation
Request/Response frames.
2011-03-06 14:31:46 +02:00
Johannes Berg 8fd7dc1b1c P2P: Add new_device flag to dev_found callback
The DBus code will want to have perfect matching of dev_found and the
dev_lost it adds so it doesn't need to keep track internally. Enable
that with a new flag in the core that tracks whether we have already
notified about this -- the existing users can ignore it.

The part where this is always set to 1 if the new device is discovered
by a driver that has P2P in the driver is buggy -- the driver should
feed the P2P peer database and then that should feed the notification
here instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2011-02-24 21:59:58 +02:00
Konguraj(Raj) Kulanthaivel c5db8e5170 P2P: Embed publically visible struct in peer info
This embeds some information about each P2P peer that will be publically
visible in a struct that is shared.

The dev_found notification function is also passed the new struct, which
requires some work for the driver-based P2P management.

Signed-off-by: Konguraj(Raj) Kulanthaivel <konguraj.kulanthaivel@intel.com>
Signed-off-by: Fabien Marotte <fabienx.marotte@linux.intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2011-02-24 21:51:17 +02:00
Ben Greear e29853bbff SME: Add timers for authentication and asscoiation
mac80211 authentication or association operation may get stuck for some
reasons, so wpa_supplicant better use an internal timer to recover from
this.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2011-02-24 16:59:46 +02:00
Jouni Malinen 16a83d2965 FT: Set EAPOL state machined to authenticated state with FT-EAP
When FT protocol run is completed with FT-EAP, the EAPOL state machine
needs to be notified of the completed authentication to make sure it
does not try to start new authentication.
2011-02-20 21:57:53 +02:00
Ben Greear e1504976f1 Do not propagate bad scan results to siblings sharing the radio
This decreases useless work and re-scans by siblings when a
device gets a scan failure.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2011-02-16 18:55:37 +02:00
Ben Greear f049052b9e Use wpa_msg() instead of wpa_printf()
This converts number of debugging messages to use wpa_msg() in order
to allow the interface name to be shown with the messages.

A new function, wpa_dbg(), is introduced to allow
CONFIG_NO_STDOUT_DEBUG=y builds to remove the debug strings. This is
otherwise identical with wpa_msg(), but it gets compiled out if stdout
debugging is disabled.
2011-02-10 20:14:46 +02:00
Jouni Malinen e67b55fb11 wpa_s AP: Deliver EVENT_RX_PROBE_REQ events to AP processing
This is needed to allows WPS PBC session overlap detection to work
with drivers that process Probe Request frames internally. This
code is is run in hostapd, but the wpa_supplicant AP mode did not
have call to the hostapd_probe_req_rx() function even though it
registered handlers for hostapd Probe Request RX callbacks.
2011-02-08 14:32:35 +02:00
Jouni Malinen 98ea943177 Set portValid=TRUE on association for driver-based 4-way handshake
This was previously done for WPA/WPA2-Personal as part of association
processing when the driver is implementing 4-way handshake. The
portValid needs to be done for WPA/WPA2-Enterprise to get the proper
EAPOL authentication completed callback to configure PMK to the driver.
2011-02-01 00:04:02 +02:00
Jouni Malinen 50b05780c2 IBSS RSN: Delay setting of the initial TX GTK
The driver may get confused if we set the initial TX GTK before having
fully configured and connected to an IBSS, so better delay this
operation until the connection (join/start IBSS) has been completed.
2011-01-15 14:07:02 +02:00
Jouni Malinen df83fb7d00 Fix wpa_supplicant_ssid_bss_match() handler for non-WPA
The proto configuration may be left to non-zero when moving from one
configuration to another. To avoid misidentifying a network
configuration as enabling WPA, check key_mgmt field, too.
2010-12-30 18:27:33 +02:00
Jouni Malinen 3ac17eba31 P2P: Add initial support for driver-based P2P management
This adds partial callbacks and events to allow P2P management to be
implemented in a driver/firmware. This is not yet complete and is
very much subject to change in the future.
2010-12-30 12:48:55 +02:00
Johannes Berg 0d7e5a3a29 Allow AP mode to disconnect STAs based on low ACK condition
The nl80211 driver can report low ACK condition (in fact it reports
complete loss right now only). Use that, along with a config option, to
disconnect stations when the data connection is not working properly,
e.g., due to the STA having went outside the range of the AP. This is
disabled by default and can be enabled with disassoc_low_ack=1 in
hostapd or wpa_supplicant configuration file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2010-12-28 17:15:01 +02:00
Jouni Malinen cc5e390d28 WPS: Require PBC match with wps_pbc that specifies BSSID
The WPS mode was already verified when the AP was configured for
WPA/WPA2, but this was not done with AP that was in open mode.
Fix this by allowing wpa_supplicant_ssid_bss_match() to be called
in non-WPA configuration, too. With this change, wps_pbc BSSID
command will wait until the specified target AP is in active PBC
mode before trying to connect to it.
2010-12-28 08:56:23 +02:00
Jouni Malinen 7d878ca769 Use SA Query procedure to recovery from AP/STA state mismatch
If a station received unprotected Deauthentication or Disassociation
frame with reason code 6 or 7 from the current AP, there may be a
mismatch in association state between the AP and STA. Verify whether
this is the case by using SA Query procedure. If not response is
received from the AP, deauthenticate.

This implementation is only for user space SME with
driver_nl80211.c.
2010-12-19 11:58:00 +02:00
Johannes Berg 860fddbb41 Allow setting scan_res_handler from the callback function
Some new code I'm working on will need the scan_res_handler assigned all
the time in certain circumstances, so the easiest way is to reset it
within the handler. This is currently prevented by the way the code in
the event handler works -- change that to permit such usage.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2010-12-17 15:31:05 +02:00
Jouni Malinen df4bc5091e IBSS RSN: Do not start 4-way handshake unless RSN is enabled 2010-12-04 18:17:05 -08:00
Ben Greear 6859f1cb24 Enable sharing of scan result events among virtual interfaces
When controlling multiple virtual interfaces on the same physical
radio, share the scan results events with sibling interfaces. This
decreases the time it takes to connect many virtual interfaces.

This is currently only supported on Linux with cfg80211-based
drivers when using nl80211 or wext driver interface.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-11-26 21:46:30 +02:00
Ben Greear c577db2afd Add interface name to some debug prints
This makes it easier to figure out what is happening when controlling
multiple interfaces from a single wpa_supplicant process.
2010-11-26 21:16:36 +02:00
Jouni Malinen c05d6d188c Do not segfault on EVENT_ASSOC_REJECT without BSSID 2010-11-26 17:38:46 +02:00
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