aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-04-09 14:37:55 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-04-09 14:37:55 +0000
commit64e2eeb91c60ffb4858684b7ca98ac9eefb0c69b (patch)
tree8ca3b1349f88a6dcf7a53eda9b2dba74f89f792c /package/network/utils
parent0e46f3a0532bea6f0f8ebbad49c989bedbe0eff9 (diff)
downloadupstream-64e2eeb91c60ffb4858684b7ca98ac9eefb0c69b.tar.gz
upstream-64e2eeb91c60ffb4858684b7ca98ac9eefb0c69b.tar.bz2
upstream-64e2eeb91c60ffb4858684b7ca98ac9eefb0c69b.zip
iwinfo: fix frequency/channel and channel/frequency conversions to properly implement 802.11j
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36292 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/utils')
-rw-r--r--package/network/utils/iwinfo/Makefile2
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_nl80211.c31
2 files changed, 20 insertions, 13 deletions
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
index f8a92dac4b..23f3f38cb4 100644
--- a/package/network/utils/iwinfo/Makefile
+++ b/package/network/utils/iwinfo/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo
-PKG_RELEASE:=39
+PKG_RELEASE:=40
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := \
diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
index 819845ad1d..2a2bb66dfe 100644
--- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c
+++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
@@ -346,23 +346,30 @@ static int nl80211_freq2channel(int freq)
{
if (freq == 2484)
return 14;
-
- if (freq < 2484)
+ else if (freq < 2484)
return (freq - 2407) / 5;
-
- return (freq / 5) - 1000;
+ else if (freq >= 4910 && freq <= 4980)
+ return (freq - 4000) / 5;
+ else
+ return (freq - 5000) / 5;
}
static int nl80211_channel2freq(int channel, const char *band)
{
- if (channel == 14)
- return 2484;
-
- if ((channel < 14) && (!band || band[0] != 'a'))
- return (channel * 5) + 2407;
-
- if (channel > 0)
- return (1000 + channel) * 5;
+ if (!band || band[0] != 'a')
+ {
+ if (channel == 14)
+ return 2484;
+ else if (channel < 14)
+ return (channel * 5) + 2407;
+ }
+ else
+ {
+ if (channel >= 182 && channel <= 196)
+ return (channel * 5) + 4000;
+ else
+ return (channel * 5) + 5000;
+ }
return 0;
}