[PATCH] Toggle to flush BSS entries when interface is disabled
Jong Wook Kim
jongwook at google.com
Tue Mar 6 17:08:38 PST 2018
That is a good point as in most cases, we do want BSS entries flushed.
We found this driver_nl80211->ignore_if_down_event value
that if set, prevents EVENT_INTERFACE_DISABLED from being
sent out when the interface goes down (as a result, there would be no
BSS flush when down). This is currently used when we are changing
the driver mode.
We are thinking about simply setting this value before bringing the interface
down for MAC change. Do you have any feedback for doing things this way?
Thanks.
Jong
On Mon, Mar 5, 2018 at 7:31 PM, Dan Williams <dcbw at redhat.com> wrote:
> On Mon, 2018-03-05 at 17:01 -0800, Jong Wook Kim wrote:
>> Currently, bss entries are cleared out whenever the interface goes
>> down.
>> This is the right thing to do most of the time, but this flush is
>> unnecessary
>> when we are intentionally bringing the interface down and up as it
>> takes
>> ~3 seconds to re-scan all channels and fill up the bss entries again.
>>
>> For Connected MAC Randomization, we have to bring the interface down,
>> change MAC address, bring the interface back up, and then start
>> associating
>> (and we are observing ~3 scan delay here due to re-scanning).
>> Thus, we would like to have an option to not flush the cache when the
>> interface is disabled.
>>
>> Do let me know if there would be a better way to avoid this delay.
>> Thanks.
>
> Possibly a cleaner option would be to add a "change this interface's
> MAC address to X" control interface call to the supplicant that takes
> an optional parameter that says whether or not to flush BSSes. (not
> quite sure how it would suppress the netlink events that would just end
> up back in wpa_supplicant_event though).
>
> The toggle in the patch below is a pretty big hammer, since it will
> happen for every EVENT_INTERFACE_DISABLED, whether that's intended or
> not. There are clearly cases where it would be useful to flush the BSS
> list on interface down.
>
> Dan
>
>> Signed-off-by: Jong Wook Kim <jongwook at google.com>
>> ---
>> wpa_supplicant/config.c | 1 +
>> wpa_supplicant/config.h | 8 ++++++++
>> wpa_supplicant/config_file.c | 3 +++
>> wpa_supplicant/events.c | 4 +++-
>> 4 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
>> index a22434cb..87161481 100644
>> --- a/wpa_supplicant/config.c
>> +++ b/wpa_supplicant/config.c
>> @@ -4642,6 +4642,7 @@ static const struct global_parse_data
>> global_fields[] = {
>> { INT(gas_rand_addr_lifetime), 0 },
>> { INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
>> { INT_RANGE(dpp_config_processing, 0, 2), 0 },
>> + { INT_RANGE(bss_no_flush_when_down, 0, 1), 0 },
>> };
>>
>> #undef FUNC
>> diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
>> index 07b67e6b..c63ef1d6 100644
>> --- a/wpa_supplicant/config.h
>> +++ b/wpa_supplicant/config.h
>> @@ -1418,6 +1418,14 @@ struct wpa_config {
>> * profile automatically
>> */
>> int dpp_config_processing;
>> +
>> + /**
>> + * bss_no_flush_when_down - Whether to flush BSS entries when the
>> interface is disabled
>> + *
>> + * 0 = Flush BSS entries when the interface becomes disabled
>> (Default)
>> + * 1 = Do not flush BSS entries when the interface becomes disabled
>> + */
>> + int bss_no_flush_when_down;
>> };
>>
>>
>> diff --git a/wpa_supplicant/config_file.c
>> b/wpa_supplicant/config_file.c
>> index 1fd432d1..d219c3da 100644
>> --- a/wpa_supplicant/config_file.c
>> +++ b/wpa_supplicant/config_file.c
>> @@ -1490,6 +1490,9 @@ static void wpa_config_write_global(FILE *f,
>> struct wpa_config *config)
>> if (config->dpp_config_processing)
>> fprintf(f, "dpp_config_processing=%d\n",
>> config->dpp_config_processing);
>> + if (config->bss_no_flush_when_down)
>> + fprintf(f, "bss_no_flush_when_down=%d\n",
>> + config->bss_no_flush_when_down);
>>
>> }
>>
>> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
>> index 63cf7737..708c6fc3 100644
>> --- a/wpa_supplicant/events.c
>> +++ b/wpa_supplicant/events.c
>> @@ -4390,7 +4390,9 @@ void wpa_supplicant_event(void *ctx, enum
>> wpa_event_type event,
>> wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1);
>> }
>> wpa_supplicant_mark_disassoc(wpa_s);
>> - wpa_bss_flush(wpa_s);
>> + if (wpa_s->conf->bss_no_flush_when_down == 0)
>> + wpa_bss_flush(wpa_s);
>> +
>> radio_remove_works(wpa_s, NULL, 0);
>>
>> wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
>> _______________________________________________
>> Hostap mailing list
>> Hostap at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/hostap
More information about the Hostap
mailing list