Commit graph

203 commits

Author SHA1 Message Date
Jouni Malinen
b7412dabd9 P2P: Fix random channel selection to use os_get_random
This could have been using an uninitialized variable instead of
purposefully random value in picking up the channel. There is not
much of a difference for the use case here, but anyway, we may
as well do what was initially planned here and.
2010-10-31 12:27:37 +02:00
Jouni Malinen
79222cfa61 P2P: Reorder code to avoid memory leak on error path 2010-10-31 12:24:21 +02:00
Jouni Malinen
d394a22f30 P2P: Add NULL pointer validation for ssid for group started event
It looks likely that ssid is not NULL here, but better keep this
consistent with other uses of ssid pointer in this function.
2010-10-31 12:12:07 +02:00
Jouni Malinen
58e54293db P2P: Fix removal_reason setting to use correct pointer
The previous version triggered a NULL pointer dereference on
P2P_GROUP_REMOVE * command.
2010-10-27 11:47:41 +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
3071e18109 P2P: Add mechanism for timing out idle groups
A new configuration parameter, p2p_group_idle, can now be used to set
idle timeout value for P2P groups in seconds (0 = no timeout). If set,
this values is used to remove P2P group (both GO and P2P client)
interfaces after the group has been idle (no clients/GO seen) for the
configuration duration.

The P2P-GROUP-REMOVED event is now indicating the reason for group
removal when known. For example:
P2P-GROUP-REMOVED wlan0 GO reason=REQUESTED
P2P-GROUP-REMOVED wlan1 client reason=IDLE
2010-10-25 18:24:15 +03:00
Jouni Malinen
3f4ce13fde P2P: Track non-P2P members in the group and set Group Limit bit
The P2P group component is now tracking of associated stations
in the group and the Group Limit bit in the Group Capabilities
is updated based on whether there is room for new clients in
the group.
2010-10-19 18:10:28 +03:00
Jouni Malinen
de979d8fc7 Fix max_stations to apply to associated STAs, not P2P peers
This driver capability limit was supposed to indicate limit on
how many stations can associate with us in the AP mode, not how
many P2P peers are stored in the peer table.
2010-10-19 17:17:04 +03:00
Jouni Malinen
59eba7a2b3 P2P: Add p2p_cancel command for cancelling ongoing group formation 2010-10-19 15:53:28 +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
d75e880696 P2P: Try to re-create group interface if pending one is not available
This is needed to work around cases where the pending interface gets
removed, e.g., due to failed GO Negotiation. In such case, we may still
accept new GO Negotiation to be completed, but the interface did not
get created without a separate p2p_connect command.

The current implementation is not ideal since the re-created interface
may, at least in theory, get incorrect interface addrees. Though, this
would likely require that the driver supported more than one P2P group
interface and that the previous one was already taken into use for
another group.
2010-10-18 17:00:50 +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
Jouni Malinen
ac8d1011b7 P2P: Set channel list per channel instead of per band
This makes the channel list match with driver capabilities without
having to do workaround like disabling channels 12-14.
2010-10-15 18:51:37 +03:00
Jouni Malinen
4ae4650b4c P2P: Verify that forced channel is suitable for autonomous GO 2010-10-15 18:48:06 +03:00
Jouni Malinen
d054a4622c P2P: Reject multi-channel concurrent operations depending on driver
The driver wrapper can now indicate whether the driver supports
concurrent operations on multiple channels (e.g., infra STA connection
on 5 GHz channel 36 and P2P group on 2.4 GHz channel 1). If not,
P2P_CONNECT commands will be rejected if they would require
multi-channel concurrency.

The new failure codes for P2P_CONNECT:

FAIL-CHANNEL-UNAVAILABLE:
The requested/needed channel is not currently available (i.e., user has
an option of disconnecting another interface to make the channel
available).

FAIL-CHANNEL-UNSUPPORTED:
The request channel is not available for P2P.
2010-10-14 14:24:56 +03:00
Jouni Malinen
3b29972c09 P2P: Limit p2p_connect .. pbc join based on BSSID
Allow only the expected P2P Interface Address as the BSSID for
the AP to avoid selecting incorrect BSS should there be another
device that is advertising active PBC mode before the target
P2P GO does.
2010-10-12 16:56:17 +03:00
Johannes Berg
6cb22d2fd1 P2P: Fix remain-on-channel abort race
When the P2P state machine requests a remain- on-channel, there's a
potential race where it can then request a stop before the r-o-c has
actually started, in which case the stop will not be processed. Fix
that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2010-10-10 17:52:13 +03:00
Jouni Malinen
0e2e565a44 WPS 2.0: Provide (Re)Association Response WPS IE to driver
WPS 2.0 mandates the AP to include WPS IE in (Re)Association Response
if the matching (Re)Association Request included WPS IE. Provide the
needed WPS IE information to the driver_ops API for drivers that
process association frames internally.

Note: This modifies the driver_ops API by adding a new argument to
set_ap_wps_ie().
2010-09-22 10:46:44 -07:00
Sudhakar Swaminathan
0f66abd25b P2P: Add option for disabling intra BSS distribution
p2p_intra_bss configuration parameter can now be used to
disable/enable intra BSS distribution (bridging of frames between
the clients in a group).
2010-09-10 10:30:26 -07:00
Ardong Chen
2049af2bd5 P2P: Fix invitation_received callback to use NULL bssid (if not known)
Previously, the storage buffer for the Group BSSID was returned
regardless of whether it was included in the invitation or not.
2010-09-10 10:30:26 -07:00
Kuko Li
4c01083400 P2P: Do not process configuration changes on non-P2P interfaces 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
3094d4837a P2P: Use group formation timeout (but longer one) with join-a-group
This allows the pending group interface to be removed if we fail
to join a running group. A longer than 15 second timeout is needed
here since the GO may not have authorized our connection yet.
2010-09-10 10:30:25 -07:00
Jouni Malinen
ae3e342108 P2P: Add peer timeout into group formation 15 second timeout
This adds some more time for WPS provisioning step in case the peer
takes long time to start group interface operations.
2010-09-10 10:30:25 -07:00
Ardong Chen
c481048f7c P2P: Add frequency into group started ctrl_interface events 2010-09-10 10:30:25 -07:00
Jouni Malinen
e9a7ae41fa P2P: Use SSID from GO Negotiation to limit WPS provisioning step
In order to avoid picking incorrect SSID from old scan results, use
SSID from GO Negotiation to select the AP.
2010-09-09 07:17:23 -07:00
Jouni Malinen
743ef79914 P2P: Deinit GO group data before global P2P deinit
This avoids issues with using freed memory in p2p_group_deinit().
2010-09-09 07:17:23 -07:00
Jouni Malinen
f8d0131a11 P2P: Use operating frequency from peer table as backup for join
The scan operation before Provision Discovery Request may not include
the GO. However, we are likely to have the GO in our P2P peer table,
so use that information to figure out the operating channel if BSS
table entry is not available.
2010-09-09 07:17:23 -07:00
Jouni Malinen
a482883f63 P2P: Fix connect-to-running-group if Action TX status is delayed
The following operations (scan and associate) were not run if the
Provisioning Discovery Response is received before the TX Action
status.
2010-09-09 07:17:23 -07:00
Jouni Malinen
ab218b7c72 P2P: Add some more debug information for Action frame TX 2010-09-09 07:17:22 -07:00
Jouni Malinen
1cc3a29d49 P2P: Clear pending Action TX frame on p2p_stop_find and p2p_listen
This is needed to avoid issues with the previous TX command from
stopping long Listen state.
2010-09-09 07:17:22 -07:00
Jouni Malinen
10b9ac17cf P2P: For now, do not use channels 12-14 in P2P groups
This is needed to make sure we do not try to accidentally enable GO
in channels that may not be allowed. In addition, this may help with
some driver that do not like channel 14 even as a passive scan
channel.
2010-09-09 07:17:21 -07:00
Jouni Malinen
e1f1509bb0 P2P: Fix P2P IE generation for AssocReq when BSS info is not available
This code could segfault on NULL pointer dereference at least when
ap_scan=2 is used.
2010-09-09 07:17:21 -07:00
Jouni Malinen
c4ea4c5c90 P2P: Allow driver wrapper to indicate how many stations are supported
This can be used to limit the number of clients allowed to connect
to the group on the GO.
2010-09-09 07:17:21 -07:00
Jouni Malinen
3dfda83d9c P2P: Add Device Password ID to GO Neg Request RX event
This event indicates the Device Password ID that the peer tried
to use in GO Negotiation. For example:
P2P-GO-NEG-REQUEST 02:40:61:c2:f3:b7 dev_passwd_id=4
2010-09-09 07:17:20 -07:00
Jouni Malinen
4147a2cc64 P2P: Fix p2p_connect join with interface address
Need to fetch P2P Device Address from the peers table in case the
p2p_connect join command uses interface address.
2010-09-09 07:17:20 -07:00
Jouni Malinen
72044390f3 P2P: Add support for cross connection
If enabled, cross connection allows GO to forward IPv4 packets
using masquerading NAT from the P2P clients in the group to an
uplink WLAN connection. This is disabled by default and can be
enabled with "wpa_cli p2p_set cross_connect 1" on the P2P device
interface.
2010-09-09 07:17:20 -07:00
Jouni Malinen
aefb53bd5d P2P: Disable periodic NoA when non-P2P STA is connected
For now, this applies to the test command that can be used to set
periodic NoA (p2p_set noa). The value are stored and periodic NoA
is enabled whenever there are no non-P2P STAs connected to the GO.
2010-09-09 07:17:20 -07:00
Jouni Malinen
4c08c0bd57 P2P: Include P2P IE in (Re)AssocReq to infra AP if it uses P2P IE
While this is not strictly speaking required by the P2P specification
for a not-P2P Managed Device, this can provide useful information for
the P2P manager AP and may be needed to pass certification tests.
2010-09-09 07:17:20 -07:00
Jouni Malinen
d9d6a58c8f P2P: Fix invitation to active group to use correct operating channel
Invitation Request must use the current operating frequency of the
group, not the default operating channel.
2010-09-09 07:17:20 -07:00
Jouni Malinen
131cb37c2d P2P: Allow pre-authorization of invitation to apply to src addr
For client-invites-device case, the pre-authorization of an invitation
to running group will need to allow Invitation Request from specified
address, too. This is for testing uses only.
2010-09-09 07:17:19 -07:00
Jouni Malinen
6e6963ea86 P2P: Add test mode for SD to force fragmented response 2010-09-09 07:17:19 -07:00
Jouni Malinen
18708aadfc P2P: Initial support for SD fragmentation (GAS Comeback Request/Response) 2010-09-09 07:17:19 -07:00
Jouni Malinen
2a43101e48 P2P: Fix memory leak in SD service entries
Need to flush stored service entries when wpa_supplicant is being
terminated.
2010-09-09 07:17:19 -07:00
Jouni Malinen
bf608cad56 P2P: Rename SD info not available define to match with spec change 2010-09-09 07:17:19 -07:00
Jouni Malinen
706887fc28 P2P: Stop early when processing not-persistent invitation result 2010-09-09 07:17:19 -07:00
Jouni Malinen
2e062d5d74 P2P: Fix Group ID in Invitation Request from active GO
Need to get P2P Device Address, not the Interface Address.
2010-09-09 07:17:19 -07:00
Jouni Malinen
108def931e P2P: Add command for pre-authorizing an invitation to an active group
This is mainly designed for testing and allows p2p_connect join auth
to be used to accept a specific invitation to an active group that
may be received in the future.
2010-09-09 07:17:19 -07:00
Jouni Malinen
3c5126a41f P2P: Set Device Password ID in WPS M1/M2 per new rules
If the P2P client (WPS Enrollee) uses a PIN from the GO (Registrar),
Device Password ID in M1 & M2 is set to Registrar-specified.
2010-09-09 07:17:19 -07:00
Jouni Malinen
ef922c4a34 P2P: Run a scan before provision discovery in p2p_connect join
This is needed to make sure we have fresh BSS information for the GO.
2010-09-09 07:17:19 -07:00
Jouni Malinen
07a30a66c3 P2P: Do not schedule new remain-on-channel if waiting for drv event
The driver event for remain-on-channel may be delayed in a way that
allows management-frame-received event to be received before
wpa_supplicant knows that the driver is actually already on the
previously requested channel. We should not request a new
remain-on-channel to send a response to just a frame if we are waiting
for the driver to get to the same channel. Instead, just continue
waiting for the driver event.
2010-09-09 07:17:18 -07:00
Jouni Malinen
d6ae995057 P2P: Fix infinite loop on interface selection for Action frame TX
When the first wpa_supplicant interface is not the correct one for
transmitting an Action frame (e.g., P2P Presence Request frame
uses a group interface), the code got stuck in an infinite busy
loop. Fix the iteration to go through the interfaces properly.
2010-09-09 07:17:18 -07:00
Jouni Malinen
b22128efdc P2P: Add initial version of P2P Module 2010-09-09 07:17:17 -07:00