P2P: Show persistent group info on P2P_PEER data
Add "persistent=<network id>" line to P2P_PEER ctrl_iface data if a persistent group credentials are available for this peer. This makes it easier for external programs to figure out when a persistent group could be re-invoked with this peer. For now, this information is only available on the P2P client, but similar information can be added for GO once a list of P2P clients is maintained with the persistent group data. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
b3ffc80b8c
commit
87f841a140
3 changed files with 27 additions and 1 deletions
|
@ -2989,6 +2989,7 @@ static int p2p_ctrl_peer(struct wpa_supplicant *wpa_s, char *cmd,
|
||||||
const struct p2p_peer_info *info;
|
const struct p2p_peer_info *info;
|
||||||
char *pos, *end;
|
char *pos, *end;
|
||||||
char devtype[WPS_DEV_TYPE_BUFSIZE];
|
char devtype[WPS_DEV_TYPE_BUFSIZE];
|
||||||
|
struct wpa_ssid *ssid;
|
||||||
|
|
||||||
if (!wpa_s->global->p2p)
|
if (!wpa_s->global->p2p)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3042,9 +3043,17 @@ static int p2p_ctrl_peer(struct wpa_supplicant *wpa_s, char *cmd,
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += res;
|
pos += res;
|
||||||
|
|
||||||
|
ssid = wpas_p2p_get_persistent(wpa_s, info->p2p_device_addr);
|
||||||
|
if (ssid) {
|
||||||
|
res = os_snprintf(pos, end - pos, "persistent=%d\n", ssid->id);
|
||||||
|
if (res < 0 || res >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += res;
|
||||||
|
}
|
||||||
|
|
||||||
res = p2p_get_peer_info_txt(info, pos, end - pos);
|
res = p2p_get_peer_info_txt(info, pos, end - pos);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return -1;
|
return pos - buf;
|
||||||
pos += res;
|
pos += res;
|
||||||
|
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
|
|
|
@ -4260,3 +4260,18 @@ void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
|
||||||
wpas_p2p_group_formation_timeout(wpa_s->parent, NULL);
|
wpas_p2p_group_formation_timeout(wpa_s->parent, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
|
||||||
|
const u8 *addr)
|
||||||
|
{
|
||||||
|
struct wpa_ssid *s;
|
||||||
|
|
||||||
|
for (s = wpa_s->conf->ssid; s; s = s->next) {
|
||||||
|
if (s->disabled == 2 &&
|
||||||
|
os_memcmp(s->bssid, addr, ETH_ALEN) == 0)
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -131,5 +131,7 @@ void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s,
|
||||||
int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s);
|
int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s);
|
||||||
void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
|
void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid);
|
struct wpa_ssid *ssid);
|
||||||
|
struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
|
||||||
|
const u8 *addr);
|
||||||
|
|
||||||
#endif /* P2P_SUPPLICANT_H */
|
#endif /* P2P_SUPPLICANT_H */
|
||||||
|
|
Loading…
Reference in a new issue