[PATCH 6/9] DFS: introduce hostapd_dfs_request_channel_switch routine

Jouni Malinen j at w1.fi
Thu Mar 3 14:54:39 PST 2022


On Mon, Dec 20, 2021 at 04:48:21PM +0100, Lorenzo Bianconi wrote:
> This is a preliminary patch to add Channel Switch Announcement for
> background radar detection.

> diff --git a/src/ap/dfs.c b/src/ap/dfs.c
> @@ -940,6 +940,85 @@ int hostapd_is_dfs_chan_available(struct hostapd_iface *iface)
>  
> +static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface,

> +	struct hostapd_hw_modes *cmode = iface->current_mode;
> +	int ieee80211_mode = IEEE80211_MODE_AP, err, i;

That i needs to be unsigned int (like it was in the function from which
it was moved to here) to avoid a compiler warning.

> +	u8 new_vht_oper_chwidth;

> +	new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
> +	hostapd_set_oper_chwidth(iface->conf,
> +				 hostapd_get_oper_chwidth(iface->conf));

This looks quite strange.. hostapd_dfs_start_channel_switch() used
current_vht_oper_chwidth to store the current value from beginning of
the function and restored it at this location. The new version in this
helper function seems to something strange, or well, nothing. That does
not feel correct.

>  static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
>  {
> -	unsigned int i;

That's where i was unsigned..

> -	u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);

And that's where the current value is picked at the beginning of
hostapd_dfs_start_channel_switch().

> -	new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
> -	hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth);

And this looks quite different compared to what was in the new helper
function.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list