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.
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.
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
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.
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>
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.
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>
...
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>
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.
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)
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>
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.
ivan tkachenko [Wed, 25 Nov 2020 01:50:48 +0000 (04:50 +0300)]
man: update wikipage URL, reformat SEE ALSO section
groff_man(7) provides plenty of useful requests/macros, and one of
them is .UR/.UE for URL formatting.
Man pages should be formatted with paragraphs (.P or .PP) requests,
and source text should not contain empty lines -- use empty request
instead (literally, single dot on its own line).
without this 11s mesh could not be configured with bandwidth 80MHz
in 6G band using iw. Also, this will be required to set frequency
for 6GHz band in 80MHz.
Brian Norris [Tue, 3 Nov 2020 23:56:31 +0000 (15:56 -0800)]
iw: handle positive error codes gracefully
netlink(7) requires error codes to be negative, but since when does a
man page stop anyone? At a minimum, we shouldn't allow a non-conforming
vendor command to put us into an infinite loop in the below snippets
from __handle_cmd():
Johannes Berg [Thu, 27 Aug 2020 11:07:31 +0000 (13:07 +0200)]
iw: add support for vendor events
We can already drop in arbitrary files for vendor commands
as the build system picks those up, also add support for
vendor specific events in a similar fashion.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Ilan Peer [Sun, 19 Jul 2020 07:44:24 +0000 (10:44 +0300)]
reg: Fix getting PHY specific regulatory information
Commit 14ad75d3b4c3 ("iw: support multiple regdom print") added
support for dumping multiple regulatory domain, with the intent
that if a specific phy is given, only its regulatory information
would be fetched. However, the phy specific handling was ignored.
Fix it.
Change-Id: I647ef420741e528a4d6568a7d4518c9a561bd199 Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Linus Lüssing [Wed, 17 Jun 2020 07:30:34 +0000 (09:30 +0200)]
iw: mesh: add mesh_param "mesh_nolearn" to skip path discovery
Currently, before being able to forward a packet between two 802.11s
nodes, both a PLINK handshake is performed upon receiving a beacon and
then later a PREQ/PREP exchange for path discovery is performed on
demand upon receiving a data frame to forward.
When running a mesh protocol on top of an 802.11s interface, like
batman-adv, we do not need the multi-hop mesh routing capabilities of
802.11s and usually set mesh_fwding=0. However, even with mesh_fwding=0
the PREQ/PREP path discovery is still performed on demand. Even though
in this scenario the next hop PREQ/PREP will determine is always the
direct 11s neighbor node.
The new mesh_nolearn parameter allows to skip the PREQ/PREP exchange in
this scenario, leading to a reduced delay, reduced packet buffering and
simplifies HWMP in general.
mesh_nolearn is still rather conservative in that if the packet destination
is not a direct 11s neighbor, it will fall back to PREQ/PREP path
discovery.
For normal, multi-hop 802.11s mesh routing it is usually not advisable
to enable mesh_nolearn as a transmission to a direct but distant neighbor
might be worse than reaching that same node via a more robust /
higher throughput etc. multi-hop path.