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>
This commit is contained in:
Jouni Malinen 2015-08-02 19:25:41 +03:00
parent d4e597959c
commit 9f59fe8dc8
2 changed files with 8 additions and 10 deletions

View file

@ -287,9 +287,6 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
os_memset(wpa_s->bssid, 0, ETH_ALEN); os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
sme_clear_on_disassoc(wpa_s); sme_clear_on_disassoc(wpa_s);
#ifdef CONFIG_P2P
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
#endif /* CONFIG_P2P */
wpa_s->current_bss = NULL; wpa_s->current_bss = NULL;
wpa_s->assoc_freq = 0; wpa_s->assoc_freq = 0;

View file

@ -946,6 +946,8 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
else else
wpa_drv_deinit_p2p_cli(wpa_s); wpa_drv_deinit_p2p_cli(wpa_s);
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
return 0; return 0;
} }
@ -1780,6 +1782,7 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
wpa_s->show_group_started = 0; wpa_s->show_group_started = 0;
wpa_s->p2p_go_group_formation_completed = 0; wpa_s->p2p_go_group_formation_completed = 0;
wpa_s->group_formation_reported = 0; wpa_s->group_formation_reported = 0;
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
wpa_config_set_network_defaults(ssid); wpa_config_set_network_defaults(ssid);
ssid->temporary = 1; ssid->temporary = 1;
@ -3391,12 +3394,7 @@ struct wpa_supplicant * wpas_get_p2p_client_iface(struct wpa_supplicant *wpa_s,
{ {
for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) { for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
struct wpa_ssid *ssid = wpa_s->current_ssid; struct wpa_ssid *ssid = wpa_s->current_ssid;
if (ssid == NULL) if (ssid && (ssid->mode != WPAS_MODE_INFRA || !ssid->p2p_group))
continue;
if (ssid->mode != WPAS_MODE_INFRA)
continue;
if (wpa_s->wpa_state != WPA_COMPLETED &&
wpa_s->wpa_state != WPA_GROUP_HANDSHAKE)
continue; continue;
if (os_memcmp(wpa_s->go_dev_addr, peer_dev_addr, ETH_ALEN) == 0) if (os_memcmp(wpa_s->go_dev_addr, peer_dev_addr, ETH_ALEN) == 0)
return wpa_s; return wpa_s;
@ -5084,8 +5082,10 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
} }
if_addr = wpa_s->pending_interface_addr; if_addr = wpa_s->pending_interface_addr;
} else } else {
if_addr = wpa_s->own_addr; if_addr = wpa_s->own_addr;
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
}
if (auth) { if (auth) {
if (wpas_p2p_auth_go_neg(wpa_s, peer_addr, wps_method, if (wpas_p2p_auth_go_neg(wpa_s, peer_addr, wps_method,
@ -5609,6 +5609,7 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
ssid = wpa_config_add_network(wpa_s->conf); ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL) if (ssid == NULL)
return -1; return -1;
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
wpa_config_set_network_defaults(ssid); wpa_config_set_network_defaults(ssid);
ssid->temporary = 1; ssid->temporary = 1;
ssid->proto = WPA_PROTO_RSN; ssid->proto = WPA_PROTO_RSN;