mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
P2P: Use 500 ms search delay by default during concurrent operations
If the p2p_find command is used without the delay parameter, a 500 ms default search delay will now be used when any interface using the same radio is in an concurrent operation. "p2p_find delay=0" can be used to enforce the old behavior in such a case if needed. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
37448ede31
commit
05a77b3b46
@ -2958,7 +2958,7 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
|
|||||||
enum p2p_discovery_type type = P2P_FIND_START_WITH_FULL;
|
enum p2p_discovery_type type = P2P_FIND_START_WITH_FULL;
|
||||||
u8 dev_id[ETH_ALEN], *_dev_id = NULL;
|
u8 dev_id[ETH_ALEN], *_dev_id = NULL;
|
||||||
char *pos;
|
char *pos;
|
||||||
unsigned int search_delay = 0;
|
unsigned int search_delay;
|
||||||
|
|
||||||
if (os_strstr(cmd, "type=social"))
|
if (os_strstr(cmd, "type=social"))
|
||||||
type = P2P_FIND_ONLY_SOCIAL;
|
type = P2P_FIND_ONLY_SOCIAL;
|
||||||
@ -2977,7 +2977,8 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
|
|||||||
if (pos) {
|
if (pos) {
|
||||||
pos += 6;
|
pos += 6;
|
||||||
search_delay = atoi(pos);
|
search_delay = atoi(pos);
|
||||||
}
|
} else
|
||||||
|
search_delay = wpas_p2p_search_delay(wpa_s);
|
||||||
|
|
||||||
return wpas_p2p_find(wpa_s, timeout, type, 0, NULL, _dev_id,
|
return wpas_p2p_find(wpa_s, timeout, type, 0, NULL, _dev_id,
|
||||||
search_delay);
|
search_delay);
|
||||||
|
@ -57,6 +57,10 @@
|
|||||||
#define P2P_MAX_INITIAL_CONN_WAIT 10
|
#define P2P_MAX_INITIAL_CONN_WAIT 10
|
||||||
#endif /* P2P_MAX_INITIAL_CONN_WAIT */
|
#endif /* P2P_MAX_INITIAL_CONN_WAIT */
|
||||||
|
|
||||||
|
#ifndef P2P_CONCURRENT_SEARCH_DELAY
|
||||||
|
#define P2P_CONCURRENT_SEARCH_DELAY 500
|
||||||
|
#endif /* P2P_CONCURRENT_SEARCH_DELAY */
|
||||||
|
|
||||||
enum p2p_group_removal_reason {
|
enum p2p_group_removal_reason {
|
||||||
P2P_GROUP_REMOVAL_UNKNOWN,
|
P2P_GROUP_REMOVAL_UNKNOWN,
|
||||||
P2P_GROUP_REMOVAL_SILENT,
|
P2P_GROUP_REMOVAL_SILENT,
|
||||||
@ -4982,3 +4986,41 @@ int wpas_p2p_scan_no_go_seen(struct wpa_supplicant *wpa_s)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
const char *rn, *rn2;
|
||||||
|
struct wpa_supplicant *ifs;
|
||||||
|
|
||||||
|
if (wpa_s->wpa_state > WPA_SCANNING) {
|
||||||
|
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search delay due to "
|
||||||
|
"concurrent operation",
|
||||||
|
P2P_CONCURRENT_SEARCH_DELAY);
|
||||||
|
return P2P_CONCURRENT_SEARCH_DELAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wpa_s->driver->get_radio_name)
|
||||||
|
return 0;
|
||||||
|
rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv);
|
||||||
|
if (rn == NULL || rn[0] == '\0')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
|
||||||
|
if (ifs == wpa_s || !ifs->driver->get_radio_name)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rn2 = ifs->driver->get_radio_name(ifs->drv_priv);
|
||||||
|
if (!rn2 || os_strcmp(rn, rn2) != 0)
|
||||||
|
continue;
|
||||||
|
if (ifs->wpa_state > WPA_SCANNING) {
|
||||||
|
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search "
|
||||||
|
"delay due to concurrent operation on "
|
||||||
|
"interface %s",
|
||||||
|
P2P_CONCURRENT_SEARCH_DELAY, ifs->ifname);
|
||||||
|
return P2P_CONCURRENT_SEARCH_DELAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -143,5 +143,6 @@ void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
|
|||||||
int wpas_p2p_scan_no_go_seen(struct wpa_supplicant *wpa_s);
|
int wpas_p2p_scan_no_go_seen(struct wpa_supplicant *wpa_s);
|
||||||
int wpas_p2p_get_ht40_mode(struct wpa_supplicant *wpa_s,
|
int wpas_p2p_get_ht40_mode(struct wpa_supplicant *wpa_s,
|
||||||
struct hostapd_hw_modes *mode, u8 channel);
|
struct hostapd_hw_modes *mode, u8 channel);
|
||||||
|
unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
#endif /* P2P_SUPPLICANT_H */
|
#endif /* P2P_SUPPLICANT_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user