[PATCH] hostapd: allow disabling background radar

Janusz Dziedzic janusz.dziedzic at gmail.com
Tue Apr 12 00:26:29 PDT 2022


pon., 11 kwi 2022 o 23:59 <greearb at candelatech.com> napisał(a):
>
> From: Ben Greear <greearb at candelatech.com>
>
> To work around buggy drivers and/or for any other user preference.
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>
> ---
>  hostapd/config_file.c | 2 ++
>  hostapd/hostapd.conf  | 5 +++++
>  src/ap/ap_config.c    | 1 +
>  src/ap/ap_config.h    | 1 +
>  src/ap/dfs.c          | 3 ++-
>  5 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/hostapd/config_file.c b/hostapd/config_file.c
> index 81bfb6ef7..998529bcc 100644
> --- a/hostapd/config_file.c
> +++ b/hostapd/config_file.c
> @@ -3210,6 +3210,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
>                 conf->acs_freq_list_present = 1;
>         } else if (os_strcmp(buf, "acs_exclude_6ghz_non_psc") == 0) {
>                 conf->acs_exclude_6ghz_non_psc = atoi(pos);
> +       } else if (os_strcmp(buf, "disable_background_radar") == 0) {
> +               conf->disable_background_radar = atoi(pos);
>         } else if (os_strcmp(buf, "min_tx_power") == 0) {
>                 int val = atoi(pos);
>
> diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> index fb2a3e83e..07fc625cb 100644
> --- a/hostapd/hostapd.conf
> +++ b/hostapd/hostapd.conf
> @@ -225,6 +225,11 @@ channel=1
>  # Default behavior is to include all PSC and non-PSC channels.
>  #acs_exclude_6ghz_non_psc=1
>
> +# Disable background radar feature, even if radio supports it.
> +# 0:  Leave active (default)
> +# 1:  Disable it.
> +#disable_background_radar=1
> +
>  # Set minimum permitted max TX power (in dBm) for ACS and DFS channel selection.
>  # (default 0, i.e., not constraint)
>  #min_tx_power=20
> diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
> index f33a25a18..3cae18626 100644
> --- a/src/ap/ap_config.c
> +++ b/src/ap/ap_config.c
> @@ -250,6 +250,7 @@ struct hostapd_config * hostapd_config_defaults(void)
>         conf->ap_table_max_size = 255;
>         conf->ap_table_expiration_time = 60;
>         conf->track_sta_max_age = 180;
> +       conf->disable_background_radar = 0;
>
>  #ifdef CONFIG_TESTING_OPTIONS
>         conf->ignore_probe_probability = 0.0;
> diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
> index d1f387221..4ff0382c4 100644
> --- a/src/ap/ap_config.h
> +++ b/src/ap/ap_config.h
> @@ -974,6 +974,7 @@ struct hostapd_config {
>         u8 min_tx_power;
>         enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
>         int acs_exclude_6ghz_non_psc;
> +       int disable_background_radar;
>         enum {
>                 LONG_PREAMBLE = 0,
>                 SHORT_PREAMBLE = 1
> diff --git a/src/ap/dfs.c b/src/ap/dfs.c
> index 2c92e1dd3..9384b0bca 100644
> --- a/src/ap/dfs.c
> +++ b/src/ap/dfs.c
> @@ -34,7 +34,8 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
>
>  static bool dfs_use_radar_background(struct hostapd_iface *iface)
>  {
> -       return iface->drv_flags2 & WPA_DRIVER_RADAR_BACKGROUND;
> +       return (iface->drv_flags2 & WPA_DRIVER_RADAR_BACKGROUND) &&
> +               !iface->conf->disable_background_radar;
>  }
>

Thanks Ben. Looks good :)

Maybe we should also add param to cli chan_switch command:
 - use bgcac / use legacy (then we can decide in runtime)
 - don't switch after bgcac completed - simple EU DFS channels cleanup

BR
Janusz



More information about the Hostap mailing list