[PATCH] Fix a channel-to-frequency transformation in ieee80211_chan_to_freq()

Jouni Malinen j at w1.fi
Sun Feb 19 04:38:10 PST 2017


On Fri, Feb 17, 2017 at 03:54:56PM +0900, Siwon Kang wrote:
> The function ieee80211_chan_to_freq() is supposed to return -1 if the
> specified channel is unknown. However, current if-conditional statements
> do not catch a few wrong combination. For example, {"US", 81, 13} for
> country code, operating class, channel, respectively should
> return -1 because op_class 81 is not in the list and channel 13 is not
> allowed but currently returns 2472 as if it is global.
> 
> This patch removes 'if (freq > 0)' to prevent from stepping over when an
> input op_class is out of the list of a country then finally going to
> ieee80211_chan_to_freq_global(). Instead, it returns result of
> sub-function directly which is correct.

Does this fix something externally observable? It looks like the current
design of the function uses the global table as a backup path on
purpose. As such, I would rather not modify this unless there is a
clearly identifiable misbehavior and/or no chances of breaking some
existing use cases.

> - int freq;
> + if (country_match(us_op_class_cc, country))

In addition, this is whitespace damaged (tabs converted to a single
space), so I cannot apply it.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list