summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/iwinfo/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-19 03:52:55 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-19 03:52:55 +0000
commit66736c857476550c68720a4cf933ab2f6d04031d (patch)
tree418d9e383c13ab15bba54a18d6948cdba1278287 /contrib/package/iwinfo/src
parentf01178a19a94abfd98442cec532fcd43e91009b0 (diff)
libiwinfo: add restricted flag for freqlist
Diffstat (limited to 'contrib/package/iwinfo/src')
-rw-r--r--contrib/package/iwinfo/src/iwinfo.h1
-rwxr-xr-xcontrib/package/iwinfo/src/iwinfo.lua5
-rw-r--r--contrib/package/iwinfo/src/iwinfo_lualib.c4
-rw-r--r--contrib/package/iwinfo/src/iwinfo_madwifi.c5
-rw-r--r--contrib/package/iwinfo/src/iwinfo_nl80211.c12
-rw-r--r--contrib/package/iwinfo/src/iwinfo_wext.c5
6 files changed, 23 insertions, 9 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo.h b/contrib/package/iwinfo/src/iwinfo.h
index 448655057..6d05289e9 100644
--- a/contrib/package/iwinfo/src/iwinfo.h
+++ b/contrib/package/iwinfo/src/iwinfo.h
@@ -66,6 +66,7 @@ struct iwinfo_txpwrlist_entry {
struct iwinfo_freqlist_entry {
uint8_t channel;
uint32_t mhz;
+ uint8_t restricted;
};
struct iwinfo_crypto_entry {
diff --git a/contrib/package/iwinfo/src/iwinfo.lua b/contrib/package/iwinfo/src/iwinfo.lua
index f7dbf42fd..76b9e4ad1 100755
--- a/contrib/package/iwinfo/src/iwinfo.lua
+++ b/contrib/package/iwinfo/src/iwinfo.lua
@@ -105,9 +105,10 @@ function print_freqlist(api, dev)
if fl and #fl > 0 then
for _, fe in ipairs(fl) do
- printf("%s %.3f GHz (Channel %d)",
+ printf("%s %.3f GHz (Channel %d)%s",
(cc == fe.channel) and "*" or " ",
- n(fe.mhz) / 1000, n(fe.channel))
+ n(fe.mhz) / 1000, n(fe.channel),
+ fe.restricted and " [restricted]" or "")
end
else
print("No frequency information available")
diff --git a/contrib/package/iwinfo/src/iwinfo_lualib.c b/contrib/package/iwinfo/src/iwinfo_lualib.c
index 312a3dae7..95600c865 100644
--- a/contrib/package/iwinfo/src/iwinfo_lualib.c
+++ b/contrib/package/iwinfo/src/iwinfo_lualib.c
@@ -671,6 +671,10 @@ static int iwinfo_L_freqlist(lua_State *L, int (*func)(const char *, char *, int
lua_pushinteger(L, e->channel);
lua_setfield(L, -2, "channel");
+ /* Restricted (DFS/TPC/Radar) */
+ lua_pushboolean(L, e->restricted);
+ lua_setfield(L, -2, "restricted");
+
lua_rawseti(L, -2, x);
}
}
diff --git a/contrib/package/iwinfo/src/iwinfo_madwifi.c b/contrib/package/iwinfo/src/iwinfo_madwifi.c
index 9c3bb2688..5289f42e0 100644
--- a/contrib/package/iwinfo/src/iwinfo_madwifi.c
+++ b/contrib/package/iwinfo/src/iwinfo_madwifi.c
@@ -805,8 +805,9 @@ int madwifi_get_freqlist(const char *ifname, char *buf, int *len)
for( i = 0; i < chans.ic_nchans; i++ )
{
- entry.mhz = chans.ic_chans[i].ic_freq;
- entry.channel = chans.ic_chans[i].ic_ieee;
+ entry.mhz = chans.ic_chans[i].ic_freq;
+ entry.channel = chans.ic_chans[i].ic_ieee;
+ entry.restricted = 0;
memcpy(&buf[bl], &entry, sizeof(struct iwinfo_freqlist_entry));
bl += sizeof(struct iwinfo_freqlist_entry);
diff --git a/contrib/package/iwinfo/src/iwinfo_nl80211.c b/contrib/package/iwinfo/src/iwinfo_nl80211.c
index ff30e0e94..6b980235e 100644
--- a/contrib/package/iwinfo/src/iwinfo_nl80211.c
+++ b/contrib/package/iwinfo/src/iwinfo_nl80211.c
@@ -1319,9 +1319,6 @@ int nl80211_get_freqlist(const char *ifname, char *buf, int *len)
[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
};
- if( !wext_get_freqlist(ifname, buf, len) )
- return 0;
-
req = nl80211_msg(ifname, NL80211_CMD_GET_WIPHY, 0);
if( req )
{
@@ -1340,9 +1337,18 @@ int nl80211_get_freqlist(const char *ifname, char *buf, int *len)
nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX,
nla_data(freq), nla_len(freq), freq_policy);
+ if( freqs[NL80211_FREQUENCY_ATTR_DISABLED] )
+ continue;
+
e->mhz = nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]);
e->channel = nl80211_freq2channel(e->mhz);
+ e->restricted = (
+ freqs[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] ||
+ freqs[NL80211_FREQUENCY_ATTR_NO_IBSS] ||
+ freqs[NL80211_FREQUENCY_ATTR_RADAR]
+ ) ? 1 : 0;
+
e++;
count++;
}
diff --git a/contrib/package/iwinfo/src/iwinfo_wext.c b/contrib/package/iwinfo/src/iwinfo_wext.c
index e9e79e375..298fd9317 100644
--- a/contrib/package/iwinfo/src/iwinfo_wext.c
+++ b/contrib/package/iwinfo/src/iwinfo_wext.c
@@ -444,8 +444,9 @@ int wext_get_freqlist(const char *ifname, char *buf, int *len)
for(i = 0; i < range.num_frequency; i++)
{
- entry.mhz = wext_freq2mhz(&range.freq[i]);
- entry.channel = range.freq[i].i;
+ entry.mhz = wext_freq2mhz(&range.freq[i]);
+ entry.channel = range.freq[i].i;
+ entry.restricted = 0;
memcpy(&buf[bl], &entry, sizeof(struct iwinfo_freqlist_entry));
bl += sizeof(struct iwinfo_freqlist_entry);