Fix persistent P2P connection failure in case channel list changes
P2P persistent connection may fail due to 802.11d channel change event invalidating support of the operating frequency sent in the invitation request, before receiving the invitation response. If the operating frequency is invalid at the time the invitation response is processed and there is no forced frequency provided by user, allow frequency re-selection. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
0547124d47
commit
062a7c0d67
4 changed files with 19 additions and 21 deletions
|
@ -4391,7 +4391,7 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, ht40, vht,
|
return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, ht40, vht,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
|
||||||
if (ssid == NULL || ssid->disabled != 2)
|
if (ssid == NULL || ssid->disabled != 2)
|
||||||
goto inv_args;
|
goto inv_args;
|
||||||
|
|
||||||
if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, 0,
|
if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, 0, 0,
|
||||||
NULL, 0)) {
|
NULL, 0)) {
|
||||||
reply = wpas_dbus_error_unknown_error(
|
reply = wpas_dbus_error_unknown_error(
|
||||||
message,
|
message,
|
||||||
|
|
|
@ -3055,7 +3055,7 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
|
||||||
if (s) {
|
if (s) {
|
||||||
int go = s->mode == WPAS_MODE_P2P_GO;
|
int go = s->mode == WPAS_MODE_P2P_GO;
|
||||||
wpas_p2p_group_add_persistent(
|
wpas_p2p_group_add_persistent(
|
||||||
wpa_s, s, go, go ? op_freq : 0, 0, 0, NULL,
|
wpa_s, s, go, 0, go ? op_freq : 0, 0, 0, NULL,
|
||||||
go ? P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0);
|
go ? P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0);
|
||||||
} else if (bssid) {
|
} else if (bssid) {
|
||||||
wpa_s->user_initiated_pd = 0;
|
wpa_s->user_initiated_pd = 0;
|
||||||
|
@ -3168,7 +3168,6 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = ctx;
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
int freq;
|
|
||||||
|
|
||||||
if (bssid) {
|
if (bssid) {
|
||||||
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
|
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
|
||||||
|
@ -3224,17 +3223,10 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
|
||||||
"starting persistent group");
|
"starting persistent group");
|
||||||
os_sleep(0, 50000);
|
os_sleep(0, 50000);
|
||||||
|
|
||||||
freq = wpa_s->p2p_persistent_go_freq;
|
|
||||||
if (neg_freq > 0 && ssid->mode == WPAS_MODE_P2P_GO &&
|
|
||||||
freq_included(channels, neg_freq)) {
|
|
||||||
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use frequence %d MHz from invitation for GO mode",
|
|
||||||
neg_freq);
|
|
||||||
freq = neg_freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
wpas_p2p_group_add_persistent(wpa_s, ssid,
|
wpas_p2p_group_add_persistent(wpa_s, ssid,
|
||||||
ssid->mode == WPAS_MODE_P2P_GO,
|
ssid->mode == WPAS_MODE_P2P_GO,
|
||||||
freq,
|
wpa_s->p2p_persistent_go_freq,
|
||||||
|
neg_freq,
|
||||||
wpa_s->p2p_go_ht40, wpa_s->p2p_go_vht,
|
wpa_s->p2p_go_ht40, wpa_s->p2p_go_vht,
|
||||||
channels,
|
channels,
|
||||||
ssid->mode == WPAS_MODE_P2P_GO ?
|
ssid->mode == WPAS_MODE_P2P_GO ?
|
||||||
|
@ -5174,12 +5166,12 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid, int addr_allocated,
|
struct wpa_ssid *ssid, int addr_allocated,
|
||||||
int freq, int ht40, int vht,
|
int force_freq, int neg_freq, int ht40,
|
||||||
const struct p2p_channels *channels,
|
int vht, const struct p2p_channels *channels,
|
||||||
int connection_timeout)
|
int connection_timeout)
|
||||||
{
|
{
|
||||||
struct p2p_go_neg_results params;
|
struct p2p_go_neg_results params;
|
||||||
int go = 0;
|
int go = 0, freq;
|
||||||
|
|
||||||
if (ssid->disabled != 2 || ssid->ssid == NULL)
|
if (ssid->disabled != 2 || ssid->ssid == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -5205,9 +5197,15 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
||||||
if (ssid->mode != WPAS_MODE_P2P_GO)
|
if (ssid->mode != WPAS_MODE_P2P_GO)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
freq = wpas_p2p_select_go_freq(wpa_s, freq);
|
if (force_freq > 0) {
|
||||||
|
freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
|
||||||
if (freq < 0)
|
if (freq < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
|
||||||
|
if (freq < 0 || (freq > 0 && !freq_included(channels, freq)))
|
||||||
|
freq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (wpas_p2p_init_go_params(wpa_s, ¶ms, freq, ht40, vht, channels))
|
if (wpas_p2p_init_go_params(wpa_s, ¶ms, freq, ht40, vht, channels))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -36,8 +36,8 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
|
||||||
int freq, int ht40, int vht);
|
int freq, int ht40, int vht);
|
||||||
int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid, int addr_allocated,
|
struct wpa_ssid *ssid, int addr_allocated,
|
||||||
int freq, int ht40, int vht,
|
int force_freq, int neg_freq, int ht40,
|
||||||
const struct p2p_channels *channels,
|
int vht, const struct p2p_channels *channels,
|
||||||
int connection_timeout);
|
int connection_timeout);
|
||||||
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid);
|
struct wpa_ssid *ssid);
|
||||||
|
|
Loading…
Reference in a new issue