P2P: Improve p2p_prov_disc-auto robustness
Perform addition additional scan runs on the operating channel of the GO (if known from previous scan results) and fall back to initiate the PD for GO Negotiation if these additional scans do not detect the peer as GO. Signed-hostap: Sunil Dutt Undekari <duttus@codeaurora.org>
This commit is contained in:
parent
135b69cc7a
commit
84286a227b
2 changed files with 41 additions and 2 deletions
|
@ -39,6 +39,8 @@
|
||||||
*/
|
*/
|
||||||
#define P2P_MAX_JOIN_SCAN_ATTEMPTS 10
|
#define P2P_MAX_JOIN_SCAN_ATTEMPTS 10
|
||||||
|
|
||||||
|
#define P2P_AUTO_PD_SCAN_ATTEMPTS 5
|
||||||
|
|
||||||
#ifndef P2P_MAX_CLIENT_IDLE
|
#ifndef P2P_MAX_CLIENT_IDLE
|
||||||
/*
|
/*
|
||||||
* How many seconds to try to reconnect to the GO when connection in P2P client
|
* How many seconds to try to reconnect to the GO when connection in P2P client
|
||||||
|
@ -61,6 +63,7 @@ static struct wpa_supplicant *
|
||||||
wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
|
wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
|
||||||
int go);
|
int go);
|
||||||
static int wpas_p2p_join_start(struct wpa_supplicant *wpa_s);
|
static int wpas_p2p_join_start(struct wpa_supplicant *wpa_s);
|
||||||
|
static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq);
|
||||||
static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx);
|
static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx);
|
||||||
static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
|
static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
|
||||||
const u8 *dev_addr, enum p2p_wps_method wps_method,
|
const u8 *dev_addr, enum p2p_wps_method wps_method,
|
||||||
|
@ -2763,8 +2766,27 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
|
||||||
if (wpa_s->p2p_auto_pd) {
|
if (wpa_s->p2p_auto_pd) {
|
||||||
int join = wpas_p2p_peer_go(wpa_s,
|
int join = wpas_p2p_peer_go(wpa_s,
|
||||||
wpa_s->pending_join_dev_addr);
|
wpa_s->pending_join_dev_addr);
|
||||||
|
if (join == 0 &&
|
||||||
|
wpa_s->auto_pd_scan_retry < P2P_AUTO_PD_SCAN_ATTEMPTS) {
|
||||||
|
wpa_s->auto_pd_scan_retry++;
|
||||||
|
bss = wpa_bss_get_bssid(wpa_s,
|
||||||
|
wpa_s->pending_join_dev_addr);
|
||||||
|
if (bss) {
|
||||||
|
freq = bss->freq;
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Scan retry %d for "
|
||||||
|
"the peer " MACSTR " at %d MHz",
|
||||||
|
wpa_s->auto_pd_scan_retry,
|
||||||
|
MAC2STR(wpa_s->
|
||||||
|
pending_join_dev_addr),
|
||||||
|
freq);
|
||||||
|
wpas_p2p_join_scan_req(wpa_s, freq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (join < 0)
|
if (join < 0)
|
||||||
join = 0;
|
join = 0;
|
||||||
|
|
||||||
wpa_s->p2p_auto_pd = 0;
|
wpa_s->p2p_auto_pd = 0;
|
||||||
wpa_s->pending_pd_use = join ? AUTO_PD_JOIN : AUTO_PD_GO_NEG;
|
wpa_s->pending_pd_use = join ? AUTO_PD_JOIN : AUTO_PD_GO_NEG;
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Auto PD with " MACSTR " join=%d",
|
wpa_printf(MSG_DEBUG, "P2P: Auto PD with " MACSTR " join=%d",
|
||||||
|
@ -2915,13 +2937,13 @@ start:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
|
static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq)
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = eloop_ctx;
|
|
||||||
int ret;
|
int ret;
|
||||||
struct wpa_driver_scan_params params;
|
struct wpa_driver_scan_params params;
|
||||||
struct wpabuf *wps_ie, *ies;
|
struct wpabuf *wps_ie, *ies;
|
||||||
size_t ielen;
|
size_t ielen;
|
||||||
|
int freqs[2] = { 0, 0 };
|
||||||
|
|
||||||
os_memset(¶ms, 0, sizeof(params));
|
os_memset(¶ms, 0, sizeof(params));
|
||||||
|
|
||||||
|
@ -2954,6 +2976,10 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
|
||||||
params.p2p_probe = 1;
|
params.p2p_probe = 1;
|
||||||
params.extra_ies = wpabuf_head(ies);
|
params.extra_ies = wpabuf_head(ies);
|
||||||
params.extra_ies_len = wpabuf_len(ies);
|
params.extra_ies_len = wpabuf_len(ies);
|
||||||
|
if (freq > 0) {
|
||||||
|
freqs[0] = freq;
|
||||||
|
params.freqs = freqs;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run a scan to update BSS table and start Provision Discovery once
|
* Run a scan to update BSS table and start Provision Discovery once
|
||||||
|
@ -2975,6 +3001,13 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = eloop_ctx;
|
||||||
|
wpas_p2p_join_scan_req(wpa_s, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
|
static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
|
||||||
const u8 *dev_addr, enum p2p_wps_method wps_method,
|
const u8 *dev_addr, enum p2p_wps_method wps_method,
|
||||||
int auto_join)
|
int auto_join)
|
||||||
|
@ -3798,8 +3831,13 @@ int wpas_p2p_prov_disc(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
|
||||||
wpa_s->p2p_auto_pd = 1;
|
wpa_s->p2p_auto_pd = 1;
|
||||||
wpa_s->p2p_auto_join = 0;
|
wpa_s->p2p_auto_join = 0;
|
||||||
wpa_s->pending_pd_before_join = 0;
|
wpa_s->pending_pd_before_join = 0;
|
||||||
|
wpa_s->auto_pd_scan_retry = 0;
|
||||||
wpas_p2p_stop_find(wpa_s);
|
wpas_p2p_stop_find(wpa_s);
|
||||||
wpa_s->p2p_join_scan_count = 0;
|
wpa_s->p2p_join_scan_count = 0;
|
||||||
|
os_get_time(&wpa_s->p2p_auto_started);
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Auto PD started at %ld.%06ld",
|
||||||
|
wpa_s->p2p_auto_started.sec,
|
||||||
|
wpa_s->p2p_auto_started.usec);
|
||||||
wpas_p2p_join_scan(wpa_s, NULL);
|
wpas_p2p_join_scan(wpa_s, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,6 +481,7 @@ struct wpa_supplicant {
|
||||||
u8 pending_join_dev_addr[ETH_ALEN];
|
u8 pending_join_dev_addr[ETH_ALEN];
|
||||||
int pending_join_wps_method;
|
int pending_join_wps_method;
|
||||||
int p2p_join_scan_count;
|
int p2p_join_scan_count;
|
||||||
|
int auto_pd_scan_retry;
|
||||||
int force_long_sd;
|
int force_long_sd;
|
||||||
u16 pending_pd_config_methods;
|
u16 pending_pd_config_methods;
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Reference in a new issue