path: root/wpa_supplicant/p2p_supplicant.c
Commit message (Collapse)AuthorAgeFilesLines
* D-Bus: Indicate whether created group is persistent or notNishant Chaprana2016-05-301-17/+12
| | | | | | | | | This adds an extra parameter in GroupStarted signal to indicate whether the created group is Persistent or not. It is similar to the [PERSISTENT] tag which comes in P2P-GROUP-STARTED over the control interface. Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
* P2PS: Allow P2P_CONNECT command for P2PS connection with/without PINPurushottam Kushwaha2016-05-191-0/+3
| | | | | | | | | | | | | This allows using P2PS config method with or without PIN for connection. wpa_supplicant should internally handle the default PIN "12345670" and shall also allow connection irrespective of PIN used in P2P_CONNECT. For example, 1. P2P_CONNECT 02:2a:fb:22:22:33 p2ps 2. P2P_CONNECT 02:2a:fb:22:22:33 xxxxxxxx p2ps Where the second one is maintained for backwards compatibility. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Do not enable P2P group processing for non-P2P AP modeJouni Malinen2016-05-141-1/+2
| | | | | | | | wpa_supplicant was starting P2P group processing for all AP mode interfaces in CONFIG_P2P=y builds. This is unnecessary and such operations should be enabled only for actual GO interfaces. Signed-off-by: Jouni Malinen <j@w1.fi>
* P2P: Copy config from p2pdev when not using dedicated group interfaceAndrei Otcheretianski2016-04-241-21/+12
| | | | | | | | | | | | | | | | | | | | When the P2P Device interface is used and an existing interface is used for P2P GO/Client, the P2P Device configuration was not cloned to the configuration of the existing interface. Thus, configuration parameters such as idle_group_time, etc., were not propagated to the P2P GO/Client interface. Handle this by copying all configuration parameters of the P2P device interface to the reused interface, with the following exceptions: 1. Copy the NFC key data only if it was not set in the configuration file. 2. The WPS string fields are set only if they were not previously set in the configuration of the destination interface (based on the assumption that these fields should be identical among all interfaces). Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
* P2P: Fix wpas_p2p_nfc_auth_join()Andrei Otcheretianski2016-04-241-9/+9
| | | | | | | | | Use the p2pdev pointer instead of the parent pointer to comply with the flows when a dedicated P2P Device interface is used and p2p_no_group_iface == 1 (in which case the parent of the reused interface isn't necessary the same as p2pdev). Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
* P2P: Trigger event when invitation is acceptedLior David2016-04-181-0/+19
| | | | | | | | | | Trigger an event when wpa_supplicant accepts an invitation to re-invoke a persistent group. Previously wpa_supplicant entered group formation without triggering any specific events and it could confuse clients, especially when operating with a driver that does not support concurrency between P2P and infrastructure connection. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Fix persistent group for 60 GHz networksLior David2016-03-251-3/+6
| | | | | | | | | | | Fix two problems with storage of 60 GHz P2P persistent groups: 1. pbss flag was not stored in the network block. 2. When recreating the persistent group from storage, in addition to the missing pbss flag, the pairwise_cipher and group_cipher were initialized to CCMP which does not work in 60 GHz since the default in 60 GHz should be GCMP. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Advertise IP Address Allocation only if it is enabled on GOJouni Malinen2016-03-201-0/+2
| | | | | | | | | | | | This group capability bit was previously added unconditionally which could result in the P2P Client assuming the functionality is available even though the GO would always reject the request (not reply to it with an assigned IP address) during the 4-way handshake. Fix this by advertising the capability only if the GO configuration allow IP address assignment to be completed. Signed-off-by: Jouni Malinen <j@w1.fi>
* P2P: Respect p2p_ignore_shared_freq on p2p_group_addEliad Peller2016-03-041-5/+5
| | | | | | | | Make sure wpas_p2p_init_go_params() respects the p2p_ignore_shared_freq configuration option. Choose currently used frequencies only if this option is not set, or if there are no unused channels left. Signed-off-by: Eliad Peller <eliad@wizery.com>
* P2P: Fix shared freq print in wpas_p2p_init_go_params()Eliad Peller2016-03-041-2/+2
| | | | | | | "freq" contains the forced frequency, not the selected one. Print the correct freq instead. Signed-off-by: Eliad Peller <eliad@wizery.com>
* P2P: Abort ongoing scan when p2p_find is stoppedBen Rosenfeld2016-03-031-0/+4
| | | | | | | When p2p_find is stopped, send request to the driver in order to cancel an ongoing scan if there is one. Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
* P2P: Add Dev Info attribute to Probe Request frames in 60 GHzLior David2016-03-031-3/+10
| | | | | | | | When building P2P IE for Probe Request frames in P2P scan, add the device information attribute if the 60 GHz band is included in the scan, since this is required by the P2P specification. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Change order of P2P IE and frequencies set upLior David2016-03-031-38/+38
| | | | | | | | | When setting up parameters for P2P scan, calculate the frequencies for the scan before calculating the scan IE. This is because the scan IE calculation may need information about the scan frequencies in use. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Support dedicated P2P_DEVICE without separate group interfaceLior David2016-02-271-30/+74
| | | | | | | | | | | Add support for drivers with dedicated P2P_DEVICE interface, but without group interface concurrency (only a single netdev is used). With such devices, wpa_supplicant tried to use the p2p_dev interface instead of the group interface and most P2P operations failed. Extend wpa_supplicant to use the primary interface instead of a separate group interface in such cases. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Add a separate pointer to the P2P Device instanceLior David2016-02-271-70/+70
| | | | | | | | | | | | | | | In many places in the code there was a reference to wpa_s->parent to get from group interface to p2p_dev interface. These places can break if P2P_DEVICE interface would need to be used with the primary interface as the group interface, since the parent of the primary interface points to itself and not the p2p_dev interface. Fix this by adding a separate "p2pdev" pointer to wpa_supplicant, it will be the same as parent pointer in most cases but whenever the primary interface is used as a group interface, change it to point to the correct p2p_dev interface. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* MBO: Add global operating class definitionsAvraham Stern2016-02-221-43/+10
| | | | | | | | | | Add definitions for global operating classes. These definitions will be used to construct supported operating classes information element. The operating classes definitions used locally for P2P module will be removed and included in the general operating classes definitions. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
* wpa_supplicant: Share a single get_mode() implementationAvraham Stern2016-02-211-15/+0
| | | | | | There is no need to duplicate this helper function in multiple files. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
* WPS: Use only os_get_random() for PIN generationNick Lowe2016-02-191-3/+16
| | | | | | | | | Remove the fallback dependency on os_random() when generating a WPS pin. This is exceptionally unlikely to ever be called as the call to os_get_random() is unlikely to fail. The intention is to facilitate future removal of os_random() as it uses a low quality PRNG. Signed-off-by: Nick Lowe <nick.lowe@lugatech.com>
* wpa_supplicant: Basic support for PBSS/PCPLior David2016-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | PBSS (Personal Basic Service Set) is a new BSS type for DMG networks. It is similar to infrastructure BSS, having an AP-like entity called PCP (PBSS Control Point), but it has few differences. PBSS support is mandatory for IEEE 802.11ad devices. Add a new "pbss" argument to network block. The argument is used in the following scenarios: 1. When network has mode=2 (AP), when pbss flag is set will start as a PCP instead of an AP. 2. When network has mode=0 (station), when pbss flag is set will connect to PCP instead of AP. The function wpa_scan_res_match() was modified to match BSS according to the pbss flag in the network block (wpa_ssid structure). When pbss flag is set it will match only PCPs, and when it is clear it will match only APs. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
* P2P: Stop offchannel TX wait on P2P_STOP_FIND/P2P_LISTENJouni Malinen2015-12-301-1/+5
| | | | | | | | | | | | | | Previously it was possible for the pending Action frame TX to be cleared, but the offchannel TX operation being left in wait state in the kernel. This would delay start of the next operation (e.g., that listen operation requested by P2P_LISTEN) until the wait time for the previously pending Action frame had expired. Optimize this by explicitly stopping any pending offchannel Action frame TX when clearing the internal offchannel TX state in wpas_p2p_clear_pending_action_tx(). Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Provide group SSID, if specified, to P2P Client join stepJouni Malinen2015-12-301-7/+16
| | | | | | | | | At least one of the wpas_p2p_connect() callers (NFC join case) already had access to the Group SSID. Pass that information through wpas_p2p_connect() to wpas_p2p_join() so that the join operation can filter out incorrect groups more easily. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Do not accept any GO BSS entry if SSID is specified for joinJouni Malinen2015-12-301-2/+1
| | | | | | | | | | Accept only a BSS entry matching the SSID when trying to find the operating channel of a GO during join operation for which the SSID was already specified. Previously, it could have been possible to pick an incorrect BSS entry if the new GO was not found in the latest scan and there was an older cached scan entry for the same BSSID. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Use join SSID in the skip-PD casesJouni Malinen2015-12-301-1/+2
| | | | | | | | | It was already possible to limit join operation to accept only a specific SSID. However, this constraint was not used when starting a P2P Client interface as a WPS Enrollee without going through a Provision Discovery exchange. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Do not accept any BSS entry for join if SSID is already knownJouni Malinen2015-12-301-2/+7
| | | | | | | | | | | Use wpa_bss_get() with the specific Group SSID instead of wpa_bss_get_bssid_latest() if the SSID is already known. This makes the P2P join operations more robust in case the frequency of the group was not yet known and the same P2P Interface Address may have been used in multiple group instances with an older group entry still present in the cached scan results. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Use group SSID, if known, for join operation even if no BSS entryJouni Malinen2015-12-301-0/+5
| | | | | | | | This allows the cases where a specific group SSID is known to filter out groups on the P2P Client even if the specific BSS entry for the target group is not yet available. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2PS: Add group SSID, if known, to the P2PS-PROV-DONE eventJouni Malinen2015-12-301-4/+14
| | | | | | | | | The new optional group_ssid=<hexdump> argument in the P2PS-PROV-DONE event can be used to help in identifying the exact group if there have been multiple groups with the same P2P Interface Address in short period of time. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2PS: Remove dead codeJouni Malinen2015-12-241-7/+0
| | | | | | | | | | | | Commit f8a80e39b33212992f88ce2e638193f81664230a ('P2PS: Change connection capability handling') added the identical P2PS_SETUP_CLIENT check into two places within p2ps_group_capability(). However, only the first one of these can be reached. In the second case, role can only have values 0 or P2PS_SETUP_NEW and as such, the P2PS_SETUP_CLIENT case is not possible. It looks like the first part of the commit is sufficient, so remove the dead code added by the second part. Signed-off-by: Jouni Malinen <j@w1.fi>
* P2P: Fix possible NULL pointer dereferenceAyala Beker2015-12-171-1/+2
| | | | | | | | Fix wpas_p2p_invite() to call p2p_set_own_pref_freq_list() after the NULL check, to avoid NULL pointer dereference if P2P initialization were to have failed or P2P module getting deinitialized. Signed-off-by: Ayala Beker <ayala.beker@intel.com>
* P2P: Fix re-invoked client interface completion on data connectionJouni Malinen2015-12-041-0/+2
| | | | | | | | | | | | This was already working for the case where a separate group interface is used due to the recent commit 328f49acfe961a212e89e750516d2e2cc320765f ('P2P: Complete group formation on client data connection'). However, the case of no separate group interface was used did not clear the interface state properly on data connection. Fix this by setting the group formation information in wpas_start_p2p_client(). Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Fix P2P_CANCEL for p2p_in_invitation caseJouni Malinen2015-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | Commit f05cee9714ae87d315d893699a536b60a5aa73a9 ('P2P: Clear p2p_in_invitation on cancel') added a wpas_p2p_cancel() case to call wpas_p2p_group_formation_failed() if wpa_s->p2p_in_invitation is set. This is done in a loop going through wpa_s->next pointers. However, the call here can result in removing the interface and freeing wpa_s. The following attempt to read wpa_s->next is from freed memory and that can result in process termination when using a separate P2P group interface and issuing P2P_CANCEL on a group that was started through re-invocation of a persistent group. The recent commit 328f49acfe961a212e89e750516d2e2cc320765f ('P2P: Complete group formation on client data connection') "fixed" this by accident since wpa_s->p2p_in_invitation gets cleared in the sequence that could hit this issue and this results in P2P_CANCEL getting rejected. However, the real bug here is in the loop that continues after possible wpa_s instance deletion. Fix that by breaking out of the loop. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Complete group formation on client data connectionJouni Malinen2015-11-301-0/+11
| | | | | | | | | | | | | | | | | This was already the case in the GO role where the first client connection is waited before marking wpa_s->p2p_go_group_formation_completed = 1 and clearing wpa_s->global->p2p_group_formation. However, in the P2P Client role, that was done already at the completion of the WPS exchange. This can be problematic since group formation timeout may still try to clear the group and with wpa_s->global->p2p_group_formation == NULL, the correct group interface may not be found. Fix this by postponing clearing of wpa_s->global->p2p_group_formation on the P2P Client side until the data connection has been completed and group is declared started. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Make p2p_go_configured() more robust against unexpected callsJouni Malinen2015-11-291-0/+9
| | | | | | | | | | | | | | | | A hwsim test sequence was able to hit a SIGSEGV in p2p_go_save_group_common_freqs() called by p2p_go_configured() callback in a case where a non-P2P AP mode operation is started in wpa_supplicant (wpas_ap_wep test case). This callback should not have happened for non-P2P case and the debug logs did not make it clear how this could happen. In addition, it is unclear how this could be reproduced. To avoid this type of issues, clear the wpa_s->ap_configured_cb pointer as soon as the first call to the function happens. In addition, verify that wpa_s->go_params is available before processing the GO configured callback. Signed-off-by: Jouni Malinen <j@w1.fi>
* P2P: Add support for VHT 80+80 MHz and 160 MHzAhmad Kholaif2015-11-251-21/+56
| | | | | | | | | The new max_oper_chwidth and freq2 arguments to P2P_CONNECT, P2P_INVITE, and P2P_GROUP_ADD control interface commands can be used to request larger VHT operating channel bandwidth to be used than the previously used maximum 80 MHz. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* nl80211: Add VHT 160 MHz channel flagsAhmad Kholaif2015-11-251-0/+80
| | | | | | | | | This extends the previous design that covered only the VHT 80 MHz cases for VHT channel flags. New functions are introduced to allow 160 MHz bandwidth cases to determine the center channel and check availability of a 160 MHz channel. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Define operating classes for VHT 80+80 and 160Ahmad Kholaif2015-11-251-1/+3
| | | | | | | This adds definitions for the global operating classes 129 and 130 for VHT 80+80 MHz and 160 MHz use cases. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Add a testing option to force P2P GO CSAIlan Peer2015-11-221-1/+15
| | | | | | | Add a testing option to force a P2P GO CSA on successful invitation to join an active P2P GO. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2P: Set p2p_go_wait_client in invitation_result() cbIlan Peer2015-11-221-1/+15
| | | | | | | | | | When an invitation to join an existing group is accepted by the peer device, set p2p_go_wait_client to the current time so that wpas_p2p_in_progress() would return != 0, thus preventing P2P CSA, scanning etc., that would interfere with the peer device connection. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2P: Clear send action work without waiting on find/stop/listenAvraham Stern2015-11-211-1/+2
| | | | | | | | | | | | | | When clearing pending TX action to start a new P2P operation like P2P_FIND or P2P_LISTEN, wpas_p2p_action_tx_clear() was used to clear the send action work. However, in cases where the action work has wait time, it is not cleared immediately but only after the wait time ends. This may cause delay in starting the P2P operation. Fix that by always clearing the send action work immediately on these P2P commands that result in immediate P2P state change and practically stopping a previous operation, if one was pending. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
* P2P: Add more debug prints for Action frame TX clearing stepsJouni Malinen2015-10-151-6/+25
| | | | | | | This makes it easier to analyze debug logs for issues related to multiple pending Action TX frames. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2PS: Fix persistent group reporting in wpas_p2ps_prov_complete()Max Stepanov2015-10-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | When one peer doesn't include a persistent group info in PD Request the other peer shouldn't report a persistent group usage with this peer even if such a persistent group exists locally. This condition could be violated in the previous implementation. In case a local persistent group exists and the wpas_p2ps_prov_complete() function is called with persist_ssid parameter set to NULL, wpa_supplicant reported P2PS-PROV-DONE with persist=<idx> instead of conncap=<role> parameter. This happened because the wpas_p2p_get_persistent() function was called without verification whether the persist_ssid was set to NULL. In this case the wpas_p2p_get_persistent() returns the first existing persistent group matching the P2P Device Address without verifying the group's SSID. After that the group ID is used as persist=<idx> parameter of P2PS-PROV-DONE event. Fix the issue by adding persist_ssid and persist_ssid_size verification as a condition for the wpas_p2p_get_persistent() call. Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
* P2PS: Indicate the chosen operating frequencyIlan Peer2015-10-111-5/+12
| | | | | | | | On successful P2P PD, report the chosen frequency in case the local device is going to be the P2P GO, so in can later be used to instantiate the new P2P GO, etc. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2PS: Add channel policy to PD RequestIlan Peer2015-10-111-22/+39
| | | | | | | | | | | | | | | | | Add operating channel selection and channel list processing similar to that done when building GO Negotiation Request, i.e., consider the currently used channels, configured channels, etc. P2PS introduces a flow where a responder needs to provide channel data without being previously aware of the current constraints, i.e., the channels currently in use by other interfaces. To handle this, extend the get_group_capability() callback to also handle channel selection aspects of group capabilities. In case there is an active P2P GO that is going to be used for the P2PS PD, force its current operating frequency in the PD attributes. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2PS: Change connection capability handlingIlan Peer2015-10-071-2/+19
| | | | | | | | | Change the connection capability handling so that in case there are no active roles, the peer has an active GO, and the advertisement supports operation as a client, the returned connection capability is set to client. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2PS: Re-factor p2ps_group_capability()Ilan Peer2015-10-071-35/+35
| | | | | | | | | | | | | The code was iterating all the interfaces, and for each interface iterated all the network blocks to count active P2P GO and P2P Client interfaces. Change the code to reuse wpas_p2p_get_go_group() to get a P2P GO interface and add wpas_p2p_get_cli_group() and use it to find a P2P Client interface, and use these objects when evaluating the group capability. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2PS: Re-factor wpas_p2p_get_go_group() and wpas_p2p_group_go_ssid()Ilan Peer2015-10-071-27/+27
| | | | | | | | | | | | | | Re-factor wpas_p2p_get_go_group() to: 1. Skip the dedicated P2P Device management interface if it is used. 2. Instead of iterating all the interface configured networks, only access the current_ssid pointer to check if the current interface is acting as a persistent P2P GO. To avoid code duplication, also re-factor wpas_p2p_group_go_ssid() to call wpas_p2p_get_go_group(). Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* Set channel and operating class in hostapd_fill_csa_settings()Luciano Coelho2015-10-031-15/+13
| | | | | | | | | | The CSA channel and operating class values need to be set for all types of channel switch (i.e., either if it's triggered by the control interfaces or due to the GO-follows-STA flow). To do so, move the code that sets them from the GO-follows-STA flow to the more generic hostapd_fill_csa_settings() function. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
* P2P: Implement P2P_GO_FREQ_MOVE_SCM_ECSA policyAndrei Otcheretianski2015-10-031-0/+42
| | | | | | | | Add new GO frequency move policy. The P2P_GO_FREQ_MOVE_SCM_ECSA prefers SCM if all the clients advertise eCSA support and the candidate frequency is one of the group common frequencies. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
* P2P: Trigger channel selection correctly during CSAAndrei Otcheretianski2015-10-031-0/+17
| | | | | | | | Do not consider moving GOs to a new channel if one of them is in the middle of CSA. In addition, call wpas_p2p_update_channel_list() after EVENT_CH_SWITCH is handled. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
* P2P: Relax wpas_p2p_init_go_params() for P2P GO CSAIlan Peer2015-10-031-8/+28
| | | | | | | | | | | | | | wpas_p2p_move_go_csa() uses wpas_p2p_init_p2p_params() to select the frequency to move to. However, it is possible that all the channels are already used, so the selection of a new frequency would fail, although the frequency used by the P2P GO should not be considered as used if it is the only one using it. To overcome this, allow the frequency selection to continue even if all the frequencies are in use, but the frequency used by the P2P GO is not used by any station interface. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
* P2P: Implement wpas_p2p_move_go_csa()Andrei Otcheretianski2015-10-031-3/+113
| | | | | | | | | Use channel switch mechanism to move a P2P GO to a new channel, when required. In order to be able to reconfigure the GO channel, split wpa_supplicant_conf_ap() function, so the frequency configuration part can be reused to find additional CSA settings. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>