mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
Document wpa_s->scan_req
Use an enum with documented values to make it easier to understand how wpa_s->scan_req is used. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
215ae884d6
commit
4115303bbe
@ -36,7 +36,7 @@ static const struct autoscan_ops * autoscan_modules[] = {
|
||||
|
||||
static void request_scan(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
|
||||
if (wpa_supplicant_req_sched_scan(wpa_s))
|
||||
wpa_supplicant_req_scan(wpa_s, wpa_s->scan_interval, 0);
|
||||
|
@ -5094,14 +5094,14 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
||||
((wpa_s->wpa_state <= WPA_SCANNING) ||
|
||||
(wpa_s->wpa_state == WPA_COMPLETED))) {
|
||||
wpa_s->normal_scans = 0;
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
} else if (wpa_s->sched_scanning) {
|
||||
wpa_printf(MSG_DEBUG, "Stop ongoing "
|
||||
"sched_scan to allow requested "
|
||||
"full scan to proceed");
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "Ongoing scan action - "
|
||||
|
@ -1313,7 +1313,7 @@ DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
|
||||
} else if (params.freqs && params.freqs[0]) {
|
||||
wpa_supplicant_trigger_scan(wpa_s, ¶ms);
|
||||
} else {
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
} else if (!os_strcmp(type, "active")) {
|
||||
|
@ -331,7 +331,7 @@ DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
|
||||
DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
return wpas_dbus_new_success_reply(message);
|
||||
}
|
||||
|
@ -1964,7 +1964,7 @@ int interworking_select(struct wpa_supplicant *wpa_s, int auto_select)
|
||||
wpa_printf(MSG_DEBUG, "Interworking: Start scan for network "
|
||||
"selection");
|
||||
wpa_s->scan_res_handler = interworking_scan_res_handler;
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
|
||||
return 0;
|
||||
|
@ -505,7 +505,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = eloop_ctx;
|
||||
struct wpa_ssid *ssid;
|
||||
int scan_req = 0, ret;
|
||||
enum scan_req_type scan_req = NORMAL_SCAN_REQ;
|
||||
int ret;
|
||||
struct wpabuf *extra_ie = NULL;
|
||||
struct wpa_driver_scan_params params;
|
||||
struct wpa_driver_scan_params *scan_params;
|
||||
@ -517,14 +518,14 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
if (wpa_s->disconnected && !wpa_s->scan_req) {
|
||||
if (wpa_s->disconnected && wpa_s->scan_req == NORMAL_SCAN_REQ) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Disconnected - do not scan");
|
||||
wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wpa_supplicant_enabled_networks(wpa_s) &&
|
||||
!wpa_s->scan_req) {
|
||||
wpa_s->scan_req == NORMAL_SCAN_REQ) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");
|
||||
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
|
||||
#ifdef CONFIG_P2P
|
||||
@ -572,7 +573,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
||||
}
|
||||
|
||||
scan_req = wpa_s->scan_req;
|
||||
wpa_s->scan_req = 0;
|
||||
wpa_s->scan_req = NORMAL_SCAN_REQ;
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
|
||||
@ -589,7 +590,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
||||
goto scan;
|
||||
}
|
||||
|
||||
if (scan_req != 2 && wpa_s->connect_without_scan) {
|
||||
if (scan_req != MANUAL_SCAN_REQ && wpa_s->connect_without_scan) {
|
||||
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
|
||||
if (ssid == wpa_s->connect_without_scan)
|
||||
break;
|
||||
@ -627,7 +628,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (scan_req != 2 && wpa_s->conf->ap_scan == 2) {
|
||||
if (scan_req != MANUAL_SCAN_REQ && wpa_s->conf->ap_scan == 2) {
|
||||
wpa_s->connect_without_scan = NULL;
|
||||
wpa_s->prev_scan_wildcard = 0;
|
||||
wpa_supplicant_assoc_try(wpa_s, ssid);
|
||||
@ -762,7 +763,7 @@ scan:
|
||||
* station interface when we are not configured to prefer station
|
||||
* connection and a concurrent operation is already in process.
|
||||
*/
|
||||
if (wpa_s->scan_for_connection && !scan_req &&
|
||||
if (wpa_s->scan_for_connection && scan_req == NORMAL_SCAN_REQ &&
|
||||
!scan_params->freqs && !params.freqs &&
|
||||
wpas_is_p2p_prioritized(wpa_s) &&
|
||||
!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
|
||||
|
@ -1322,7 +1322,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
|
||||
(ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
|
||||
/* Use ap_scan==1 style network selection to find the network
|
||||
*/
|
||||
wpa_s->scan_req = 2;
|
||||
wpa_s->scan_req = MANUAL_SCAN_REQ;
|
||||
wpa_s->reassociate = 1;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
return;
|
||||
@ -2413,7 +2413,7 @@ static struct wpa_supplicant * wpa_supplicant_alloc(void)
|
||||
wpa_s = os_zalloc(sizeof(*wpa_s));
|
||||
if (wpa_s == NULL)
|
||||
return NULL;
|
||||
wpa_s->scan_req = 1;
|
||||
wpa_s->scan_req = INITIAL_SCAN_REQ;
|
||||
wpa_s->scan_interval = 5;
|
||||
wpa_s->new_connection = 1;
|
||||
wpa_s->parent = wpa_s;
|
||||
|
@ -397,8 +397,36 @@ struct wpa_supplicant {
|
||||
|
||||
struct wpa_blacklist *blacklist;
|
||||
|
||||
int scan_req; /* manual scan request; this forces a scan even if there
|
||||
* are no enabled networks in the configuration */
|
||||
/**
|
||||
* scan_req - Type of the scan request
|
||||
*/
|
||||
enum scan_req_type {
|
||||
/**
|
||||
* NORMAL_SCAN_REQ - Normal scan request
|
||||
*
|
||||
* This is used for scans initiated by wpa_supplicant to find an
|
||||
* AP for a connection.
|
||||
*/
|
||||
NORMAL_SCAN_REQ,
|
||||
|
||||
/**
|
||||
* INITIAL_SCAN_REQ - Initial scan request
|
||||
*
|
||||
* This is used for the first scan on an interface to force at
|
||||
* least one scan to be run even if the configuration does not
|
||||
* include any enabled networks.
|
||||
*/
|
||||
INITIAL_SCAN_REQ,
|
||||
|
||||
/**
|
||||
* MANUAL_SCAN_REQ - Manual scan request
|
||||
*
|
||||
* This is used for scans where the user request a scan or
|
||||
* a specific wpa_supplicant operation (e.g., WPS) requires scan
|
||||
* to be run.
|
||||
*/
|
||||
MANUAL_SCAN_REQ
|
||||
} scan_req;
|
||||
int scan_runs; /* number of scan runs since WPS was started */
|
||||
int *next_scan_freqs;
|
||||
int scan_interval; /* time in sec between scans to find suitable AP */
|
||||
|
Loading…
Reference in New Issue
Block a user