Commit graph

41 commits

Author SHA1 Message Date
Andre Heider
e084781afc utils: add helper functions to get names by values
Some defines/enums use bits, while some functions only set a single one.
Make it less painful to get to a name for those.

This avoids hardcoding bit lists for consumers.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-16 00:09:07 +01:00
Andre Heider
d09a77a369 utils: add iwinfo_htmode_is_{ht|vht|he} helpers
Small and useful functions which allow to clear up some consumers.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-16 00:09:07 +01:00
Andre Heider
87529770f6 utils: add and use iwinfo_format_hwmodes()
Unify how hwmodes are displayed, e.g.:
"802.11ac/ax/b/g/n" instead of "802.11bgnacax".

Luci currently uses a natural sort order, but that probably doesn't work
as intended once "be" is added, so let's do this here.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-16 00:09:07 +01:00
Andre Heider
02f433e305 lib: add IWINFO_80211_COUNT and IWINFO_80211_NAMES
The same as with the other defines/enums which allow consumers to
iterate over all known ones.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-16 00:09:07 +01:00
Andre Heider
1d30df1929 lib: add IWINFO_BAND_COUNT and IWINFO_BAND_NAMES
Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-16 00:09:07 +01:00
Andre Heider
a5b30de2b8 lib: add IWINFO_OPMODE_COUNT and use it for IWINFO_OPMODE_NAMES
Match the other string arrays, which allows us to consistently loop over them.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-15 23:52:27 +01:00
Andre Heider
9f29e79eea lib: constify and fixup the string array definitions
Match their declarations as per the header.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-15 23:52:04 +01:00
Andre Heider
fddc015704 nl80211: mark frequencies where HE operation in not allowed
Repurpose the IWINFO_FREQ_NO_2160MHZ define for that, which was
introduced but never used. nl80211 doesn't have such a flag either.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-15 23:51:47 +01:00
Andre Heider
462b679716 fix -Wduplicate-decl-specifier warnings
include/iwinfo.h:209:19: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
  209 | static const char const *ht_secondary_offset[4] = {
      |                   ^~~~~

Constify and move the offenders out of the header.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2022-12-15 20:07:49 +01:00
Joerg Werner
0dad3e6660 Add support for CCMP-256 and GCMP-256 ciphers
Signed-off-by: Joerg Werner <schreibubi@gmail.com>
2022-08-20 17:59:11 +02:00
David Bauer
562d015326 iwinfo: nl80211: fix hwmode parsing for multi-band NICs
In case a NIC supports multiple frequency bands, the supported
hw-modelist might not contain all valid hwmodes, as B/G/AD hwmodes are
only included based on the last parsed supported frequency.

In case a radio supports multiple bands, this might result in these
hwmodes not being flagged as supported.

Circumvent this by tracking all seen frequency bands using a bitmask
which later determined which HW modes are listed as supported.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-23 11:59:29 +02:00
Jo-Philipp Wich
a0a0e02dd9 iwinfo: rename hardware.txt to devices.txt
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-11 15:56:35 +02:00
Felix Fietkau
aa0e3c4bbe iwinfo: nl80211: add support for printing the device path for a phy
Will be used to replace the shell code from mac80211.sh

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-09 13:57:26 +02:00
David Bauer
c45f0b584b iwinfo: add 802.11ax HE rate information
This adds 802.11ax HE specific rate information to iwinfo.

Add fields for HE status of a STA as well as DCM and guard interval
fields specific to HE operation.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-05-02 00:20:54 +02:00
David Bauer
50b64a63e3 iwinfo: add basic IEEE 802.11ax support
This adds basic support for IEEE 802.11ax when requesting HW or HT
Modelist for a PHY from iwinfo. This way, applications using iwinfo can
detect HE phys.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-04-12 23:45:42 +02:00
Ansuel Smith
0702f32294 iwinfo: improve center channel handling
- Improve iwinfo center channel struct position
- Prevent read beyond buffer on malformed data

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-01-06 17:38:07 +00:00
Daniel Golle
8bfd8d8800 iwinfo: add support for GCMP cipher
Extend support for WPA ciphers by GCMP which is required for 802.11ad.
Breaks ABI as ciphers now needs to be a field of 16 bits instead of 8.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-01-05 22:19:43 +00:00
Ansuel Smith
4e22953eb1 iwinfo: export center_chan info for local wifi
Iwinfo already export the htmode but there is no way to know where the
channel expan in case a 40Mhz+ channel width is used. Export the center
channels used by the driver to better know the channel utilizzation of
the wifi.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-01-05 22:19:43 +00:00
Ansuel Smith
ea28dfb5f9 iwinfo: export ht and vht operation in scan results
Export ht and vht operation data in scan results. These additional data
can be usefull to check wifi channel utilizzation by neraby stations.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-01-05 22:19:42 +00:00
David Bauer
06a03c9e3b Revert "iwinfo: add BSS load element to scan result"
This reverts commit a6914dc0dc.

iwinfo currently misses ABI version tracking in OpenWrt, potentially
breaking other packages unintentionally.

Revert this commit for now  until this is implemented.
Otherwise, we are not able to safely bump iwinfo at the moment.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-03-22 01:06:36 +01:00
David Bauer
a6914dc0dc iwinfo: add BSS load element to scan result
This adds support for the BSS load information element. With this patch,
the BSS load information is visible when using the CLI as well as when
accessing scan results using the LUA binding.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-02-04 14:44:14 +01:00
Daniel Danzberger
bf2c1069a7 nl80211: add htmode to iwinfo_ops
This callback shows the currently active HTMODE of the device.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-01-05 17:17:40 +01:00
Robert Marko
f8ef450652 iwinfo: Add support for WPA3
This patch adds support for WPA3, meaning SAE and OWE are now properly identified.
This fixes iwinfo and LuCi showing WPA2 NONE for WPA3 SAE and OWE.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2019-09-01 12:38:57 +02:00
Robert Marko
a8e8275923 iwinfo: Add support for 802.11ad
This patch adds support for identifying, calculating channels from
frequency and vice versa as well as Lua hwmode for 802.11ad.

Support has been added for channels 1-6.

Signed-off-by: Robert Marko <robimarko@gmail.com>
[Increase buffer size for hwmodes]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2019-03-21 16:28:39 +01:00
Daniel Danzberger
5aa8c5496c libiwinfo: nl80211: add mesh stats on assoclist.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2018-11-26 11:03:17 +01:00
Jo-Philipp Wich
d991fe5481 utils: add simple ubus query support
Some wireless runtime parameters are not available via nl80211, e.g.
the effective Mesh ID so we need to fetch those from ubus state info.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-24 17:36:17 +02:00
Daniel Danzberger
305f6955d6 iwinfo: nl80211: add survey.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2018-07-16 09:03:12 +02:00
Daniel Danzberger
2c5c641aab iwinfo: nl80211: add more stats to assoclist.
+ NL80211_STA_INFO_SIGNAL_AVG
+ NL80211_STA_INFO_RX_DROP_MISC
+ NL80211_STA_INFO_CONNECTED_TIME

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2018-07-16 09:01:23 +02:00
Daniel Golle
223e09bf3f add support for expected throughput
cfg80211 allows drivers to announce the to-be-expected layer-2 datarate
using the NL80211_STA_INFO_EXPECTED_THROUGHPUT field.
This information is useful as a metric for user-space routing daemons,
so grab it via nl80211 and make it available in both C and Lua APIs,
and show expected throughput on CLI interface assoclist.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2018-02-15 04:50:28 +01:00
Rafał Miłecki
ce51cb8123 Allow storing more info about each frequency
This adds flags field which may be used to mark frequency not available
under some conditions.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2017-08-16 17:15:03 +02:00
Jo-Philipp Wich
bc8682aa5e nl80211: add VHT rateinfo support
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 15:01:49 +01:00
Jo-Philipp Wich
e3bd6c3653 iwinfo: assign explicit length to IWINFO_*_NAMES[] to fix compile issues
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 15:00:22 +01:00
Rafał Miłecki
813f61e48b nl80211: read TX power using NL80211_CMD_GET_INTERFACE
With the mac80211 commit d55d0d598e66 ("nl80211: put current TX power in
interface info") it is possible now to get TX power using nl80211. As we
don't really support any wext-only drivers it doesn't make sense to
leave wext as a fallback.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
2015-10-05 11:00:22 +02:00
Jernej Kos
16597a70bc iwinfo: report additional data for stations
Signed-off-by: Jernej Kos <jernej@kos.mx>
2015-08-11 17:24:24 +02:00
Jo-Philipp Wich
e8a1e7d224 Fix -Wall -Wpedantic warnings
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-19 18:54:58 +02:00
Jo-Philipp Wich
7b39bee1c6 iwinfo: add support for querying available HT modes
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-08 13:29:10 +02:00
Jo-Philipp Wich
9842d2507f iwinfo: move ARRAY_SIZE macro to iwinfo/utils.h
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-08 13:21:16 +02:00
Jo-Philipp Wich
d051a0bf7a include: add lookup_phy() op
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 16:59:03 +01:00
Jo-Philipp Wich
7901e7c69f lib: add iwinfo_backend_by_name()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 16:57:19 +01:00
nbd
fe7133f7e5 iwinfo: fix handling of accessing nl80211 interfaces via radio*
look up device path via uci instead of assuming a direct phy index

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

git-svn-id: svn+ssh://svn.openwrt.org/openwrt/trunk@42759 3c298f89-4303-0410-b956-a3cf2f4a3e73
2014-10-27 13:48:19 +01:00
Jo-Philipp Wich
8ae758db52 Initial commit
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-05 19:56:27 +02:00