]> git.ipfire.org Git - thirdparty/iw.git/log
thirdparty/iw.git
13 days agoiw: scan: Add partial Multi-Link element printing main master
Alex Gavin [Wed, 28 May 2025 04:13:30 +0000 (21:13 -0700)] 
iw: scan: Add partial Multi-Link element printing

Only print some basic items to start.

Minimum and maximum length values are computed from the
specification. Maximum only includes Common Info and
does not consider Link Info.

Signed-off-by: Alex Gavin <alex.gavin@candelatech.com>
Link: https://patch.msgid.link/20250528041330.83464-1-alex.gavin@candelatech.com
[code style, spelling fixes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 days agoiw: print HE mcs correctly when mcs_len
Janusz Dziedzic [Sat, 26 Apr 2025 20:26:48 +0000 (22:26 +0200)] 
iw: print HE mcs correctly when mcs_len

Print HE mcs correctly when lower layer
report correct/real mcs length.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
Link: https://patch.msgid.link/20250426202702.913342-1-janusz.dziedzic@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 days agoiw: Add command to enable/disable EPCS
Ilan Peer [Fri, 1 Nov 2024 03:43:13 +0000 (05:43 +0200)] 
iw: Add command to enable/disable EPCS

Add support to enable/disable Emergency Preparedness Communication
Services (EPCS).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 days agoupdate nl80211.h
Johannes Berg [Tue, 24 Jun 2025 07:31:14 +0000 (09:31 +0200)] 
update nl80211.h

From Linux 6.16-rc2.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 days agoiw: Prevent segfault in ftm get stats
Daniel Gabay [Tue, 14 Jan 2025 17:04:12 +0000 (19:04 +0200)] 
iw: Prevent segfault in ftm get stats

Ensure correct NL80211_FTM_STATS_MAX is passed to nla_parse
to prevent segmentation fault.

Fixes: 02b85d80b4f4 ("iw: add FTM responder commands")
Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 weeks agoiw: print NO-EHT flags for reg get command
Aditya Kumar Singh [Mon, 12 May 2025 15:23:04 +0000 (20:53 +0530)] 
iw: print NO-EHT flags for reg get command

Currently when NO-EHT flag is set by driver, iw doesn't display that
information in the 'iw reg get' command. Add changes to print "NO-EHT"
while displaying the reg rules via reg get command, if a reg rule is
marked with NO-EHT flag.

Sample Output:

country RU: DFS-UNSET
        (2402 - 2472 @ 40), (N/A, 20), (N/A), NO-EHT
        (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW, NO-EHT
        (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW, NO-EHT
        (5490 - 5730 @ 160), (N/A, 24), (0 ms), DFS, AUTO-BW, NO-EHT
        (5735 - 5835 @ 80), (N/A, 30), (N/A), AUTO-BW, NO-EHT

Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Signed-off-by: Manish Dharanenthiran <manish.dharanenthiran@oss.qualcomm.com>
Link: https://patch.msgid.link/20250512152304.2852658-1-manish.dharanenthiran@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: fix EHT capabilities on Big Endian platforms
Aleksander Jan Bajkowski [Fri, 2 May 2025 19:44:05 +0000 (21:44 +0200)] 
iw: fix EHT capabilities on Big Endian platforms

IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.

Fixes: 5a71b722270c ("iw: Print local EHT capabilities")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250502194405.3489240-1-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: scan: Add printing of EHT Operation Element
Aleksander Jan Bajkowski [Fri, 2 May 2025 10:03:53 +0000 (12:03 +0200)] 
iw: scan: Add printing of EHT Operation Element

Add ability to print out EHT capabilities from AP beacons.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250502100353.3149470-1-olek2@wp.pl
[add default case to bandwidth switch]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoutil: rename hz to Hz vol 2
Aleksander Jan Bajkowski [Fri, 2 May 2025 20:04:24 +0000 (22:04 +0200)] 
util: rename hz to Hz vol 2

In most places, the Hz unit is used. This commit changes
hz to Hz in other places.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250502200424.3492403-1-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoutil: rename hz to Hz
Aleksander Jan Bajkowski [Sun, 13 Apr 2025 11:36:53 +0000 (13:36 +0200)] 
util: rename hz to Hz

In most places, the Hz unit is used. This commit changes
hz to Hz in other places.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250413113653.29050-1-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: scan: Decode additional WPA3 group ciphers
Alex Gavin [Sun, 13 Apr 2025 18:24:55 +0000 (11:24 -0700)] 
iw: scan: Decode additional WPA3 group ciphers

These values are taken from the publicly-available WPA3
specification available on the WFA website.

The values also match hostapd keys 'group_cipher'
and 'group_mgmt_cipher'.

Signed-off-by: Alex Gavin <alex.gavin@candelatech.com>
Link: https://patch.msgid.link/20250413182515.10755-3-alex.gavin@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: scan: Decode additional WPA3 AKM suite types
Alex Gavin [Sun, 13 Apr 2025 18:24:54 +0000 (11:24 -0700)] 
iw: scan: Decode additional WPA3 AKM suite types

These values are taken from the publicly-available WPA3
specification available on the WFA website.

Specific string choice attempts to match previous
printouts, rather than matching the specification
verbatim.

Signed-off-by: Alex Gavin <alex.gavin@candelatech.com>
Link: https://patch.msgid.link/20250413182515.10755-2-alex.gavin@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: fix HE operation on Big Endian platforms
Aleksander Jan Bajkowski [Sat, 5 Apr 2025 18:48:06 +0000 (20:48 +0200)] 
iw: fix HE operation on Big Endian platforms

IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.

Fixes: 422419e06d55 ("scan: Add printing of HE Operation Element")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250405184807.701728-3-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: fix HE capabilities on Big Endian platforms
Aleksander Jan Bajkowski [Sat, 5 Apr 2025 18:48:05 +0000 (20:48 +0200)] 
iw: fix HE capabilities on Big Endian platforms

IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.

Fixes: c741be9f6ca3 ("iw: print HE capabilities")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250405184807.701728-2-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: scan: add eht capability parsing
Dylan Eskew [Wed, 19 Mar 2025 18:39:18 +0000 (11:39 -0700)] 
iw: scan: add eht capability parsing

Add ability to print out EHT capabilities from
AP beacons.

Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
Link: https://patch.msgid.link/20250319183918.1215853-3-dylan.eskew@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agoiw: util: update and clean up eht capa printing
Dylan Eskew [Wed, 19 Mar 2025 18:39:17 +0000 (11:39 -0700)] 
iw: util: update and clean up eht capa printing

A number of fields were either missing or incorrect, so
update to more aligned with 802.11be spec. Also clean up
printout formatting.

Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
Link: https://patch.msgid.link/20250319183918.1215853-2-dylan.eskew@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoiw: scan: replace passed ie buffer with ie context
Dylan Eskew [Fri, 22 Nov 2024 16:18:51 +0000 (08:18 -0800)] 
iw: scan: replace passed ie buffer with ie context

Since some ies require references to other ies, parse
the ie list once before to create a context and prevent
parsing more than the two times required.

Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
Link: https://patch.msgid.link/20241122161851.647214-1-dylan.eskew@candelatech.com
[cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoiw: print tx power per link for MLD
Aaradhana Sahu [Mon, 25 Nov 2024 10:09:13 +0000 (15:39 +0530)] 
iw: print tx power per link for MLD

Add support to print tx power per link for an ML interface

Sample output:
phy#0
        Interface wlp88s0
                ifindex 5
                wdev 0x1
                addr 00:03:7f:01:54:92
                ssid tx_power_123
                type AP
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0
                MLD with links:
                 - link ID  0 link addr 00:03:7f:01:54:92
                   channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
                   txpower 30.00 dBm

Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Link: https://patch.msgid.link/20241125100913.261319-1-quic_ramess@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoiw: add output for wiphy interface combinations
Aditya Kumar Singh [Tue, 8 Oct 2024 05:06:07 +0000 (10:36 +0530)] 
iw: add output for wiphy interface combinations

When multiple hardwares are grouped under a wiphy, the information about it
is advertised via NL80211_ATTR_WIPHY_RADIOS and
NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS attributes. Add support to parse
and display the information in info command.

Sample output with hwsim radio
(insmod mac80211_hwsim.ko radios=1 mlo=1 multi_radio=1):
$ iw phy0 info
  ....
          valid interface combinations:
                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                   total <= 2050, #channels <= 1, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz, 160 MHz, 5 MHz, 10 MHz }
  ....
          Supported wiphy radios:
                * Idx 0:
                        Frequency Range:  2402 MHz - 2494 MHz
                        Radio's valid interface combinations:
                                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                                   total <= 2050, #channels <= 1, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz, 160 MHz, 5 MHz, 10 MHz }

                * Idx 1:
                        Frequency Range:  5170 MHz - 5935 MHz
                        Radio's valid interface combinations:
                                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                                   total <= 2050, #channels <= 1, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz, 160 MHz, 5 MHz, 10 MHz }

                * Idx 2:
                        Frequency Range:  5945 MHz - 7125 MHz
                        Radio's valid interface combinations:
                                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                                   total <= 2050, #channels <= 1, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz, 160 MHz, 5 MHz, 10 MHz }

                * Idx 3:
                        Frequency Range:  892 MHz - 937 MHz
                        Radio's valid interface combinations:
                                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                                   total <= 2050, #channels <= 1, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz, 160 MHz, 5 MHz, 10 MHz }

        Globally valid interface combinations:
                 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2048, #{ P2P-device } <= 1,
                   total <= 2050, #channels <= 4

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://patch.msgid.link/20241008050607.1113396-3-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoupdate nl80211.h
Johannes Berg [Thu, 7 Nov 2024 14:24:07 +0000 (15:24 +0100)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoiw: scan: add enum for element IDs
Dylan Eskew [Mon, 30 Sep 2024 18:11:43 +0000 (11:11 -0700)] 
iw: scan: add enum for element IDs

Formerly, element IDs were hardcoded. Improve readability by using
element ID names.

Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
Link: https://patch.msgid.link/20240930181145.1043048-2-dylan.eskew@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoscan: Add printing of HE Operation Element
Christopher A Wills [Tue, 30 Jul 2024 23:27:36 +0000 (16:27 -0700)] 
scan: Add printing of HE Operation Element

Signed-off-by: Christopher A Wills <christopher.a.wills@intel.com>
12 months agoupdate nl80211.h
Johannes Berg [Wed, 3 Jul 2024 08:37:44 +0000 (10:37 +0200)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agoiw: fix formats under MIPS64/PPC
Rosen Penev [Tue, 2 Jul 2024 19:35:44 +0000 (12:35 -0700)] 
iw: fix formats under MIPS64/PPC

__SANE_USERSPACE_TYPES__ needs to be defined to get consistent 64-bit
type defines and to fix -Wformat warnings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://lore.kernel.org/r/20240702193544.5984-1-rosenp@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agoiw: remove sizer section and related code
Benjamin Berg [Fri, 3 May 2024 11:12:06 +0000 (13:12 +0200)] 
iw: remove sizer section and related code

With commit 338059ace9d0 ("iw: change __cmd section scheme to fit
gcc/clang"), the __cmd section only includes pointers to struct cmd
rather than the struct itself. This means that the code to measure the
spacing is not needed anymore and can be dropped.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agoutil: clarify comment about 'parsed' pointer
Johannes Berg [Fri, 17 May 2024 11:19:47 +0000 (13:19 +0200)] 
util: clarify comment about 'parsed' pointer

It took me a while to understand this (again?), so
clarify the comment here.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agoiw: add puncturing support
Johannes Berg [Fri, 17 May 2024 10:12:10 +0000 (12:12 +0200)] 
iw: add puncturing support

Parse and pass the puncturing bitmap to the kernel in any
chandef (except S1G), the kernel will check validity.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agoiw: refactor frequency help
Johannes Berg [Fri, 17 May 2024 10:04:06 +0000 (12:04 +0200)] 
iw: refactor frequency help

The channel parsing is the same in most places, refactor
the help strings for that to not duplicate them in all
the commands using them. This also corrects the help for
a number of commands that never saw 320 MHz support.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agobump version to 6.9 v6.9
Johannes Berg [Fri, 17 May 2024 09:19:09 +0000 (11:19 +0200)] 
bump version to 6.9

This matches the kernel nl80211 as of 6.9.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agochannel: report punctured subchannel bitmap
Johannes Berg [Mon, 15 Jan 2024 12:26:49 +0000 (14:26 +0200)] 
channel: report punctured subchannel bitmap

If the used channel is punctured, display the bitmap of
subchannels that are punctured.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowowlan: add a wake event
Johannes Berg [Fri, 17 May 2024 09:18:05 +0000 (11:18 +0200)] 
wowlan: add a wake event

Print the wake event unprotected deauth/disassoc info.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agoupdate nl80211.h
Johannes Berg [Fri, 17 May 2024 09:15:54 +0000 (11:15 +0200)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agoupdate nl80211.h
Johannes Berg [Thu, 21 Dec 2023 19:42:17 +0000 (20:42 +0100)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agobump version to 6.7 v6.7
Johannes Berg [Thu, 21 Dec 2023 11:51:14 +0000 (12:51 +0100)] 
bump version to 6.7

This already has some "will be 6.8" content, but
that's not entirely closed yet.

Change-Id: I16beefdf8b5e37fc72948d8a874772dc8c97e7b2
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agoupdate nl80211.h
Johannes Berg [Thu, 21 Dec 2023 11:47:01 +0000 (12:47 +0100)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agoiw: allow extra cflags
Johannes Berg [Fri, 1 Sep 2023 05:50:02 +0000 (07:50 +0200)] 
iw: allow extra cflags

We can override the entirety of CFLAGS from the make
command line, but not add e.g. -Werror. Append a new
EXTRA_CFLAGS to make that possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agoiw: S1G: add 802.11ah support for link command display
Bassem Dawood [Thu, 19 Oct 2023 07:40:19 +0000 (18:40 +1100)] 
iw: S1G: add 802.11ah support for link command display

Amending the link command which depends on kernal changes for
802.11ah bandwidths/MCS/NSS NL80211_RATE_INFO_ attributes.

S1G frequency offset being used as well for the MHz units print.

Signed-off-by: Bassem Dawood <bassem@morsemicro.com>
Link: https://lore.kernel.org/r/20231019074019.2246629-1-bassem@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoupdate nl80211.h
Johannes Berg [Thu, 24 Aug 2023 07:19:47 +0000 (09:19 +0200)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoiw: connect: Fix segfault during open authentication
Chaitanya Tata [Wed, 26 Jul 2023 19:22:45 +0000 (00:52 +0530)] 
iw: connect: Fix segfault during open authentication

The check for remaining arguments is done after decrement effectively
bypassing the non-zero check and causes a segfault with below command:

  "connect <SSID> auth open/shared".

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Link: https://lore.kernel.org/r/20230726192245.100897-1-Chaitanya.Tata@nordicsemi.no
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoiw: fix attribute size mismatch
Koen Vandeputte [Fri, 7 Jul 2023 14:48:26 +0000 (16:48 +0200)] 
iw: fix attribute size mismatch

NL80211_ATTR_MAX_AP_ASSOC_STA gets packed as u32 in the kernel.
Change the receiving side to match this, or it will be wrong
on big-endian.

Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
Link: https://lore.kernel.org/r/20230707144826.3043151-1-koen.vandeputte@citymesh.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoiw: add more extended capa bits
Emmanuel Grumbach [Wed, 23 Aug 2023 10:10:02 +0000 (13:10 +0300)] 
iw: add more extended capa bits

Those were missing

While at it, fix a bug in the default case, we want to print the actual
bit offset which is bit + base.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoiw: Fix EHT rates printing.
Ben Greear [Tue, 16 May 2023 18:02:38 +0000 (11:02 -0700)] 
iw: Fix EHT rates printing.

The 20Mhz rates thing is a union with the others, so print one or
the other.  This appears to fix the output of the mcs/bw printout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: S1G: add list command support for 802.11ah
Gilad Itzkovitch [Mon, 27 Feb 2023 23:11:24 +0000 (12:11 +1300)] 
iw: S1G: add list command support for 802.11ah

In this changeset S1G frequencies are displayed for any S1G band
with their relevant properties.

Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230227231124.711053-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: S1G: add parsing for 802.11ah scan IE's
Gilad Itzkovitch [Mon, 27 Feb 2023 23:01:27 +0000 (12:01 +1300)] 
iw: S1G: add parsing for 802.11ah scan IE's

In order to support scan display for 802.11ah, this change adds
parsing for S1G capabilities, operation, and short beacon interval
information elements.

Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230227230127.709496-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: S1G: add frequency set in kHz and offset options
Gilad Itzkovitch [Mon, 27 Feb 2023 02:05:29 +0000 (15:05 +1300)] 
iw: S1G: add frequency set in kHz and offset options

This change adds support to specify the set frequency in kHz for
the set frequency command which include an offset whenever needed.
Also, it adds S1G bandwidth options to the selected chandef.

Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230227020529.504934-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoutil: don't print EHT info if not present
Johannes Berg [Wed, 15 Mar 2023 15:08:22 +0000 (16:08 +0100)] 
util: don't print EHT info if not present

That's just confusing, don't print it if the EHT MAC
capabilities attribute isn't there (the kernel puts
all the attrs together.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agointerface: print links
Johannes Berg [Fri, 2 Sep 2022 19:59:31 +0000 (21:59 +0200)] 
interface: print links

Print link information in 'iw dev' and 'iw ... info'.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agolink: update for MLO
Johannes Berg [Wed, 31 Aug 2022 20:35:02 +0000 (22:35 +0200)] 
link: update for MLO

In MLO we need to use the MLD address to get the station
statistics (which still need work for per-link stats),
adjust the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agolink: fix some formatting
Johannes Berg [Wed, 31 Aug 2022 19:13:11 +0000 (21:13 +0200)] 
link: fix some formatting

The bss flags has a spurious newline, and we don't use a
tab for indentation after the colon in other places, fix
that here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: scan: set NL80211_SCAN_FLAG_COLOCATED_6GHZ in case of full sched scan
Ayala Beker [Thu, 14 Jul 2022 06:33:36 +0000 (09:33 +0300)] 
iw: scan: set NL80211_SCAN_FLAG_COLOCATED_6GHZ in case of full sched scan

Same as in regular scan, in case of full sched scan need to set
NL80211_SCAN_FLAG_COLOCATED_6GHZ flag, to scan for collocated
APs by default.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoutil: add support for 320MHz bandwidth without cf1
Mordechay Goodstein [Sun, 29 May 2022 16:29:55 +0000 (19:29 +0300)] 
util: add support for 320MHz bandwidth without cf1

Based on user input for control central freq and 320 BW find the data
central freq (cf1).

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoutil: add support for 320Mhz bandwidth
Mordechay Goodstein [Sun, 29 May 2022 16:29:55 +0000 (19:29 +0300)] 
util: add support for 320Mhz bandwidth

In the new standard 11be we can set up to 320Mhz bandwidth so add it
in parsing params.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoupdate nl80211.h
Johannes Berg [Fri, 14 Apr 2023 10:50:11 +0000 (12:50 +0200)] 
update nl80211.h

Bring in nl80211.h from 6.4-rc.

Change-Id: I96b818a987d243b5cf97e2cc9c62d57637e17165
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: event: fix printf format error
Stefan Weil [Sat, 21 Jan 2023 19:36:37 +0000 (20:36 +0100)] 
iw: event: fix printf format error

tv_usec can be a 64 bit integer which causes a compiler warning:

event.c: In function 'print_event':
event.c:930:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'suseconds_t' {aka 'long long int'} [-Wformat=]
  930 |                         printf("[%s.%06lu]: ", buf, args->ts.tv_usec);
      |                                     ~~~~^           ~~~~~~~~~~~~~~~~
      |                                         |                   |
      |                                         long unsigned int   suseconds_t {aka long long int}
      |                                     %06llu

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Link: https://lore.kernel.org/r/20230121193637.347109-1-sw@weilnetz.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: add support for retrieving keys
Raphaël Mélotte [Thu, 12 Jan 2023 12:25:25 +0000 (13:25 +0100)] 
iw: add support for retrieving keys

For debugging purposes, it can be useful to be able to retrieve keys.

Add a "iw key get" command, to be able to retrieve keys when the key
index is known. A new "key" section is also introduced, in preparation
for future key-related commands.

Example retrieving a pairwise key:
iw dev wlan0 key get 0 02:02:03:04:05:06

Example retrieving a group key:
iw dev wlan0 key get 1

Note that only the outer ATTR_KEY_DATA (and seq) is reported, the
nested KEY_DATA (and seq) within ATTR_KEY is not.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Link: https://lore.kernel.org/r/20230112122525.2257298-1-raphael.melotte@mind.be
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: info: fix bug reading preambles and bandwidths
Jaewan Kim [Mon, 9 Jan 2023 15:14:55 +0000 (00:14 +0900)] 
iw: info: fix bug reading preambles and bandwidths

Preambles and bandwidths values are considered as bit shifts
when they're are used for capabilities.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230109151455.325793-1-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: add cac background command
Janusz Dziedzic [Thu, 25 Aug 2022 09:51:11 +0000 (11:51 +0200)] 
iw: add cac background command

Add command that request background CAC radar scan.
Tested on mt7915.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
Link: https://lore.kernel.org/r/20220825095111.1026649-1-janusz.dziedzic@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoiw: info: print PMSR capabilities
Jaewan Kim [Tue, 11 Oct 2022 05:34:05 +0000 (14:34 +0900)] 
iw: info: print PMSR capabilities

Print PMSR and FTM capabilities if any.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20221011053405.332375-1-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agobump version to 5.19 v5.19
Johannes Berg [Fri, 27 May 2022 10:23:45 +0000 (12:23 +0200)] 
bump version to 5.19

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoinfo: refactor extended features
Johannes Berg [Fri, 27 May 2022 10:22:34 +0000 (12:22 +0200)] 
info: refactor extended features

Refactor the printing here to use a switch statement,
so we get a warning for unhandled features.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoinfo: add missing extended features
Johannes Berg [Fri, 27 May 2022 09:43:47 +0000 (11:43 +0200)] 
info: add missing extended features

Add missing extended features and sort them for easier
comparison.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoupdate nl80211.h
Johannes Berg [Fri, 27 May 2022 09:30:43 +0000 (11:30 +0200)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: handle VHT extended NSS
Maxime Bizon [Mon, 16 May 2022 09:07:56 +0000 (11:07 +0200)] 
iw: handle VHT extended NSS

No change in "Supported Channel Width" output format when extended NSS
is not supported.

Sample output for a PHY with 1/2 NSS ratio:

VHT Capabilities (0xb39b79f2):
Max MPDU length: 11454
Supported Channel Width: 160Mhz (1/2 NSS) 80+80Mhz (1/2 NSS)
[...]
VHT extended NSS: supported

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Link: https://lore.kernel.org/r/405f5ed2c434846f8ab2730b34288c5f649b8915.camel@freebox.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: fix 'upto' -> 'up to'
Diederik de Haas [Sat, 23 Apr 2022 17:54:51 +0000 (19:54 +0200)] 
iw: fix 'upto' -> 'up to'

As reported by Debian's lintian tool.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
Link: https://lore.kernel.org/r/20220423175451.27215-1-didi.debian@cknow.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: fix double tab in mesh path header
Diederik de Haas [Sat, 23 Apr 2022 16:09:22 +0000 (18:09 +0200)] 
iw: fix double tab in mesh path header

As reported in https://bugs.debian.org/974833, the double tab char
causes a mismatch of the header and contents after 'EXPTIME'.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
Link: https://lore.kernel.org/r/20220423160922.14952-1-didi.debian@cknow.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agostation: print EHT rate information
Johannes Berg [Fri, 11 Feb 2022 14:00:55 +0000 (15:00 +0100)] 
station: print EHT rate information

Print the EHT rate information if present.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: Print local EHT capabilities
Ilan Peer [Tue, 13 Jul 2021 08:39:20 +0000 (11:39 +0300)] 
iw: Print local EHT capabilities

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: support 160MHz frequency command for 6GHz band
Deren Wu [Sat, 12 Mar 2022 09:09:04 +0000 (17:09 +0800)] 
iw: support 160MHz frequency command for 6GHz band

Add support to configure 160MHz in 6G band by direct
channel/frequency command.

Example:
iw dev <interface> set freq 6195 160MHz

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Link: https://lore.kernel.org/r/4366b069d41f469c36554c8dcfc857b5aedf3e1d.1647075278.git.deren.wu@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: print out assoc comeback event
Ben Greear [Thu, 7 Apr 2022 23:58:26 +0000 (16:58 -0700)] 
iw: print out assoc comeback event

Looks like this was added in 5.17 kernel.  We see this event
when trying (and failing) to do .11r roaming).

Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://lore.kernel.org/r/20220407235826.2690-1-greearb@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: print Radar background capability if supported
Lorenzo Bianconi [Thu, 10 Mar 2022 10:46:56 +0000 (11:46 +0100)] 
iw: print Radar background capability if supported

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/1661d4de358d5ff8f6f8350eb165acf08f870951.1646909094.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoupdate nl80211.h
Johannes Berg [Fri, 11 Mar 2022 10:49:25 +0000 (11:49 +0100)] 
update nl80211.h

Change-Id: I7888629f670e585c3b04b7e9ca4ca63cbf5746cb
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: survey: add support for radio stats
Johannes Berg [Fri, 29 Oct 2021 07:29:39 +0000 (09:29 +0200)] 
iw: survey: add support for radio stats

Add a --radio argument to "survey dump" to support the global
radio statistics.

Change-Id: I16e615434607d982e9cf690f03148738eca25cde
Tested-by: Sven Eckelmann <sven@narfation.org>
Link: https://lore.kernel.org/r/20211029072939.15767-1-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: event: report missing radar events
Lorenzo Bianconi [Fri, 12 Nov 2021 16:50:34 +0000 (17:50 +0100)] 
iw: event: report missing radar events

Properly report the two following radar events:
- NL80211_RADAR_PRE_CAC_EXPIRED
- NL80211_RADAR_CAC_STARTED

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/6a7cd7bd2179578335cc95b158faf21ba3f7876a.1636730634.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agobump version to 5.16 v5.16
Johannes Berg [Mon, 8 Nov 2021 08:58:10 +0000 (09:58 +0100)] 
bump version to 5.16

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoinfo: add FILS_CRYPTO_OFFLOAD extended feature
Johannes Berg [Mon, 8 Nov 2021 08:43:10 +0000 (09:43 +0100)] 
info: add FILS_CRYPTO_OFFLOAD extended feature

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoupdate nl80211.h
Johannes Berg [Mon, 8 Nov 2021 08:42:47 +0000 (09:42 +0100)] 
update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: print BSS coloring capability if supported
Lorenzo Bianconi [Thu, 21 Oct 2021 10:19:57 +0000 (12:19 +0200)] 
iw: print BSS coloring capability if supported

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/a935a11cabe630100385005b0c2bee9110fb9572.1634811514.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: add set sar_specs command
Zong-Zhe Yang [Thu, 7 Oct 2021 08:56:15 +0000 (16:56 +0800)] 
iw: add set sar_specs command

Add set sar_specs command

usage: iw <phy> set sar_specs <sar type> <range index:sar power>*
e.g.
iw phy0 set sar_specs 0 0:100 1:90 2:80...
where sar type should correspond to wiphy's sar_capa,
and range index should be valid in wiphy's sar_capa.

For now, kernel sar type supports only 0 (NL80211_SAR_TYPE_POWER)
which means that the sar power limitation is specified in 0.25dBm unit.

Cc: Carl Huang <cjhuang@codeaurora.org>
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://lore.kernel.org/r/20211007085615.40399-1-pkshih@realtek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: nl80211: add NLA_F_NESTED to nla_nest_start() with older libnl versions
Gokul Sivakumar [Fri, 10 Sep 2021 14:16:15 +0000 (19:46 +0530)] 
iw: nl80211: add NLA_F_NESTED to nla_nest_start() with older libnl versions

It is noticed in Kernel version 5.14.0-rc4+, that when sending the NL cmd
NL80211_CMD_SET_TID_CONFIG with nested attrs under NL80211_ATTR_TID_CONFIG,
kernel returnes a response with the error "NLA_F_NESTED is missing".

 $ sudo ./iw dev wlan0 set tidconf tids 0x1 ampdu on
 kernel reports: NLA_F_NESTED is missing
 command failed: Invalid argument (-22))

Fix this by setting NLA_F_NESTED flag everytime when using nla_nest_start()
library function. This is needed to make cfg80211 allow the nl80211 command
NL80211_ATTR_TID_CONFIG in the new kernel versions that enforce netlink
attribute policy validation.

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210910141618.1594617-1-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: mesh: add comments in the mesh confguration parameter printing sections
Gokul Sivakumar [Fri, 10 Sep 2021 14:16:18 +0000 (19:46 +0530)] 
iw: mesh: add comments in the mesh confguration parameter printing sections

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210910141618.1594617-4-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: event: add the missing time display format in the "iw event" help menu
Gokul Sivakumar [Fri, 10 Sep 2021 14:16:17 +0000 (19:46 +0530)] 
iw: event: add the missing time display format in the "iw event" help menu

The option used to print the events with timestamp in Human readable format
is not listed in the "$ iw event -h" output.

 $ ./iw event -h
 Usage:  ./iw [options] event [-t|-r] [-f] [-n]
 ...

So add "-T" option to the help menu.

 $ ./iw event -h
 Usage:  ./iw [options] event [-t|-T|-r] [-f] [-n]
 ...

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210910141618.1594617-3-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: link: mention the need for MAC addr arg in link get_sta cmd usage menu
Gokul Sivakumar [Fri, 10 Sep 2021 14:16:16 +0000 (19:46 +0530)] 
iw: link: mention the need for MAC addr arg in link get_sta cmd usage menu

The usage menu shown when running the hidden "link get_sta" command is not
mentioning the need for the MAC address argument. Without this, the cmd is
always failing with the output shown below.

 $ ./iw dev wlan0 link get_sta
 Usage:  ./iw [options] dev <devname> link get_sta
 ...

To avoid this, let the user know about the mandatory "MAC address" argument
like below.

 $ ./iw dev wlan0 link get_sta
 Usage:  ./iw [options] dev <devname> link get_sta <mac-addr>
 ...

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210910141618.1594617-2-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: fix vendor event static warnings
Johannes Berg [Wed, 8 Sep 2021 07:35:26 +0000 (09:35 +0200)] 
iw: fix vendor event static warnings

The vendor event section/descriptors can all be static,
adjust the macro accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: fix various sparse static warnings
Johannes Berg [Wed, 8 Sep 2021 07:34:20 +0000 (09:34 +0200)] 
iw: fix various sparse static warnings

The section macro must be non-static, but many of them
are not used outside a single file. Still declare all of
the sections so that the warnings go away.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: make parse_he_gi static
Johannes Berg [Wed, 8 Sep 2021 07:30:32 +0000 (09:30 +0200)] 
iw: make parse_he_gi static

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: add support for configuring the bss color for ranging measurements
Avraham Stern [Wed, 3 Feb 2021 09:32:35 +0000 (04:32 -0500)] 
iw: add support for configuring the bss color for ranging measurements

NDP ranging requires the BSS color as a parameter. Add it to the
measurement request config file parameters.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: update nl80211.h
Johannes Berg [Wed, 8 Sep 2021 07:27:29 +0000 (09:27 +0200)] 
iw: update nl80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: use cipher suite defines in util.c
Johannes Berg [Wed, 8 Sep 2021 07:23:09 +0000 (09:23 +0200)] 
iw: use cipher suite defines in util.c

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: add cipher suites definitions
Avraham Stern [Wed, 27 May 2020 08:33:52 +0000 (04:33 -0400)] 
iw: add cipher suites definitions

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
3 years agoiw: unify interface type list printing
Johannes Berg [Wed, 18 Aug 2021 12:22:57 +0000 (14:22 +0200)] 
iw: unify interface type list printing

Add two new functions print_iftype_list() and print_iftype_line()
to print interface lists, and use them where applicable.

Link: https://lore.kernel.org/r/20210818142256.3325c72c65e4.I844f8e382b0ecee00c21886342d0bfd70e246a9f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: mesh: add new cmd to dump all the supported mesh config params at once
Gokul Sivakumar [Thu, 5 Aug 2021 15:38:07 +0000 (21:08 +0530)] 
iw: mesh: add new cmd to dump all the supported mesh config params at once

The function print_mesh_param_handler() already supports printing all the
mesh config params when not passing one specific parameter, so add a new
"mesh_param dump" command to help the user see all the parameters at once.

$ iw dev mesh0 mesh_param dump
mesh_retry_timeout = 100 milliseconds
mesh_confirm_timeout = 100 milliseconds
mesh_holding_timeout = 100 milliseconds
mesh_max_peer_links = 99
mesh_max_retries = 3
mesh_ttl = 31
mesh_element_ttl = 31
mesh_auto_open_plinks = 0
mesh_hwmp_max_preq_retries = 4
mesh_path_refresh_time = 1000 milliseconds
mesh_min_discovery_timeout = 100 milliseconds
mesh_hwmp_active_path_timeout = 5000 TUs
mesh_hwmp_preq_min_interval = 10 TUs
mesh_hwmp_net_diameter_traversal_time = 50 TUs
mesh_hwmp_rootmode = 0
mesh_hwmp_rann_interval = 5000 TUs
mesh_gate_announcements = 0
mesh_fwding = 1
mesh_sync_offset_max_neighor = 50
mesh_rssi_threshold = 0 dBm
mesh_hwmp_active_path_to_root_timeout = 6000 TUs
mesh_hwmp_root_interval = 5000 TUs
mesh_hwmp_confirmation_interval = 2000 TUs
mesh_power_mode = active
mesh_awake_window = 10 TUs
mesh_plink_timeout = 0 seconds
mesh_connected_to_gate = 0

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210805153807.645106-2-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: mesh: fix crash when attempting to print the conf param "mesh_nolearn"
Gokul Sivakumar [Thu, 5 Aug 2021 15:38:06 +0000 (21:08 +0530)] 
iw: mesh: fix crash when attempting to print the conf param "mesh_nolearn"

Even if iw did not receive some of the meshconf attributes in response to
NL80211_CMD_GET_MESH_PARAMS, it tries to print that param and gets crashed.
Fix this by adding a condition check before trying to access each of the
mesh conf params.

$ iw dev mesh0 get mesh_param mesh_nolearn
Segmentation fault (core dumped)

 (gdb) bt
 #0  0x00007f21f54660e9 in nla_get_u8 () from /lib/x86_64-linux-gnu/libnl-3.so.200
 #1  0x0000562ba2f5d70d in _print_u8 (a=<optimized out>) at mesh.c:131
 #2  0x0000562ba2f5d7ce in print_mesh_param_handler (msg=<optimized out>,
     arg=0x562ba2f85758 <_mesh_param_descrs+1080>) at mesh.c:412
 #3  0x00007f21f546db9c in nl_recvmsgs_report () from /lib/x86_64-linux-gnu/libnl-3.so.200
 #4  0x00007f21f546e059 in nl_recvmsgs () from /lib/x86_64-linux-gnu/libnl-3.so.200
 #5  0x0000562ba2f5bb3b in __handle_cmd (state=0x7ffe677bc510, idby=II_NETDEV, argc=<optimized out>,
     argv=<optimized out>, cmdout=0x7ffe677bc508) at iw.c:541
 #6  0x0000562ba2f4fe0c in __handle_cmd (cmdout=0x7ffe677bc508, argv=0x7ffe677bc658, argc=4, idby=II_NETDEV,
     state=0x7ffe677bc510) at iw.c:613
 #7  main (argc=4, argv=0x7ffe677bc658) at iw.c:613
 (gdb) up 2
 #2  0x0000562ba2f5d7ce in print_mesh_param_handler (msg=<optimized out>,
     arg=0x562ba2f85758 <_mesh_param_descrs+1080>) at mesh.c:412
 412             mdescr->nla_print_fn(mesh_params[mdescr->mesh_param_num]);
 (gdb) i local
 mdescr = 0x562ba2f85758 <_mesh_param_descrs+1080>
 attrs = {0x0 <repeats 35 times>, 0x562ba4002a14, 0x0 <repeats 266 times>}
 parent_attr = <optimized out>
 mesh_params = {0x0, 0x562ba4002a20, 0x562ba4002a28, 0x562ba4002a30, 0x562ba4002a38, 0x562ba4002a40,
   0x562ba4002a48, 0x562ba4002a58, 0x562ba4002a68, 0x562ba4002a70, 0x562ba4002a78, 0x562ba4002a80,
   0x562ba4002a88, 0x562ba4002a98, 0x562ba4002aa0, 0x562ba4002a50, 0x562ba4002aa8, 0x562ba4002ab0,
   0x562ba4002a90, 0x562ba4002ab8, 0x562ba4002ac0, 0x562ba4002a60, 0x562ba4002ac8, 0x562ba4002ad0,
   0x562ba4002ad8, 0x562ba4002ae0, 0x562ba4002ae8, 0x562ba4002af0, 0x562ba4002af8, 0x562ba4002b00, 0x0, 0x0}
 gnlh = 0x562ba4002a10
 (gdb)
 (gdb) p mesh_params[30]
 $7 = (struct nlattr *) 0x0
 (gdb)

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210805153807.645106-1-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoiw: ps: fix "get power_save" documentation
Johannes Berg [Thu, 1 Jul 2021 16:09:45 +0000 (18:09 +0200)] 
iw: ps: fix "get power_save" documentation

This doesn't take any arguments, remove the "<param>"
string from the help.

Link: https://lore.kernel.org/r/20210701180945.45abdb0d4f52.Ifdc6ce8fdbf252019c080f609b6d95cec23d84ee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: add option to set auth type for connect
Jianhui Zhao [Sun, 30 May 2021 11:25:52 +0000 (19:25 +0800)] 
iw: add option to set auth type for connect

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Link: https://lore.kernel.org/r/20210530112552.577329-1-zhaojh329@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoupdate nl80211.h
Johannes Berg [Fri, 16 Apr 2021 09:32:41 +0000 (11:32 +0200)] 
update nl80211.h

Change-Id: Iff1e25d95a61a35fabd68fd94260e65909b14bd6
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: allow specifying CFLAGS/LIBS externally
Johannes Berg [Mon, 16 Nov 2020 09:43:12 +0000 (10:43 +0100)] 
iw: allow specifying CFLAGS/LIBS externally

If CFLAGS or LIBS are specified on the make command line,
then the += doesn't do anything. Add "override" directives
to still add the necessary libnl flags/libs.

Change-Id: Icdc3d14ae3a6f01b827c76e753c93fe8eb8fcec2
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: fix ftm_request missing arguments segfault
Benjamin Aschenbrenner [Sat, 10 Apr 2021 11:19:37 +0000 (13:19 +0200)] 
iw: fix ftm_request missing arguments segfault

When expected argument <config-file> is not passed to arguemts iw
segfaults.

Example: iw wlp2s0 measurement ftm_request

This fixes it.

Signed-off-by: Benjamin Aschenbrenner <benjamin.aschenbrenner@gmail.com>
Link: https://lore.kernel.org/r/20210410111937.32813-2-benjamin.aschenbrenner@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: fix mgmt dump missing arguments segfault
Benjamin Aschenbrenner [Sat, 10 Apr 2021 11:19:36 +0000 (13:19 +0200)] 
iw: fix mgmt dump missing arguments segfault

When expected arguments for mgmt command dump are left out iw segfaults.

Example: iw dev wlp2s0 mgmt dump frame e0

This fixes it.

Signed-off-by: Benjamin Aschenbrenner <benjamin.aschenbrenner@gmail.com>
Link: https://lore.kernel.org/r/20210410111937.32813-1-benjamin.aschenbrenner@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: Fix timestamp output on 32-bit architectures
Toke Høiland-Jørgensen [Thu, 18 Mar 2021 22:46:55 +0000 (23:46 +0100)] 
iw: Fix timestamp output on 32-bit architectures

On 32-bit architectures, time_t is 32-bit which causes overflows in the
arithmetic involving tv_sec, leading to invalid output. Fix this by
explicitly adding ULL suffixes to the constants used in those calculations.

Fixes: 3708f614dfdd ("iw: Print current time in station info dump")
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20210318224655.143489-1-toke@toke.dk
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agoiw: fix pointer arithmetic in __print_he_capa
Markus Theil [Sat, 13 Feb 2021 11:48:53 +0000 (12:48 +0100)] 
iw: fix pointer arithmetic in __print_he_capa

Found by fuzzing with clang fuzzer.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Link: https://lore.kernel.org/r/20210213114853.17276-1-markus.theil@tu-ilmenau.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>