mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
bgscan: Add global bgscan configuration
This option can be used to globally configure bgscan parameters for all the network blocks. Note that this configuration will not override a network block specific bgscan settings, but will only be used in case that the network block does not have a valid bgscan configuration. Signed-hostap: Haim Dreyfuss <haim.dreyfuss@intel.com>
This commit is contained in:
parent
5061a301e5
commit
3139270903
@ -31,9 +31,9 @@ static const struct bgscan_ops * bgscan_modules[] = {
|
||||
};
|
||||
|
||||
|
||||
int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||
int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
|
||||
const char *name)
|
||||
{
|
||||
const char *name = ssid->bgscan;
|
||||
const char *params;
|
||||
size_t nlen;
|
||||
int i;
|
||||
@ -41,7 +41,7 @@ int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||
|
||||
bgscan_deinit(wpa_s);
|
||||
if (name == NULL)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
params = os_strchr(name, ':');
|
||||
if (params == NULL) {
|
||||
|
@ -29,7 +29,8 @@ struct bgscan_ops {
|
||||
|
||||
#ifdef CONFIG_BGSCAN
|
||||
|
||||
int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
|
||||
int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
|
||||
const char *name);
|
||||
void bgscan_deinit(struct wpa_supplicant *wpa_s);
|
||||
int bgscan_notify_scan(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_scan_results *scan_res);
|
||||
@ -41,7 +42,7 @@ void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above,
|
||||
#else /* CONFIG_BGSCAN */
|
||||
|
||||
static inline int bgscan_init(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
struct wpa_ssid *ssid, const char name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2848,6 +2848,24 @@ static int wpa_global_config_parse_str(const struct global_parse_data *data,
|
||||
}
|
||||
|
||||
|
||||
static int wpa_config_process_bgscan(const struct global_parse_data *data,
|
||||
struct wpa_config *config, int line,
|
||||
const char *pos)
|
||||
{
|
||||
size_t len;
|
||||
char *tmp;
|
||||
|
||||
tmp = wpa_config_parse_string(pos, &len);
|
||||
if (tmp == NULL) {
|
||||
wpa_printf(MSG_ERROR, "Line %d: failed to parse %s",
|
||||
line, data->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return wpa_global_config_parse_str(data, config, line, tmp);
|
||||
}
|
||||
|
||||
|
||||
static int wpa_global_config_parse_bin(const struct global_parse_data *data,
|
||||
struct wpa_config *config, int line,
|
||||
const char *pos)
|
||||
@ -3209,6 +3227,7 @@ static const struct global_parse_data global_fields[] = {
|
||||
#endif /* CONFIG_CTRL_IFACE */
|
||||
{ INT_RANGE(eapol_version, 1, 2), 0 },
|
||||
{ INT(ap_scan), 0 },
|
||||
{ FUNC(bgscan), 0 },
|
||||
{ INT(disable_scan_offload), 0 },
|
||||
{ INT(fast_reauth), 0 },
|
||||
{ STR(opensc_engine_path), 0 },
|
||||
|
@ -328,6 +328,18 @@ struct wpa_config {
|
||||
*/
|
||||
int ap_scan;
|
||||
|
||||
/**
|
||||
* bgscan - Background scan and roaming parameters or %NULL if none
|
||||
*
|
||||
* This is an optional set of parameters for background scanning and
|
||||
* roaming within a network (ESS). For more detailed information see
|
||||
* ssid block documentation.
|
||||
*
|
||||
* The variable defines default bgscan behavior for all BSS station
|
||||
* networks except for those which have their own bgscan configuration.
|
||||
*/
|
||||
char *bgscan;
|
||||
|
||||
/**
|
||||
* disable_scan_offload - Disable automatic offloading of scan requests
|
||||
*
|
||||
|
@ -570,14 +570,22 @@ const char * wpa_supplicant_state_txt(enum wpa_states state)
|
||||
|
||||
static void wpa_supplicant_start_bgscan(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan)
|
||||
name = wpa_s->current_ssid->bgscan;
|
||||
else
|
||||
name = wpa_s->conf->bgscan;
|
||||
if (name == NULL)
|
||||
return;
|
||||
if (wpas_driver_bss_selection(wpa_s))
|
||||
return;
|
||||
if (wpa_s->current_ssid == wpa_s->bgscan_ssid)
|
||||
return;
|
||||
|
||||
bgscan_deinit(wpa_s);
|
||||
if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) {
|
||||
if (bgscan_init(wpa_s, wpa_s->current_ssid)) {
|
||||
if (wpa_s->current_ssid) {
|
||||
if (bgscan_init(wpa_s, wpa_s->current_ssid, name)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize "
|
||||
"bgscan");
|
||||
/*
|
||||
|
@ -550,6 +550,10 @@ fast_reauth=1
|
||||
# <long interval>[:<database file name>]"
|
||||
# bgscan="learn:30:-45:300:/etc/wpa_supplicant/network1.bgscan"
|
||||
#
|
||||
# This option can also be set outside of all network blocks for the bgscan
|
||||
# parameter to apply for all the networks that have no specific bgscan
|
||||
# parameter.
|
||||
#
|
||||
# proto: list of accepted protocols
|
||||
# WPA = WPA/IEEE 802.11i/D3.0
|
||||
# RSN = WPA2/IEEE 802.11i (also WPA2 can be used as an alias for RSN)
|
||||
|
Loading…
Reference in New Issue
Block a user