Commit Graph

508 Commits (be5ab8d4ab95222208978504af9646ded1e2a430)

Author SHA1 Message Date
Maneesh Jain be5ab8d4ab D-Bus: Add InvitationReceived Signal
This is equivalent to the P2P_EVENT_INVITATION_RECEIVED signal on the
control interface. It can be used to sent the Invitation Received signal
to applications written using D-Bus.

Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
9 years ago
Nishant Chaprana 2a95fac944 P2P: Add D-Bus signal GroupFormationFailure
This is similar to the control interface event
P2P-GROUP-FORMATION-FAILURE.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
9 years ago
Jouni Malinen 941cd3ec70 P2P: Request fresh scan results after GO Negotiation
The P2P group is not yet operating when going through GO Negotiation
exchange. Previously, an old cached scan result could be used to skip
the scan immediately after the GO Negotiation. While this is quite
unlikely to happen in practice, we can easily force a scan here now with
the generic scan_min_time mechanism. Do that to avoid any corner cases
that a previous instance of the group could have if found in cached scan
results.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Jouni Malinen dfaf11d648 P2P: Require fresh scan results for persistent group re-invocation
The P2P group is not yet operating when going through invitation
exchange for re-invocation. Previously, an old cached scan result could
be used to skip the scan immediately after the invitation exchange.
While this may result in the fastest possible connection, it does have
some issues with cases where the GO takes some time to start up. It
would also be at least theoretically possible for some of the BSS
parameters to be different, so having a fresh scan result from the new
GO instance may be desired in any case.

Add a mechanism to skip scan results that have been last updated before
a specific point in time and as the first user for this mechanism,
require chan results to be more recent than the invitation message
exchange for the P2P Client role in persistent group re-invocation case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Andrei Otcheretianski d494ca0be4 P2PS: Consider WPS P2PS method when joining a group
If P2PS PD concludes to use default P2PS method wpas_p2p_scan_res_join()
ignores this value and tries to perform a redundant legacy PD.
Fix this by considering WPS_P2PS method too.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ahmad Kholaif fbcddaed9a P2P: Support driver preferred freq list for invitation case
When using P2P invitation to re-invoke a persistent P2P group without
specifying the operating channel, query the driver for the preferred
frequency list, and use it to select the operating channel of the group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Ahmad Kholaif 8e84921efe P2P: Support driver preferred freq list for Autonomous GO case
When starting an autonomous GO without specifying the operating channel,
query the driver for the preferred frequency list, and use it to select
the operating channel of the GO (if supported).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Andrei Otcheretianski b9da88d6c1 P2PS: Authorize any peer for P2PS method if interface address not known
When P2PS PD with default P2PS method is done, the peer that becomes GO
should authorize the client. However, P2PS specification doesn't require
the client to include its intended interface address in PD
Request/Response. As a result, the P2P Client's interface address may not
be known and any address may need to be authorized.

Previously, client's P2P Device Address was used for authorization,
which is not correct when a dedicated interface is used for P2P Client.
This is not resulting in a connection failure, however it causes a
significant delay (until WPS_PIN_TIME_IGNORE_SEL_REG elapses). Fix this
by authorizing the intended interface address, if known; or any address,
if not known.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
9 years ago
Jouni Malinen 2a098e3668 P2PS: Clean up intended interface address passing to p2ps_prov_complete
Use NULL to indicate if the address is not available instead of fixed
00:00:00:00:00:00. wpas_p2ps_prov_complete() already had code for
converting NULL to that all zeros address for event messages.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Ilan Peer 3a8f008a24 P2P: Do not perform P2P GO CS in some cases
A P2P GO channel switch should not be triggered in all cases that
require channel list update. Specifically, a P2P GO CS should not
be triggered in case that the P2P GO state changed or in case that
that the P2P GO has just completed a CS.

To fix this, add reason code to wpas_p2p_channel_list_update() and
trigger CS flow only for the relevant cases.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer dae4c82c95 P2P: Disallow GO CS immediately after GO Negotiation or invitation
A newly created GO might move to another channel before the client was
able to connect to it. This creates a situation where the client
searches the GO on the channel agreed upon during GO Negotiation or
invitation signaling, while the GO is on another channel. This in turn
might lead to delayed connection or connection failure and group
removal.

Fix this by disallowing a GO CS as long as there is some activity that
should delay the switch. If a GO move is not allowed, set a timeout to
re-attempt the move.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer c2675c87c3 P2P: Consider channel optimizations for additional cases
Re-factor the code, so channel optimizations would be also triggered
upon the following changes: channel updates from the kernel,
disallow_freq interface, etc.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer b130812100 P2P: Modify wpas_p2p_init_go_params()
Not all paths in wpas_p2p_init_go_params() verified that the candidate
frequency can be used for GO purposes. Fix this, and in addition
re-factor the code to put better emphasis on the frequency selection
priorities.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer e280110d17 P2P: Move a GO to a frequency that is also supported by the client
A P2P GO interface that was instantiated after a GO Negotiation or
Invitation holds the intersection of frequencies between the GO and the
client. In case the GO is going to move to another frequency, allow it
to move only to a frequency that is also supported by the client.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer 5e1f480500 P2P: Add a function to compute the group common freqs
Add a function to compute the group common frequencies, and
use it to update the group_common_frequencies as part of the
channel switch flows.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer 1a471ff081 P2P: Move a GO from its operating frequency
Upon any change in the currently used channels evaluate if a GO should
move to a different operating frequency, where the possible scenarios:

1. The frequency that the GO is currently using is no longer valid,
   due to regulatory reasons, and thus the GO must be moved to some
   other frequency.
2. Due to Multi Concurrent Channel (MCC) policy considerations, it would
   be preferable, based on configuration settings, to prefer Same
   Channel Mode (SCM) over concurrent operation in multiple channels.
   The supported policies:

   - prefer SCM: prefer moving the GO to a frequency used by some other
     interface.
   - prefer SCM if Peer supports: prefer moving the GO to a frequency
     used by some other station interface iff the other station
     interface is using a frequency that is common between the local and
     the peer device (based on the GO Negotiation/Invitation signaling).
   - Stay on the current frequency.

Currently, the GO transition to another frequency is handled by a
complete tear down and re-setup of the GO. Still need to add CSA flow to
the considerations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Michael Olbrich be11a59486 P2P: Cancel group formation when deleting a group during group formation
Otherwise P2P remains in provisioning state and continues to skip
extended listening forever.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
9 years ago
Jouni Malinen 9f59fe8dc8 P2P: Do not clear wpa_s->go_dev_addr before group removal
This variable is needed to figure out whether a wpa_supplicant interface
is for a P2P group that is (or was) connected to a specific GO. The
previous implementation was able to find such a case only when there was
an association with the GO. However, this may be needed even if there is
a temporary disconnection from the GO. Keep the GO device address
information over such temporary disconnections and only remove it on
group termination. This fixes an issue with D-Bus Peer PropertiesChanged
signals for the Groups property in case a P2P group gets removed due to
group idle timeout instead of explicit group termination command (local
request) or GO notification.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years ago
Ahmad Kholaif fc71f7d99d P2P: Expose driver preferred frequency list fetch to P2P
This adds a callback function that can be used from the P2P module to
request the current preferred list of operating channels from the
driver.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Ahmad Kholaif 370017d968 P2P: Use preferred frequency list from the local driver
If the driver supports the preferred frequency list extension, use this
information from the driver when no explicitly configured preference
list (p2p_pref_chan) is present for P2P operating channel selection.
This commit adds this for GO Negotiation and Invitation use cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Ahmad Kholaif 7c813acf9c P2P: Inform driver of the operating channel following group formation
Upon GO Negotiation completion, if the remote peer becomes GO, send a
hint event over QCA vendor specific interface to inform the driver of
the likely operating channel of the P2P GO.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Max Stepanov 88f3d7c980 P2PS: Add feature capability to PD events
Report the feature capability on P2PS-PROV-START and P2PS-PROV-DONE
ctrl-iface events. A feature capability value is specified as
'feature_cap=<hex>' event parameter, where <val> is a hexadecimal
string of feature capability bytes in a PD Response frame.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Andrei Otcheretianski 5cc6ec0f68 P2PS: Set intended interface address correctly for new group
If a device may be an explicit GO, it adds the GO details in the PD
Request. First, we try to reuse an active GO. If it is not present, we
try to reuse a non-active persistent group. In the latter case, if a
dedicated P2P interface is needed, the intended address should be that
of the pending interface. However, the wpas_get_go_info() provided the
ssid->bssid address, which is the address of the P2P device. This might
result in an incorrect intended interface attribute in the PD Request in
case a separate group interface is used.

Fix this by setting group_iface variable to true only if a dedicated
interface should be used and set the attribute accordingly.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Andrei Otcheretianski 1f14e2bf92 P2PS: Add PD Response validation
Validate the PD Response frame contents more thoroughly when it is used
for P2PS.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Andrei Otcheretianski 1f1a08b4cc P2PS: Add intended iface address during PD for persistent group
When persistent group is used and the peer is GO in this group,
intended interface attribute should be added to PD request/response.
Not doing so violates the spec.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Andrei Otcheretianski 23bb9828a3 P2PS: Fix P2PS-PROV-DONE event on GO
If after P2PS PD the device should become a GO it sends P2PS-PROV-DONE
event which contains the GO interface name. If the GO isn't running yet
the device may use pending interface name. However, when the GO is
started, pending interface name will be removed.

Fix the GO interface name in P2PS-PROV-DONE event by copying the
interface name instead of saving the pointer.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Andrei Otcheretianski a698d6c85f P2PS: Use wpas_p2p_create_iface() to check if dedicated iface is needed
Call wpas_p2p_create_iface() instead of just checking p2p_no_group_iface
config value. Not doing so, resulted in an incorrect behavior when the
driver sets WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE flag.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer f43c1ae798 P2P: Handle P2P Device dedicated interface parent removal
In case of a network interface removal, check if the interface
was also the parent interface of the P2P Device dedicated interface.
If this is the case, then stop the P2P Device functionality, and
remove the P2P Device dedicated interface.

In case that the interface is added again and P2P Device
functionality can be enabled again, add a new P2P Device dedicated
interface and allow further P2P Device functionality.

In case that the P2P Device dedicated interface is re-created, the
original P2P Device configuration file is needed, so store it in
the global params (instead in the wpa_interface configuration).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Eliad Peller e4a80d89bd P2P: Fix secondary channel selection for HT40
wpas_p2p_get_ht40_mode() used blacklist approach (bw != BW20) to find
the relevant op_class, but didn't take into account other non-BW40
cases, like BW80, that had been added to the bw enum after the initial
implementation. Fix this by looking for the specific BW40 bw cases.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years ago
Ilan Peer de7b02fd18 P2P: Use the P2P Device interface in wpas_p2p_fallback_to_go_neg()
Previously the wpa_s->parent interface was used, which is not
necessarily the P2P Device management interface.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Jouni Malinen d95c5994c8 P2P: Fix group interface addition failure properly for concurrent case
It was possible for a P2P group formation failure to result in a
concurrent station mode operation getting disconnected in the specific
error case where group interface addition fails after a successful GO
Negotiation. Fix this by skipping the wpas_p2p_group_delete() call in
this specific case since the group interface does not exists anymore at
the point wpas_group_formation_completed() gets called.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Andrei Otcheretianski 0799b3f899 P2P: Specify frequency when sending Probe Response frame
If the RX frequency of the Probe Request frame is known, specify it when
sending the Probe Response frame. This is needed when the Probe Request
frame is received on another virtual interface, for example, when a GO
or P2PS client are discoverable on the group operating channel.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Max Stepanov 07c1e987d5 P2PS: Enable Probe Request frame processing by P2P Client
1. Add global p2p_cli_probe property to enable/disable Probe Request
frame RX reporting for connected P2P Clients. The property can be set to
0 - disable or 1 - enable. The default value is 0.

2. Enable Probe Request frame RX reporting for P2P Client on
WPA_COMPLETED state if p2p_cli_probe property is set to 1. Disable it
when an interface state is changing to any other state.

3. Don't cancel Probe Request frame RX reporting on wpa_stop_listen for
a connected P2P Client handling Probe Request frames.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Max Stepanov 734ddf6125 P2P: Add rx_freq parameter to Probe Request frame handler
In some cases, Probe Request frames can be received by a peer not only
on a listen channel. In this case an additional rx_freq parameter
explitly contains a Probe Request frame RX frequency. In case rx_freq is
set to 0, a Probe Request frame RX channel is assumed to be our own
listen channel (p2p->cfg->channel).

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Jouni Malinen e6012e839d P2P: Update target GO Device Address from BSS entry during join
It is possible for P2P_CONNECT-join command to be issued on a GO's P2P
Interface Address before the P2P peer entry is available to map this
into the GO's P2P Device Address. This could result in the join
operation failing to continue after receiving PD Response due to the
address mismatch (source address = P2P Device Address while only the P2P
Interface Address is known). Fix this by updating the pending join P2P
Device Address based on the BSS entry, if needed.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years ago
Amr BEN ABDESSALEM 0c9fb14ec4 P2P: Add Operating class 125 for P2P supported channels
Add operating class 125 (channels 149..169) to the list of P2P supported
channels. This allows the 5 GHz channels 161 and 169 to be used for P2P
GO when those channels are allowed for AP mode in the current regulatory
domain.

Signed-off-by: Amr BEN ABDESSALEM <amrx.ben.abdessalem@intel.com>
9 years ago
MAYANK HAARIT aa2b12562b P2P: Add GO Intent of connecting device in GO Negotiation Request event
Add GO Intent information of connecting device in GO Negotiation Request
event which will help applications to decide its own GO intent value in
advance and can avoid failure cases when both devices use GO Intent 15
depending on application requirement.

Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
9 years ago
Krishna Vamsi ccad05a95c P2P: Restart group formation timer upon receiving new Inv Req
A new Invitation Request might be received on a just started persistent
group if the previous Invitation Response sent isn't received at the
peer (GO of the persistent group). When the peer sends an Invitation
Request again, treat it as start of group formation and restart the
group formation timer at this point of time.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Ilan Peer b4342ca4d8 P2P: Use p2p_init_wpa_s for P2P command redirection over D-Bus
D-Bus used the p2p_dev member in struct wpa_supplicant to track the
interface used for P2P Device operations. However, this is not needed as
the interface used for P2P Device operations is stored in struct
wpa_global->p2p_init_wpa_s.

Replace all the redirections to wpa_s->p2p_dev with redirections to
wpa_s->global->p2p_init_wpa_s and removed this member as it is no
longer needed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer b740401f18 P2P: Fix wpas_remove_persistent_peer() to use P2P mgmt interface
The function used wpa_s->parent->conf to iterate the P2P networks and
update the configuration file. However, wpa_s->parent is not
necessarily the interface used to manage the P2P Device operations.

Fix this by accessing the configuration file of the interface
initialized to manage the P2P Device operations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer 1e0a02942b P2P: Fix wpas_p2p_add_persistent_group_client() to use P2P mgmt interface
The function used wpa_s->parent->conf to iterate the P2P networks and
update the configuration file. However, wpa_s->parent is not
necessarily the interface used to manage the P2P Device operations.

Fix this by accessing the configuration file of the interface initialized
to managed the P2P Device operations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ilan Peer 86b91c89af P2P: Fix wpas_p2p_set_own_freq_preference() to use P2P mgmt interface
wpas_p2p_set_own_freq_preference() accessed wpa_s->parent->conf to test
if p2p_ignore_shared_freq is set, but wpa_s->parent is not necessarily
the interface used to manage the P2P Device operations.

Fix this by accessing the configuration file of the interface
initialized to manage the P2P Device operations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Ben Rosenfeld 43677494fb P2P: Use the P2P Device management interface in wpas_p2p_remove_client()
As wpas_p2p_remove_client() is not necessarily called from the interface
used to manage the P2P Device operations, when removing a client, use
the P2P management interface to iterate over the saved networks and
remove the relevant entries form the P2P GO network blocks.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
9 years ago
Nishant Chaprana 7b642dc80b P2P: Add D-Bus FindStopped to notify P2P-FIND-STOPPED event
Add D-Bus notification mechanism of P2P-FIND-STOPPED event on
fi.w1.wpa_supplicant1.Interface.P2PDevice interface.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
9 years ago
Sunil Dutt d63f1419b5 P2P: Advertize cross connection to WLAN AP on a non-P2P interface
Commit 1c2aa04c96 ('P2P: Do not add P2P
IEs on P2P disabled interface') removed the P2P IEs from association on
non-P2P interface. However, an AP functioning as a P2P manager needs the
cross connection capability of the station (P2P Device). This needs to
be done to meet the P2P specification requirements even if the station
interface has p2p_disabled=1 in case P2P in general is enabled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years ago
Jouni Malinen 5678a2d89b P2P: Allow wpa_supplicant to start if social channels are not supported
It was possible for an nl80211-based driver to be determined to support
P2P even when the radio supports only the 5 GHz band. This resulted in
P2P initialization failing due to not being able to pick a social
channel and wpa_supplicant not starting. Fix this by not enabling P2P,
but still allowing wpa_supplicant initialization to complete.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years ago
Mikael Kanstrup 8b423edbd3 Declare all read only data structures as const
By analysing objdump output some read only structures were found in
.data section. To help compiler further optimize code declare these
as const.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
9 years ago
Avraham Stern 989e784601 P2P: Optimize scan frequencies list when re-joining a persistent group
When starting a P2P client to re-join a persistent group
(P2P_GROUP_ADD persistent=<id>), it is possible that the P2P GO was
already found in previous scans. Try to get the P2P GO operating
frequency from the scan results list so wpa_supplicant will initially
scan only the P2P GO known operating frequency.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years ago
Jouni Malinen 0f89328575 P2P: Move upper layer SD interaction into a separate file
wpa_supplicant/p2p_supplicant.c has reached almost 10000 lines in length
and was getting a bit inconvenient to edit, so start splitting it into
separate files.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years ago
Ahmad Kholaif d7f1aa8fd7 DFS offload: P2P changes for autonomous GO
Add P2P changes to allow bringing up P2P autonomous GO on a DFS channel
if DFS functionality is offloaded to the driver.

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