2

Yesterday, I made a major update to my linux system. iwconfigcommand used to display 802.11[abgn] info, but now it's only displaying 802.11.

Is there any way I can make iwconfig to display the card available bands?

If not, is there any way I can retrieve that info through any other command?

glezo
  • 123
  • 8

1 Answers1

5

This was deliberately removed from the "WEXT emulation" code in Linux kernel v4.7.

iwconfig obtains this piece of text from the kernel using ioctl(SIOCGIWNAME), a function from the WEXT (Wireless Extensions) API. However:

  1. The text returned by SIOCGIWNAME is limited to 16 bytes, and IEEE 802.11abgn already hits that limit – there is no space for indicating ac, much less the even-newer amendments.

  2. WEXT as a whole is practically stuck in 802.11n era. Its general design actually predates 802.11 Wi-Fi (iwconfig still carries subcommands for 1988's WaveLAN), and it has trouble dealing with modern features like multi-band Wi-Fi adapters, channel widths, etc.

Most modern wireless drivers are built on mac80211/cfg80211 architecture and directly provide the nl80211 API, which provides far more features and isn't affected by various issues that WEXT has. The kernel still emulates existing WEXT operations using information from mac/cfg80211, but there's no interest nor good reason to extend it any further. (The mac80211 architecture was introduced in 2006 by Devicescape; see this LWN article.)

This also means that the whole wireless_tools package is considered obsolete due to its reliance on WEXT API (except if you use a WEXT driver, of course). In its place, use iw for managing Wi-Fi devices which have modern mac/cfg80211 drivers:

  • iw phy (short for iw phy phy0 info) will show the capabilities of your physical card. Unfortunately it doesn't outright state "802.11b/g/n", but you can still infer that based on bands, HT/VHT support, etc.

    • 802.11a – shows the 5 GHz band
    • 802.11b – shows the 2.4 GHz band with 1/2/5.5/11 Mbps 'non-HT' bitrates
    • 802.11g – shows the 2.4 GHz band with 6/9/12/18/24/36/48/54 Mbps 'non-HT' rates
    • 802.11n – supports "HT" (high throughput) on both bands
    • 802.11ac – supports "VHT" (very high throughput) on the 5 GHz band
    • 802.11ax – supports "HE" (high efficiency)
  • iw dev (short for iw dev wlan0 info) will show the current configuration of the software interface, such as frequency. It's technically possible to have multiple wlan# interfaces using the same phy.

  • iw [dev] wlan0 link will show the current link state in more detail.

  • iw [dev] wlan0 station dump is similar to the above.


Note that, as the commit message says, features like HT and VHT are no longer considered to be amendments (which the lowercase letters indicate) – they have been merged into later editions of 802.11 proper, e.g. "802.11-2012" fully incorporates 'n', and "802.11-2016" includes 'ac'.

Also note that the emulation change doesn't affect WEXT-native drivers, which have their own handlers for ioctls. So if you're using a very old device – or a Realtek – then you'll still get names like IEEE 802.11-DS or IEEE 802.11b in this field.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • Well... that's what I call a hell of an answer. Not only enounces the reason down to the detail (I knew `iwconfig`was stated as maintenance only, but didn't know the reasons you just exposed), but also suggests a way to retrieve the info I need. THANK YOU!!! – glezo Jun 09 '18 at 18:51
  • Good answer. However, in my case bitrate information about `HT` and `VHT` is not displayed for `phy0 info`. At the same time `wlan0 link` indicates tx bitrate of 324 Bit/s, which is only available for a `VHT`. Any suggestions to get the missing bitrates? – Jari Turkia Jul 12 '20 at 10:10
  • What wireless card driver are you using? (It could be one of those leftovers which are native to WEXT and iwconfig, and rely on kernel emulation for nl80211.) – u1686_grawity Jul 12 '20 at 10:23
  • The driver is wl. It's a non-opensource Broadcom driver. The chip was used commonly 6-8 years ago. – Jari Turkia Jul 13 '20 at 06:18
  • One of those manufacturers (I cannot remember whether Broadcom or Realtek or maybe both) has been known to provide WEXT drivers for a *very* long time, all the way to 2010s. From what I remember, wl is a natively WEXT-based driver, meaning it produces its own answers and does not rely on the mentioned "WEXT emulation" code (but rather the opposite situation), so use iwconfig/iwlist and see if that works better for you. Note the 16-byte limit and such. – u1686_grawity Jul 13 '20 at 07:42