mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
P2P: Add an option to specify group SSID in P2P_CONNECT join case
The new optional ssid=<hexdump> argument to P2P_CONNECT can be used to make P2P Client operations during join-an-existing-group more robust by filtering out scan results based on the SSID in addition to the P2P Device/Interface Address. This can help if the same MAC address has been used in multiple groups recently and the cached scan results may still include an older BSS. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
70e0cb33f2
commit
8edd9f1058
@ -151,6 +151,7 @@ join-a-group style PD instead of GO Negotiation style PD.
|
||||
p2p_connect <peer device address> <pbc|pin|PIN#|p2ps> [display|keypad|p2ps]
|
||||
[persistent|persistent=<network id>] [join|auth]
|
||||
[go_intent=<0..15>] [freq=<in MHz>] [ht40] [vht] [provdisc] [auto]
|
||||
[ssid=<hexdump>]
|
||||
|
||||
Start P2P group formation with a discovered P2P peer. This includes
|
||||
optional group owner negotiation, group interface setup, provisioning,
|
||||
@ -195,6 +196,12 @@ connection.
|
||||
out whether the peer device is operating as a GO and if so, use
|
||||
join-a-group operation rather than GO Negotiation.
|
||||
|
||||
"ssid=<hexdump>" can be used to specify the Group SSID for join
|
||||
operations. This allows the P2P Client interface to filter scan results
|
||||
based on SSID to avoid selecting an incorrect BSS entry in case the same
|
||||
P2P Device or Interface address have been used in multiple groups
|
||||
recently.
|
||||
|
||||
P2PS attribute changes to p2p_connect command:
|
||||
|
||||
P2PS supports two WPS provisioning methods namely PIN method and P2PS default.
|
||||
|
@ -4911,6 +4911,8 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
||||
int freq = 0;
|
||||
int pd;
|
||||
int ht40, vht, max_oper_chwidth, chwidth = 0, freq2 = 0;
|
||||
u8 _group_ssid[SSID_MAX_LEN], *group_ssid = NULL;
|
||||
size_t group_ssid_len = 0;
|
||||
|
||||
if (!wpa_s->global->p2p_init_wpa_s)
|
||||
return -1;
|
||||
@ -4923,7 +4925,7 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
||||
/* <addr> <"pbc" | "pin" | PIN> [label|display|keypad|p2ps]
|
||||
* [persistent|persistent=<network id>]
|
||||
* [join] [auth] [go_intent=<0..15>] [freq=<in MHz>] [provdisc]
|
||||
* [ht40] [vht] [auto] */
|
||||
* [ht40] [vht] [auto] [ssid=<hexdump>] */
|
||||
|
||||
if (hwaddr_aton(cmd, addr))
|
||||
return -1;
|
||||
@ -4983,6 +4985,22 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
||||
if (max_oper_chwidth < 0)
|
||||
return -1;
|
||||
|
||||
pos2 = os_strstr(pos, " ssid=");
|
||||
if (pos2) {
|
||||
char *end;
|
||||
|
||||
pos2 += 6;
|
||||
end = os_strchr(pos2, ' ');
|
||||
if (!end)
|
||||
group_ssid_len = os_strlen(pos2) / 2;
|
||||
else
|
||||
group_ssid_len = (end - pos2) / 2;
|
||||
if (group_ssid_len == 0 || group_ssid_len > SSID_MAX_LEN ||
|
||||
hexstr2bin(pos2, _group_ssid, group_ssid_len) < 0)
|
||||
return -1;
|
||||
group_ssid = _group_ssid;
|
||||
}
|
||||
|
||||
if (os_strncmp(pos, "pin", 3) == 0) {
|
||||
/* Request random PIN (to be displayed) and enable the PIN */
|
||||
wps_method = WPS_PIN_DISPLAY;
|
||||
@ -5008,7 +5026,8 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
|
||||
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
|
||||
persistent_group, automatic, join,
|
||||
auth, go_intent, freq, freq2, persistent_id,
|
||||
pd, ht40, vht, max_oper_chwidth, NULL, 0);
|
||||
pd, ht40, vht, max_oper_chwidth,
|
||||
group_ssid, group_ssid_len);
|
||||
if (new_pin == -2) {
|
||||
os_memcpy(buf, "FAIL-CHANNEL-UNAVAILABLE\n", 25);
|
||||
return 25;
|
||||
|
Loading…
Reference in New Issue
Block a user