iw: sync frequency to channel mapping with kernel
Use ieee80211_frequency_to_channel() and ieee80211_channel_to_frequency() as in
the current kernel. This is necessary to properly print the channel numbers for
4.9GHz channels which can be used in Japan.
Signed-off-by: Bruno Randolf <br1@einfach.org>
diff --git a/phy.c b/phy.c
index 7f8ce26..68f40f6 100644
--- a/phy.c
+++ b/phy.c
@@ -113,8 +113,11 @@
if (*end)
return 1;
- if (chan)
- freq = ieee80211_channel_to_frequency(freq);
+ if (chan) {
+ enum nl80211_band band;
+ band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
+ freq = ieee80211_channel_to_frequency(freq, band);
+ }
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);