P2P: Provide group SSID, if specified, to P2P Client join step

At least one of the wpas_p2p_connect() callers (NFC join case) already
had access to the Group SSID. Pass that information through
wpas_p2p_connect() to wpas_p2p_join() so that the join operation can
filter out incorrect groups more easily.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-12-30 19:08:51 +02:00 committed by Jouni Malinen
parent 438be60153
commit 70e0cb33f2
4 changed files with 23 additions and 13 deletions

View file

@ -5008,7 +5008,7 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method, new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
persistent_group, automatic, join, persistent_group, automatic, join,
auth, go_intent, freq, freq2, persistent_id, auth, go_intent, freq, freq2, persistent_id,
pd, ht40, vht, max_oper_chwidth); pd, ht40, vht, max_oper_chwidth, NULL, 0);
if (new_pin == -2) { if (new_pin == -2) {
os_memcpy(buf, "FAIL-CHANNEL-UNAVAILABLE\n", 25); os_memcpy(buf, "FAIL-CHANNEL-UNAVAILABLE\n", 25);
return 25; return 25;

View file

@ -583,7 +583,7 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method, new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
persistent_group, 0, join, authorize_only, persistent_group, 0, join, authorize_only,
go_intent, freq, 0, -1, 0, 0, 0, 0); go_intent, freq, 0, -1, 0, 0, 0, 0, NULL, 0);
if (new_pin >= 0) { if (new_pin >= 0) {
char npin[9]; char npin[9];

View file

@ -4779,7 +4779,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
wpa_s->p2p_pd_before_go_neg, wpa_s->p2p_pd_before_go_neg,
wpa_s->p2p_go_ht40, wpa_s->p2p_go_ht40,
wpa_s->p2p_go_vht, wpa_s->p2p_go_vht,
wpa_s->p2p_go_max_oper_chwidth); wpa_s->p2p_go_max_oper_chwidth,
NULL, 0);
return; return;
} }
@ -5303,6 +5304,8 @@ exit_free:
* @vht: Start GO with VHT support * @vht: Start GO with VHT support
* @vht_chwidth: Channel width supported by GO operating with VHT support * @vht_chwidth: Channel width supported by GO operating with VHT support
* (VHT_CHANWIDTH_*). * (VHT_CHANWIDTH_*).
* @group_ssid: Specific Group SSID for join or %NULL if not set
* @group_ssid_len: Length of @group_ssid in octets
* Returns: 0 or new PIN (if pin was %NULL) on success, -1 on unspecified * Returns: 0 or new PIN (if pin was %NULL) on success, -1 on unspecified
* failure, -2 on failure due to channel not currently available, * failure, -2 on failure due to channel not currently available,
* -3 if forced channel is not supported * -3 if forced channel is not supported
@ -5312,7 +5315,8 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
int persistent_group, int auto_join, int join, int auth, int persistent_group, int auto_join, int join, int auth,
int go_intent, int freq, unsigned int vht_center_freq2, int go_intent, int freq, unsigned int vht_center_freq2,
int persistent_id, int pd, int ht40, int vht, int persistent_id, int pd, int ht40, int vht,
unsigned int vht_chwidth) unsigned int vht_chwidth, const u8 *group_ssid,
size_t group_ssid_len)
{ {
int force_freq = 0, pref_freq = 0; int force_freq = 0, pref_freq = 0;
int ret = 0, res; int ret = 0, res;
@ -5395,7 +5399,8 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
} }
wpa_s->user_initiated_pd = 1; wpa_s->user_initiated_pd = 1;
if (wpas_p2p_join(wpa_s, iface_addr, dev_addr, wps_method, if (wpas_p2p_join(wpa_s, iface_addr, dev_addr, wps_method,
auto_join, freq, NULL, 0) < 0) auto_join, freq,
group_ssid, group_ssid_len) < 0)
return -1; return -1;
return ret; return ret;
} }
@ -7773,7 +7778,7 @@ static int wpas_p2p_fallback_to_go_neg(struct wpa_supplicant *wpa_s,
wpa_s->p2p_pd_before_go_neg, wpa_s->p2p_pd_before_go_neg,
wpa_s->p2p_go_ht40, wpa_s->p2p_go_ht40,
wpa_s->p2p_go_vht, wpa_s->p2p_go_vht,
wpa_s->p2p_go_max_oper_chwidth); wpa_s->p2p_go_max_oper_chwidth, NULL, 0);
return ret; return ret;
} }
@ -8308,7 +8313,9 @@ static int wpas_p2p_nfc_join_group(struct wpa_supplicant *wpa_s,
return wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL, return wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL,
WPS_NFC, 0, 0, 1, 0, wpa_s->conf->p2p_go_intent, WPS_NFC, 0, 0, 1, 0, wpa_s->conf->p2p_go_intent,
params->go_freq, wpa_s->p2p_go_vht_center_freq2, params->go_freq, wpa_s->p2p_go_vht_center_freq2,
-1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth); -1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth,
params->go_ssid_len ? params->go_ssid : NULL,
params->go_ssid_len);
} }
@ -8385,7 +8392,8 @@ static int wpas_p2p_nfc_init_go_neg(struct wpa_supplicant *wpa_s,
return wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL, return wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL,
WPS_NFC, 0, 0, 0, 0, wpa_s->conf->p2p_go_intent, WPS_NFC, 0, 0, 0, 0, wpa_s->conf->p2p_go_intent,
forced_freq, wpa_s->p2p_go_vht_center_freq2, forced_freq, wpa_s->p2p_go_vht_center_freq2,
-1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth); -1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth,
NULL, 0);
} }
@ -8400,7 +8408,8 @@ static int wpas_p2p_nfc_resp_go_neg(struct wpa_supplicant *wpa_s,
res = wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL, res = wpas_p2p_connect(wpa_s, params->peer->p2p_device_addr, NULL,
WPS_NFC, 0, 0, 0, 1, wpa_s->conf->p2p_go_intent, WPS_NFC, 0, 0, 0, 1, wpa_s->conf->p2p_go_intent,
forced_freq, wpa_s->p2p_go_vht_center_freq2, forced_freq, wpa_s->p2p_go_vht_center_freq2,
-1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth); -1, 0, 1, 1, wpa_s->p2p_go_max_oper_chwidth,
NULL, 0);
if (res) if (res)
return res; return res;

View file

@ -34,10 +34,11 @@ struct wpa_supplicant * wpas_get_p2p_client_iface(struct wpa_supplicant *wpa_s,
const u8 *peer_dev_addr); const u8 *peer_dev_addr);
int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr, int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
const char *pin, enum p2p_wps_method wps_method, const char *pin, enum p2p_wps_method wps_method,
int persistent_group, int auto_join, int join, int persistent_group, int auto_join, int join, int auth,
int auth, int go_intent, int freq, int go_intent, int freq, unsigned int vht_center_freq2,
unsigned int vht_center_freq2, int persistent_id, int persistent_id, int pd, int ht40, int vht,
int pd, int ht40, int vht, unsigned int max_oper_chwidth); unsigned int vht_chwidth, const u8 *group_ssid,
size_t group_ssid_len);
int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s,
int freq, struct wpa_ssid *ssid); int freq, struct wpa_ssid *ssid);
int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group, int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,