P2P: Save group common frequencies
Once a P2P GO interface is configured, save the group common frequencies, as this can be useful later for channel selection considerations during channel switch, etc. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
f64d3f0e15
commit
20beb96ff9
2 changed files with 49 additions and 0 deletions
|
@ -610,6 +610,10 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
|
|||
os_free(wpa_s->go_params);
|
||||
wpa_s->go_params = NULL;
|
||||
|
||||
os_free(wpa_s->p2p_group_common_freqs);
|
||||
wpa_s->p2p_group_common_freqs = NULL;
|
||||
wpa_s->p2p_group_common_freqs_num = 0;
|
||||
|
||||
wpa_s->waiting_presence_resp = 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "P2P: Remove temporary group network");
|
||||
|
@ -1298,6 +1302,40 @@ static void wpas_p2p_add_psk_list(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
|
||||
|
||||
static void p2p_go_dump_common_freqs(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Common group frequencies (len=%u):",
|
||||
wpa_s->p2p_group_common_freqs_num);
|
||||
|
||||
for (i = 0; i < wpa_s->p2p_group_common_freqs_num; i++)
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "freq[%u]: %d",
|
||||
i, wpa_s->p2p_group_common_freqs[i]);
|
||||
}
|
||||
|
||||
|
||||
static void p2p_go_save_group_common_freqs(struct wpa_supplicant *wpa_s,
|
||||
struct p2p_go_neg_results *params)
|
||||
{
|
||||
unsigned int i, len = int_array_len(wpa_s->go_params->freq_list);
|
||||
|
||||
wpa_s->p2p_group_common_freqs_num = 0;
|
||||
os_free(wpa_s->p2p_group_common_freqs);
|
||||
wpa_s->p2p_group_common_freqs = os_calloc(len, sizeof(int));
|
||||
if (!wpa_s->p2p_group_common_freqs)
|
||||
return;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!wpa_s->go_params->freq_list[i])
|
||||
break;
|
||||
wpa_s->p2p_group_common_freqs[i] =
|
||||
wpa_s->go_params->freq_list[i];
|
||||
}
|
||||
wpa_s->p2p_group_common_freqs_num = i;
|
||||
}
|
||||
|
||||
|
||||
static void p2p_go_configured(void *ctx, void *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
|
@ -1305,6 +1343,9 @@ static void p2p_go_configured(void *ctx, void *data)
|
|||
struct wpa_ssid *ssid;
|
||||
int network_id = -1;
|
||||
|
||||
p2p_go_save_group_common_freqs(wpa_s, params);
|
||||
p2p_go_dump_common_freqs(wpa_s);
|
||||
|
||||
ssid = wpa_s->current_ssid;
|
||||
if (ssid && ssid->mode == WPAS_MODE_P2P_GO) {
|
||||
wpa_printf(MSG_DEBUG, "P2P: Group setup without provisioning");
|
||||
|
@ -4153,6 +4194,10 @@ void wpas_p2p_deinit(struct wpa_supplicant *wpa_s)
|
|||
wpabuf_free(wpa_s->p2p_oob_dev_pw);
|
||||
wpa_s->p2p_oob_dev_pw = NULL;
|
||||
|
||||
os_free(wpa_s->p2p_group_common_freqs);
|
||||
wpa_s->p2p_group_common_freqs = NULL;
|
||||
wpa_s->p2p_group_common_freqs_num = 0;
|
||||
|
||||
/* TODO: remove group interface from the driver if this wpa_s instance
|
||||
* is on top of a P2P group interface */
|
||||
}
|
||||
|
|
|
@ -779,6 +779,10 @@ struct wpa_supplicant {
|
|||
* formation */
|
||||
u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
|
||||
u8 p2p_ip_addr_info[3 * 4];
|
||||
|
||||
/* group common frequencies */
|
||||
int *p2p_group_common_freqs;
|
||||
unsigned int p2p_group_common_freqs_num;
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
struct wpa_ssid *bgscan_ssid;
|
||||
|
|
Loading…
Reference in a new issue