P2P: Fix provisioning info clearing after successful WPS step
Previously, this provisioning info was cleared using the P2P Interface Address of the GO as the key. That did not always work in the case the where we joined an already running group. This could result in the next connection to that same GO skipping provision discovery. Fix this by finding the peer entry based on its P2P Device Address instead of the P2P Interface Address which may not always be set. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com> intended-for: hostap-1
This commit is contained in:
parent
9f85a37e03
commit
10531d2166
3 changed files with 17 additions and 9 deletions
|
@ -151,14 +151,14 @@ u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr)
|
void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr)
|
||||||
{
|
{
|
||||||
struct p2p_device *dev = NULL;
|
struct p2p_device *dev = NULL;
|
||||||
|
|
||||||
if (!iface_addr || !p2p)
|
if (!addr || !p2p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dev = p2p_get_device_interface(p2p, iface_addr);
|
dev = p2p_get_device(p2p, addr);
|
||||||
if (dev)
|
if (dev)
|
||||||
dev->wps_prov_info = 0;
|
dev->wps_prov_info = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1061,12 +1061,12 @@ u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr);
|
||||||
/**
|
/**
|
||||||
* p2p_clear_provisioning_info - Clear any stored provisioning info
|
* p2p_clear_provisioning_info - Clear any stored provisioning info
|
||||||
* @p2p: P2P module context from p2p_init()
|
* @p2p: P2P module context from p2p_init()
|
||||||
* @iface_addr: Peer P2P Interface Address
|
* @iface_addr: Peer P2P Device Address
|
||||||
*
|
*
|
||||||
* This function is used to clear stored WPS provisioning info for the given
|
* This function is used to clear stored WPS provisioning info for the given
|
||||||
* peer.
|
* peer.
|
||||||
*/
|
*/
|
||||||
void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr);
|
void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr);
|
||||||
|
|
||||||
|
|
||||||
/* Event notifications from lower layer driver operations */
|
/* Event notifications from lower layer driver operations */
|
||||||
|
|
|
@ -2446,7 +2446,7 @@ void wpas_p2p_deinit(struct wpa_supplicant *wpa_s)
|
||||||
/* Clear any stored provisioning info */
|
/* Clear any stored provisioning info */
|
||||||
p2p_clear_provisioning_info(
|
p2p_clear_provisioning_info(
|
||||||
wpa_s->global->p2p,
|
wpa_s->global->p2p,
|
||||||
wpa_s->go_params->peer_interface_addr);
|
wpa_s->go_params->peer_device_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_free(wpa_s->go_params);
|
os_free(wpa_s->go_params);
|
||||||
|
@ -3482,14 +3482,22 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
|
void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
|
||||||
int registrar)
|
int registrar)
|
||||||
{
|
{
|
||||||
|
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||||
|
|
||||||
if (!wpa_s->p2p_in_provisioning) {
|
if (!wpa_s->p2p_in_provisioning) {
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Ignore WPS success event - P2P "
|
wpa_printf(MSG_DEBUG, "P2P: Ignore WPS success event - P2P "
|
||||||
"provisioning not in progress");
|
"provisioning not in progress");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear any stored provisioning info */
|
if (ssid && ssid->mode == WPAS_MODE_INFRA) {
|
||||||
p2p_clear_provisioning_info(wpa_s->global->p2p, peer_addr);
|
u8 go_dev_addr[ETH_ALEN];
|
||||||
|
os_memcpy(go_dev_addr, wpa_s->bssid, ETH_ALEN);
|
||||||
|
wpas_p2p_persistent_group(wpa_s, go_dev_addr, ssid->ssid,
|
||||||
|
ssid->ssid_len);
|
||||||
|
/* Clear any stored provisioning info */
|
||||||
|
p2p_clear_provisioning_info(wpa_s->global->p2p, go_dev_addr);
|
||||||
|
}
|
||||||
|
|
||||||
eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent,
|
eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -3513,7 +3521,7 @@ void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s,
|
||||||
if (wpa_s->go_params) {
|
if (wpa_s->go_params) {
|
||||||
p2p_clear_provisioning_info(
|
p2p_clear_provisioning_info(
|
||||||
wpa_s->global->p2p,
|
wpa_s->global->p2p,
|
||||||
wpa_s->go_params->peer_interface_addr);
|
wpa_s->go_params->peer_device_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
wpas_notify_p2p_wps_failed(wpa_s, fail);
|
wpas_notify_p2p_wps_failed(wpa_s, fail);
|
||||||
|
|
Loading…
Reference in a new issue