include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
struct iwinfo_freqlist_entry {
uint8_t channel;
uint32_t mhz;
+ uint8_t restricted;
};
struct iwinfo_crypto_entry {
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")
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);
}
}
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);
[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 )
{
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++;
}
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);