P2P: Use operating frequency from peer table as backup for join
The scan operation before Provision Discovery Request may not include the GO. However, we are likely to have the GO in our P2P peer table, so use that information to figure out the operating channel if BSS table entry is not available.
This commit is contained in:
parent
a482883f63
commit
f8d0131a11
3 changed files with 28 additions and 1 deletions
|
@ -498,6 +498,8 @@ static int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
|
|||
msg.ds_params ? *msg.ds_params : -1);
|
||||
}
|
||||
dev->listen_freq = freq;
|
||||
if (msg.group_info)
|
||||
dev->oper_freq = freq;
|
||||
dev->level = level;
|
||||
|
||||
if (msg.pri_dev_type)
|
||||
|
@ -3005,3 +3007,14 @@ void p2p_set_cross_connect(struct p2p_data *p2p, int enabled)
|
|||
p2p->cross_connect = enabled;
|
||||
/* TODO: may need to tear down any action group where we are GO(?) */
|
||||
}
|
||||
|
||||
|
||||
int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr)
|
||||
{
|
||||
struct p2p_device *dev = p2p_get_device_interface(p2p, iface_addr);
|
||||
if (dev == NULL)
|
||||
return -1;
|
||||
if (dev->oper_freq <= 0)
|
||||
return -1;
|
||||
return dev->oper_freq;
|
||||
}
|
||||
|
|
|
@ -1233,4 +1233,6 @@ void p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr);
|
|||
*/
|
||||
void p2p_set_cross_connect(struct p2p_data *p2p, int enabled);
|
||||
|
||||
int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
|
||||
|
||||
#endif /* P2P_H */
|
||||
|
|
|
@ -2316,6 +2316,7 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
|
|||
struct wpa_scan_results *scan_res)
|
||||
{
|
||||
struct wpa_bss *bss;
|
||||
int freq;
|
||||
|
||||
eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
|
||||
|
||||
|
@ -2328,14 +2329,25 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
|
|||
if (scan_res)
|
||||
wpas_p2p_scan_res_handler(wpa_s, scan_res);
|
||||
|
||||
freq = p2p_get_oper_freq(wpa_s->global->p2p,
|
||||
wpa_s->pending_join_iface_addr);
|
||||
if (freq >= 0) {
|
||||
wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
|
||||
"from P2P peer table: %d MHz", freq);
|
||||
}
|
||||
bss = wpa_bss_get_bssid(wpa_s, wpa_s->pending_join_iface_addr);
|
||||
if (bss) {
|
||||
freq = bss->freq;
|
||||
wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
|
||||
"from BSS table: %d MHz", freq);
|
||||
}
|
||||
if (freq > 0) {
|
||||
u16 method;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "P2P: Send Provision Discovery Request "
|
||||
"prior to joining an existing group (GO " MACSTR
|
||||
" freq=%u MHz)",
|
||||
MAC2STR(wpa_s->pending_join_dev_addr), bss->freq);
|
||||
MAC2STR(wpa_s->pending_join_dev_addr), freq);
|
||||
wpa_s->pending_pd_before_join = 1;
|
||||
|
||||
switch (wpa_s->pending_join_wps_method) {
|
||||
|
|
Loading…
Reference in a new issue