[PATCH 1/3] hostapd: Split up channel checking into helpers

Jouni Malinen j
Sun Aug 25 08:36:17 PDT 2013


On Fri, Aug 23, 2013 at 09:19:22AM +0200, Michal Kazior wrote:
> This splits up the channel checking upon initialization
> into a few helpers. This should make this a bit easier
> to follow. This also paves the way for some initial
> ACS entry code.

Thanks, applied with some fixes:

> diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
> @@ -634,6 +634,87 @@ int hostapd_check_ht_capab(struct hostapd_iface *iface)
> +static int hostapd_is_usable_chan(struct hostapd_iface *iface,
> +				  int channel, int primary)
> +{
> +	int i;
> +	struct hostapd_channel_data *chan;
> +
> +	for (i = 0; i < iface->current_mode->num_channels; i++) {
> +		chan = &iface->current_mode->channels[i];
> +		if (chan->chan == iface->conf->channel) {

I'd assume this comparison was supposed to use the channel argument to
the function instead of iface->conf->channel to make this work with
secondary channel.

> +static int hostapd_is_usable_chans(struct hostapd_iface *iface)
> +	if (!hostapd_is_usable_chan(iface, iface->conf->secondary_channel, 0))
> +		return 0;

And this needs to calculate the actual secondary channel since
iface->conf->secondary_channel is -1, 0, or 1.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list