]> git.ipfire.org Git - thirdparty/iproute2.git/log
thirdparty/iproute2.git
13 months agoip: bridge: add support for mst_enabled
Tobias Waldekranz [Mon, 24 Jun 2024 13:00:33 +0000 (15:00 +0200)] 
ip: bridge: add support for mst_enabled

When enabled, the bridge's legacy per-VLAN STP facility is replaced
with the Multiple Spanning Tree Protocol (MSTP) compatible version.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
13 months agodevlink: print missing params even if an unknown one is present
Przemek Kitszel [Wed, 3 Jul 2024 13:15:20 +0000 (15:15 +0200)] 
devlink: print missing params even if an unknown one is present

Print all of the missing parameters, also in the presence of unknown ones.

Take for example a correct command:
    $ devlink resource set pci/0000:01:00.0 path /kvd/linear size 98304
And remove the "size" keyword:
    $ devlink resource set pci/0000:01:00.0 path /kvd/linear 98304
That yields output:
    Resource size expected.
    Unknown option "98304"

Prior to the patch only the last line of output was present. And if user
would forgot also the "path" keyword, there will be additional line:
    Resource path expected.
in the stderr.

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
13 months agordma: Supports to add/delete a device with type SMI
Mark Zhang [Thu, 4 Jul 2024 06:29:01 +0000 (09:29 +0300)] 
rdma: Supports to add/delete a device with type SMI

This patch adds a new device attribute "type", as well as supports to
add and delete a rdma device with a specific type. This new device
provides a subset of functionalists defined in IBTA spec.

Currently only type "SMI" is supported: A SMI device provides SMI (QP0)
interface; This device and it's parent associates with the same HCA port
and shares the physical link, so when the parent doesn't support SMI,
It allows the subnet manager to configure the link.

This patch also supports to print device type and parent if any.

Examples:
$ rdma dev add smi1 type SMI parent ibp8s0f1
$ rdma dev show smi1
2: smi1: node_type ca fw 20.38.1002 node_guid 9803:9b03:009f:d5ef sys_image_guid 9803:9b03:009f:d5ee type smi parent ibp8s0f1
$ rdma dev del smi1

Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Acked-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
13 months agordma: update uapi header
Mark Zhang [Thu, 4 Jul 2024 06:29:00 +0000 (09:29 +0300)] 
rdma: update uapi header

Update rdma_netlink.h file upto kernel commit 294424839b5e
("RDMA/nldev: Add support to dump device type and parent device if exists")

Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Acked-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
14 months agoxfrm: document new SA direction option
Christian Hopps [Thu, 23 May 2024 15:17:07 +0000 (11:17 -0400)] 
xfrm: document new SA direction option

Signed-off-by: Christian Hopps <chopps@labn.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
14 months agoxfrm: add SA direction attribute
Christian Hopps [Thu, 23 May 2024 15:17:06 +0000 (11:17 -0400)] 
xfrm: add SA direction attribute

Add support for new SA direction netlink attribute.

Co-developed-by: Antony Antony <antony.antony@secunet.com>
Co-developed-by: Christian Hopps <chopps@labn.net>
Signed-off-by: Christian Hopps <chopps@labn.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
14 months agoss: use COLUMNS from the environment, if TIOCGWINSZ fails
Dragan Simic [Tue, 21 May 2024 10:04:52 +0000 (12:04 +0200)] 
ss: use COLUMNS from the environment, if TIOCGWINSZ fails

Use the COLUMNS environment variable [1] when determining the screen width,
if using TIOCGWINSZ isn't possible or if it fails.  This allows better use
of the available horizontal screen space in certain scenarios, and makes
the produced outputs more readable, as described further below.

All major shells can maintain the COLUMNS variable according to the current
screen size, [2][3][4] but this shell variable isn't actually an environment
variable, i.e. it doesn't get exported to the shell subprocesses by default.
For example, no COLUMNS environment variable reaches ss(8) when it's executed
as part of a shell pipeline or inside a shell script.

Though, users can opt to export the COLUMNS variable by hand, or they can
rely on some other utilities to do that for them.  A good example of such
utilities is watch(1) that exports COLUMNS as an environment variable to
the processes it executes. [5]  Using ss(8) together with watch(1) is rather
useful, and honoring the exported COLUMNS variable makes the outputs produced
by ss(8) in this scenario more readable.

The behavior of shells, which don't export the COLUMNS variable by default,
makes this change safe in the sense of not affecting the usual shell pipeline
workflows or various shell scripts that use ss(8).

[1] https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/basedefs/V1_chap08.html
[2] https://man.archlinux.org/man/bash.1.en#COLUMNS
[3] https://man.archlinux.org/man/tcsh.1.en#Terminal_management_(+)
[4] https://man.archlinux.org/man/zshall.1.en#Configuration
[5] https://gitlab.com/procps-ng/procps/-/blob/master/NEWS?ref_type=heads#L623

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
14 months agoMerge remote-tracking branch 'main/main' into next
David Ahern [Fri, 24 May 2024 20:36:16 +0000 (14:36 -0600)] 
Merge remote-tracking branch 'main/main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
14 months agoFix usage of poll.h header
Ismael Luceno [Sat, 18 May 2024 22:39:44 +0000 (00:39 +0200)] 
Fix usage of poll.h header

Change the legacy <sys/poll.h> to <poll.h> (POSIX.1-2001).

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
14 months agouapi: update to pre 6.10-rc1 headers
Stephen Hemminger [Mon, 20 May 2024 15:45:51 +0000 (08:45 -0700)] 
uapi: update to pre 6.10-rc1 headers

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agortmon: Align usage with ip help
Yedaya Katsman [Mon, 13 May 2024 18:52:17 +0000 (21:52 +0300)] 
rtmon: Align usage with ip help

Also update the man page accordingly, and add ip-monitor to see also

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agobridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl systems
Gabi Falk [Fri, 10 May 2024 14:36:12 +0000 (14:36 +0000)] 
bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl systems

On glibc based systems the definition of 'struct timeval' is pulled in
with inclusion of <stdlib.h> header, but on musl based systems it
doesn't work this way.  Missing definition triggers an
incompatible-pointer-types error with gcc 14 (warning on previous
versions of gcc):

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
   80 | _PRINT_FUNC(tv, const struct timeval *)
      |                              ^~~~~~~
../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC'
   50 |                                     type value);                        \
      |                                     ^~~~
../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
   80 | _PRINT_FUNC(tv, const struct timeval *)
      |                              ^~~~~~~
../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC'
   55 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function 'print_tv':
../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types]
   58 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *

Signed-off-by: Gabi Falk <gabifalk@gmx.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoMerge git://git.kernel.org/pub/scm/network/iproute2/iproute2-next
Stephen Hemminger [Mon, 13 May 2024 23:21:11 +0000 (16:21 -0700)] 
Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-next

15 months agov6.9.0 v6.9.0
Stephen Hemminger [Mon, 13 May 2024 03:07:45 +0000 (20:07 -0700)] 
v6.9.0

15 months agouapi: spelling fix for xfrm.h
Stephen Hemminger [Fri, 10 May 2024 23:19:35 +0000 (16:19 -0700)] 
uapi: spelling fix for xfrm.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoman: fix typo in tc-mirred man page
Andrea Claudi [Wed, 8 May 2024 10:38:52 +0000 (12:38 +0200)] 
man: fix typo in tc-mirred man page

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoip: Add missing options to route get help output
Yedaya Katsman [Mon, 6 May 2024 18:42:56 +0000 (21:42 +0300)] 
ip: Add missing options to route get help output

The "as", "to", "connected" and "notify" options were missing from the
help message in the route get section. Add them to usage help and man
page.

Note that there isn't an explanation for "as" or "notify" in the man
page.

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoMerge remote-tracking branch 'main/main' into next
David Ahern [Fri, 3 May 2024 15:40:02 +0000 (15:40 +0000)] 
Merge remote-tracking branch 'main/main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoip link: hsr: Add support for passing information about INTERLINK device
Lukasz Majewski [Mon, 29 Apr 2024 09:23:09 +0000 (11:23 +0200)] 
ip link: hsr: Add support for passing information about INTERLINK device

The HSR capable device can operate in two modes of operations -
Doubly Attached Node for HSR (DANH) and RedBOX (HSR-SAN).

The latter one allows connection of non-HSR aware device(s) to HSR
network.
This node is called SAN (Singly Attached Network) and is connected via
INTERLINK network device.

This patch adds support for passing information about the INTERLINK
device, so the Linux driver can properly setup it.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoUpdate kernel headers
David Ahern [Fri, 3 May 2024 15:18:43 +0000 (15:18 +0000)] 
Update kernel headers

Update kernel headers to commit:
    5829614a7b3b ("Merge branch 'net-sysctl-sentinel'")

Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agordma: Add an option to display driver-specific QPs in the rdma tool
Chiara Meiohas [Tue, 30 Apr 2024 10:18:20 +0000 (13:18 +0300)] 
rdma: Add an option to display driver-specific QPs in the rdma tool

Utilize the -dd flag (driver-specific details) in the rdmatool
to view driver-specific QPs which are not exposed yet.

The following examples show mlx5 UMR QP which is visible now:

$ rdma resource show qp link ibp8s0f1
link ibp8s0f1/1 lqpn 360 type UD state RTS sq-psn 0 comm [mlx5_ib]
link ibp8s0f1/1 lqpn 0 type SMI state RTS sq-psn 0 comm [ib_core]
link ibp8s0f1/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]

$ rdma resource show qp link ibp8s0f1 -dd
link ibp8s0f1/1 lqpn 360 type UD state RTS sq-psn 0 comm [mlx5_ib]
link ibp8s0f1/1 lqpn 465 type DRIVER subtype REG_UMR state RTS sq-psn 0 comm [mlx5_ib]
link ibp8s0f1/1 lqpn 0 type SMI state RTS sq-psn 0 comm [ib_core]
link ibp8s0f1/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]

$ rdma resource show
0: ibp8s0f0: pd 3 cq 4 qp 3 cm_id 0 mr 0 ctx 0 srq 2
1: ibp8s0f1: pd 3 cq 4 qp 3 cm_id 0 mr 0 ctx 0 srq 2

$ rdma resource show -dd
0: ibp8s0f0: pd 3 cq 4 qp 4 cm_id 0 mr 0 ctx 0 srq 2
1: ibp8s0f1: pd 3 cq 4 qp 4 cm_id 0 mr 0 ctx 0 srq 2

Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agordma: update uapi header
Chiara Meiohas [Tue, 30 Apr 2024 10:18:19 +0000 (13:18 +0300)] 
rdma: update uapi header

Update rdma_netlink.h file up to kernel commit e18fa0bbcedf
("RDMA/core: Add an option to display driver-specific QPs in the rdmatool")

Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agouapi: update vdpa.h
Stephen Hemminger [Mon, 29 Apr 2024 18:28:23 +0000 (11:28 -0700)] 
uapi: update vdpa.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoip: Exit exec in child process if setup fails
Yedaya Katsman [Tue, 23 Apr 2024 18:38:20 +0000 (21:38 +0300)] 
ip: Exit exec in child process if setup fails

If we forked, returning from the function will make the calling code to
continue in both the child and parent process. Make cmd_exec exit if
setup failed and it forked already.

An example of issues this causes, where a failure in setup causes
multiple unnecessary tries:

```
$ ip netns
ef
ab
$ ip -all netns exec ls

netns: ef
setting the network namespace "ef" failed: Operation not permitted

netns: ab
setting the network namespace "ab" failed: Operation not permitted

netns: ab
setting the network namespace "ab" failed: Operation not permitted
```

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agoMerge branch 'pfcp' into next
David Ahern [Tue, 23 Apr 2024 16:29:52 +0000 (16:29 +0000)] 
Merge branch 'pfcp' into next

Wojciech Drewek  says:

====================

New PFCP module was accepted in the kernel together with cls_flower
changes which allow to filter the packets using PFCP specific fields [1].
Packet Forwarding Control Protocol is a 3GPP Protocol defined in
TS 29.244 [2].

Extended ip link with the support for the new PFCP device.
Add pfcp_opts support in tc-flower.

[1] https://lore.kernel.org/netdev/171196563119.11638.12210788830829801735.git-patchwork-notify@kernel.org/
[2] https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3111

====================

Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agouse missing argument helper
Stephen Hemminger [Tue, 23 Apr 2024 16:01:46 +0000 (09:01 -0700)] 
use missing argument helper

There is a helper in utilities to handle missing argument,
but it was not being used consistently.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agof_flower: implement pfcp opts
Michal Swiatkowski [Mon, 22 Apr 2024 12:05:51 +0000 (14:05 +0200)] 
f_flower: implement pfcp opts

Allow adding tc filter for PFCP header.

Add support for parsing TCA_FLOWER_KEY_ENC_OPTS_PFCP.
Options are as follows: TYPE:SEID.

TYPE is a 8-bit value represented in hex and can be  1
for session header and 0 for node header. In PFCP packet
this is S flag in header.

SEID is a 64-bit session id value represented in hex.

This patch enables adding hardware filters using PFCP fields, see [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=d823265dd45bbf14bd67aa476057108feb4143ce

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoip: PFCP device support
Wojciech Drewek [Mon, 22 Apr 2024 12:05:50 +0000 (14:05 +0200)] 
ip: PFCP device support

Packet Forwarding Control Protocol is a 3GPP Protocol defined in
TS 29.244 [1]. Add support for PFCP device type in ip link.
It is capable of receiving PFCP messages and extracting its
metadata (session ID).

Its only purpose is to be used together with tc flower to create
SW/HW filters.

PFCP module does not take any netlink attributes so there is no
need to parse any args. Add new sections to the man to let the
user know about new device type.

[1] https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3111

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoman: fix doc, ip link does support "change"
Jiayun Chen [Tue, 16 Apr 2024 01:32:15 +0000 (09:32 +0800)] 
man: fix doc, ip link does support "change"

ip link does support "change".

if (matches(*argv, "set") == 0 ||
    matches(*argv, "change") == 0)
    return iplink_modify(RTM_NEWLINK, 0,
                 argc-1, argv+1);

The attached patch documents this.

Signed-off-by: Jiayun Chen <jiayunchen@smail.nju.edu.cn>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agotc/util: remove unused argument from print_tcstats2_attr
Stephen Hemminger [Sat, 13 Apr 2024 22:04:06 +0000 (15:04 -0700)] 
tc/util: remove unused argument from print_tcstats2_attr

The function doesn't use the FILE handle.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agotc/police: remove unused argument to tc_print_police
Stephen Hemminger [Sat, 13 Apr 2024 22:04:05 +0000 (15:04 -0700)] 
tc/police: remove unused argument to tc_print_police

FILE handle no longer used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agotc/util: remove unused argument from print_action_control
Stephen Hemminger [Sat, 13 Apr 2024 22:04:04 +0000 (15:04 -0700)] 
tc/util: remove unused argument from print_action_control

The FILE handle is no longer used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agotc/util: remove unused argument from print_tm
Stephen Hemminger [Sat, 13 Apr 2024 22:04:03 +0000 (15:04 -0700)] 
tc/util: remove unused argument from print_tm

File argument no longer used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agotc/u32: remove FILE argument
Stephen Hemminger [Sat, 13 Apr 2024 22:04:02 +0000 (15:04 -0700)] 
tc/u32: remove FILE argument

The pretty printing routines no longer use the file handle.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoMerge remote-tracking branch 'main/main' into next
David Ahern [Sun, 21 Apr 2024 01:12:29 +0000 (01:12 +0000)] 
Merge remote-tracking branch 'main/main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
15 months agoman: use clsact qdisc for port mirroring examples on matchall and mirred
Arınç ÜNAL [Sat, 13 Apr 2024 14:48:48 +0000 (17:48 +0300)] 
man: use clsact qdisc for port mirroring examples on matchall and mirred

The clsact qdisc supports ingress and egress. Instead of using two qdiscs
to do ingress and egress port mirroring, clsact can be used. Therefore, use
clsact for the port mirroring examples on the tc-matchall.8 and tc-mirred.8
documents.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
15 months agomnl: initialize generic netlink version
Stephen Hemminger [Mon, 15 Apr 2024 16:09:55 +0000 (09:09 -0700)] 
mnl: initialize generic netlink version

The version field in mnlu was being passed in but never set.
This meant that all places mnlu_gen_socket was used, the version would
be uninitialized data from malloc().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoss: mptcp: print out last time counters
Geliang Tang [Fri, 12 Apr 2024 08:19:52 +0000 (10:19 +0200)] 
ss: mptcp: print out last time counters

Three new "last time" counters have been added to "struct mptcp_info":
last_data_sent, last_data_recv and last_ack_recv. They have been added
in commit 18d82cde7432 ("mptcp: add last time fields in mptcp_info") in
net-next recently.

This patch prints out these new counters into mptcp_stats output in ss.

Signed-off-by: Geliang Tang <geliang@kernel.org>
Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agodevlink: Support setting max_io_eqs
Parav Pandit [Wed, 10 Apr 2024 11:58:08 +0000 (14:58 +0300)] 
devlink: Support setting max_io_eqs

Devices send event notifications for the IO queues,
such as tx and rx queues, through event queues.

Enable a privileged owner, such as a hypervisor PF, to set the number
of IO event queues for the VF and SF during the provisioning stage.

example:
Get maximum IO event queues of the VF device::

  $ devlink port show pci/0000:06:00.0/2
  pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
      function:
          hw_addr 00:00:00:00:00:00 ipsec_packet disabled max_io_eqs 10

Set maximum IO event queues of the VF device::

  $ devlink port function set pci/0000:06:00.0/2 max_io_eqs 32

  $ devlink port show pci/0000:06:00.0/2
  pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
      function:
          hw_addr 00:00:00:00:00:00 ipsec_packet disabled max_io_eqs 32

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoUpdate kernel headers
David Ahern [Sat, 13 Apr 2024 16:32:58 +0000 (16:32 +0000)] 
Update kernel headers

Update kernel headers to commit:
    32affa5578f0 ("fib: rules: no longer hold RTNL in fib_nl_dumprule()")

Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoip: Support filter links with no VF info
renmingshuai [Thu, 11 Apr 2024 02:43:19 +0000 (10:43 +0800)] 
ip: Support filter links with no VF info

Kernel has add IFLA_EXT_MASK attribute for indicating that certain
extended ifinfo values are requested by the user application. The ip
link show cmd always request VFs extended ifinfo.

In this case, RTM_GETLINK for greater than about 220 VFs truncates
IFLA_VFINFO_LIST due to the maximum reach of nlattr's nla_len being
exceeded. As a result, ip link show command only show the truncated
VFs info sucn as:

    #ip link show dev eth0
    1: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 ...
        link/ether ...
        vf 0     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff ...
    Truncated VF list: eth0

This patch add novf to support filter links with no VF info:
ip link show novf

v2:
- use an one word option instead of an option with on/off.
- fix the issue that break changes made for the link filter
  already done for VF's.

v3:
- "novf" set vfinfo to 0 and the RTEXT_FILTER_VF flag is not added.

Signed-off-by: Mingshuai Ren <renmingshuai@huawei.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoman: fix brief explanation of `ip netns attach NAME PID`
Yusuke Ichiki [Tue, 2 Apr 2024 02:08:17 +0000 (11:08 +0900)] 
man: fix brief explanation of `ip netns attach NAME PID`

Rewrite the explanation as it was duplicated with that of
`ip netns add NAME`.

Signed-off-by: Yusuke Ichiki <public@yusuke.pub>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoarpd: create /var/lib/arpd on first use
Max Gautier [Mon, 18 Mar 2024 15:49:13 +0000 (16:49 +0100)] 
arpd: create /var/lib/arpd on first use

The motivation is to build distributions packages without /var to go
towards stateless systems, see link below (TL;DR: provisionning anything
outside of /usr on boot).

We only try do create the database directory when it's in the default
location, and assume its parent (/var/lib in the usual case) exists.

Links: https://0pointer.net/blog/projects/stateless.html
Signed-off-by: Max Gautier <mg@max.gautier.name>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoila: allow show, list and lst as synonyms
Stephen Hemminger [Wed, 27 Mar 2024 23:55:09 +0000 (16:55 -0700)] 
ila: allow show, list and lst as synonyms

Across ip commands show, list and misspelling lst are treated
the same.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agobridge: vlan: fix compressvlans usage
Date Huang [Fri, 22 Mar 2024 12:39:23 +0000 (20:39 +0800)] 
bridge: vlan: fix compressvlans usage

Add the missing 'compressvlans' to man page

Signed-off-by: Date Huang <tjjh89017@hotmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agobridge: vlan: fix compressvlans usage
Date Huang [Fri, 22 Mar 2024 12:39:22 +0000 (20:39 +0800)] 
bridge: vlan: fix compressvlans usage

Fix the incorrect short opt for compressvlans and color
in usage

Signed-off-by: Date Huang <tjjh89017@hotmail.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agouapi: update vdpa.h
Stephen Hemminger [Mon, 25 Mar 2024 01:16:06 +0000 (18:16 -0700)] 
uapi: update vdpa.h

Autogenerated from 6.9-rc1.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoifstat: don't set errno if strdup fails
Denis Kirjanov [Mon, 18 Mar 2024 09:16:40 +0000 (05:16 -0400)] 
ifstat: don't set errno if strdup fails

the strdup man page states that the errno value
set by the function so there is not need to set it.

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoifstat: handle strdup return value
Denis Kirjanov [Mon, 18 Mar 2024 09:15:41 +0000 (05:15 -0400)] 
ifstat: handle strdup return value

get_nlmsg_extended is missing the check as
it's done in get_nlmsg

v2: don't set the errno value explicitly

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agouapi: update headers
Stephen Hemminger [Sat, 16 Mar 2024 15:14:56 +0000 (08:14 -0700)] 
uapi: update headers

User headers based on pre 6.9-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
16 months agoMerge branch 'nexthop-grp-stats' into next
David Ahern [Fri, 15 Mar 2024 15:05:23 +0000 (15:05 +0000)] 
Merge branch 'nexthop-grp-stats' into next

Petr Machata  says:

====================

Next hop group stats allow verification of balancedness of a next hop
group. The feature was merged in kernel commit 7cf497e5a122 ("Merge branch
'nexthop-group-stats'"). This patchset adds to ip the corresponding
support.

NH group stats come in two flavors: as statistics for SW and for HW
datapaths. The former is shown when -s is given to "ip nexthop". The latter
demands more work from the kernel, and possibly driver and HW, and might
not be always necessary. Therefore tie it to -s -s, similarly to how ip
link shows more detailed stats when -s is given twice.

Here's an example usage:

 # ip link add name gre1 up type gre \
      local 172.16.1.1 remote 172.16.1.2 tos inherit
 # ip nexthop replace id 1001 dev gre1
 # ip nexthop replace id 1002 dev gre1
 # ip nexthop replace id 1111 group 1001/1002 hw_stats on
 # ip -s -s -j -p nexthop show id 1111
 [ {
  [ ...snip... ]
         "hw_stats": {
             "enabled": true,
             "used": true
         },
         "group_stats": [ {
                 "id": 1001,
                 "packets": 0,
                 "packets_hw": 0
             },{
                 "id": 1002,
                 "packets": 0,
                 "packets_hw": 0
             } ]
     } ]

hw_stats.enabled shows whether hw_stats have been requested for the given
group. hw_stats.used shows whether any driver actually implemented the
counter. group_stats[].packets show the total stats, packets_hw only the
HW-datapath stats.

====================

Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoip: ipnexthop: Allow toggling collection of nexthop group HW statistics
Petr Machata [Thu, 14 Mar 2024 14:52:15 +0000 (15:52 +0100)] 
ip: ipnexthop: Allow toggling collection of nexthop group HW statistics

Besides SW datapath stats, the kernel also support collecting statistics
from HW datapath, for nexthop groups offloaded to HW. Since collection of
these statistics may consume HW resources, there is an interface to request
that the HW stats be recorded. Add this toggle to "ip nexthop".

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoip: ipnexthop: Support dumping next hop group HW stats
Petr Machata [Thu, 14 Mar 2024 14:52:14 +0000 (15:52 +0100)] 
ip: ipnexthop: Support dumping next hop group HW stats

Besides SW datapath stats, the kernel also support collecting statistics
from HW datapath, for nexthop groups offloaded to HW. Request that these be
collected when ip is given "-s -s", similarly to how "ip link" shows more
statistics in that case.

Besides the statistics themselves, also show whether the collection of HW
statistics was in fact requested, and whether any driver actually
implemented the request.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoip: ipnexthop: Support dumping next hop group stats
Petr Machata [Thu, 14 Mar 2024 14:52:13 +0000 (15:52 +0100)] 
ip: ipnexthop: Support dumping next hop group stats

Next hop group stats allow verification of balancedness of a next hop
group. The feature was merged in kernel commit 7cf497e5a122 ("Merge branch
'nexthop-group-stats'"). Add to ip the corresponding support. The
statistics are requested if "ip nexthop" is started with -s.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agolibnetlink: Add rta_getattr_uint()
Petr Machata [Thu, 14 Mar 2024 14:52:12 +0000 (15:52 +0100)] 
libnetlink: Add rta_getattr_uint()

NLA_UINT attributes have a 4-byte payload if possible, and an 8-byte one if
necessary. Add a function to extract these. Since we need to dispatch on
length anyway, make the getter truly universal by supporting also u8 and
u16.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
16 months agoUpdate kernel headers
David Ahern [Fri, 15 Mar 2024 15:02:15 +0000 (15:02 +0000)] 
Update kernel headers

Update kernel headers to commit:
    237bb5f7f7f5 ("cxgb4: unnecessary check for 0 in the free_sge_txq_uld() function")

Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agotc-simple.8: take Jamal's prompt off examples
Stephen Hemminger [Tue, 12 Mar 2024 22:44:50 +0000 (15:44 -0700)] 
tc-simple.8: take Jamal's prompt off examples

The examples on tc-simple man page had extra stuff in
the prompt which is not necessary.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agosimple: support json output
Stephen Hemminger [Tue, 12 Mar 2024 22:42:16 +0000 (15:42 -0700)] 
simple: support json output

Last action that never got JSON support.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoskbmod: support json in print
Stephen Hemminger [Tue, 12 Mar 2024 22:40:59 +0000 (15:40 -0700)] 
skbmod: support json in print

This tc action never got jsonized.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agopedit: log errors to stderr
Stephen Hemminger [Tue, 12 Mar 2024 22:40:26 +0000 (15:40 -0700)] 
pedit: log errors to stderr

The errors should bo to stderr, not to stdout.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: support JSON for legacy stats
Stephen Hemminger [Mon, 11 Mar 2024 19:26:35 +0000 (12:26 -0700)] 
tc: support JSON for legacy stats

The extended stats already supported JSON output, add to the
legacy stats as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoman: fix typo found by Lintian
Luca Boccassi [Tue, 12 Mar 2024 22:24:22 +0000 (22:24 +0000)] 
man: fix typo found by Lintian

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: remove no longer used helpers
Stephen Hemminger [Fri, 8 Mar 2024 17:16:01 +0000 (09:16 -0800)] 
tc: remove no longer used helpers

The removal of tick usage in netem, means that some of the
helper functions in tc are no longer used and can be safely removed.
Other functions can be made static.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agonetem: use 64 bit value for latency and jitter
Stephen Hemminger [Wed, 13 Mar 2024 16:54:44 +0000 (09:54 -0700)] 
netem: use 64 bit value for latency and jitter

The current version of netem in iproute2 has a maximum of 4.3 seconds
because of scaled 32 bit clock values. Some users would like to be
able to use larger delays to emulate things like storage delays.

Since kernel version 4.15, netem qdisc had netlink parameters
to express wider range of delays in nanoseconds. But the iproute2
side was never updated to use them.

This does break compatibility with older kernels (4.14 and earlier).
With these out of support kernels, the latency/delay parameter
will end up being ignored.

Reported-by: Marc Blanchet <marc.blanchet@viagenie.ca>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoREADME: add note about kernel version compatibility
Stephen Hemminger [Fri, 8 Mar 2024 17:15:59 +0000 (09:15 -0800)] 
README: add note about kernel version compatibility

Since next netem changes will break some usages of out of support kernels,
add an explicit policy about range of kernel versions.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: make exec_util arg const
Stephen Hemminger [Mon, 11 Mar 2024 23:14:18 +0000 (16:14 -0700)] 
tc: make exec_util arg const

The callbacks in exec_util should not be modifying underlying
qdisc operations structure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: make action_util arg const
Stephen Hemminger [Mon, 11 Mar 2024 23:12:30 +0000 (16:12 -0700)] 
tc: make action_util arg const

The callbacks in action_util should not be modifying underlying
qdisc operations structure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: make filter_util args const
Stephen Hemminger [Mon, 11 Mar 2024 23:10:24 +0000 (16:10 -0700)] 
tc: make filter_util args const

The callbacks in filter_util should not be modifying underlying
qdisc operations structure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: make qdisc_util arg const
Stephen Hemminger [Mon, 11 Mar 2024 23:08:34 +0000 (16:08 -0700)] 
tc: make qdisc_util arg const

The callbacks in qdisc_util should not be modifying underlying
qdisc operations structure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoMerge branch 'main' of git://git.kernel.org/pub/scm/network/iproute2/iproute2-next
Stephen Hemminger [Mon, 11 Mar 2024 23:39:39 +0000 (16:39 -0700)] 
Merge branch 'main' of git://git.kernel.org/pub/scm/network/iproute2/iproute2-next

17 months agotc/action: remove trailing whitespace
Stephen Hemminger [Mon, 11 Mar 2024 17:32:05 +0000 (10:32 -0700)] 
tc/action: remove trailing whitespace

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agort_names: whitespace cleanup
Stephen Hemminger [Mon, 11 Mar 2024 16:18:44 +0000 (09:18 -0700)] 
rt_names: whitespace cleanup

Fix indentation.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agov6.8.0 v6.8.0
Stephen Hemminger [Mon, 11 Mar 2024 15:53:55 +0000 (08:53 -0700)] 
v6.8.0

17 months agoiproute2: move generic_proc_open into lib
Denis Kirjanov [Mon, 4 Mar 2024 14:13:40 +0000 (09:13 -0500)] 
iproute2: move generic_proc_open into lib

the function has the same definition in ifstat and ss

v2: fix the typo in the chagelog
v3: rebase on master

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoifstat: support 64 interface stats
Stephen Hemminger [Thu, 29 Feb 2024 04:37:28 +0000 (20:37 -0800)] 
ifstat: support 64 interface stats

The 32 bit statistics are problematic since 32 bit value can
easily wraparound at high speed. Use 64 bit stats if available.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoss: fix output of MD5 signature keys configured on TCP sockets
Lars Ellenberg [Fri, 1 Mar 2024 12:33:24 +0000 (13:33 +0100)] 
ss: fix output of MD5 signature keys configured on TCP sockets

da9cc6ab introduced printing of MD5 signature keys when found.
But when changing printf() to out() calls with 90351722,
the implicit printf call in print_escape_buf() was overlooked.
That results in a funny output in the first line:
"<all-your-tcp-signature-keys-concatenated>State"
and ambiguity as to which of those bytes belong to which socket.

Add a static void out_escape_buf() immediately before we use it.

da9cc6ab (ss: print MD5 signature keys configured on TCP sockets, 2017-10-06)
90351722 (ss: Replace printf() calls for "main" output by calls to helper, 2017-12-12)

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: Fix json output for f_u32
Takanori Hirano [Mon, 4 Mar 2024 12:02:04 +0000 (12:02 +0000)] 
tc: Fix json output for f_u32

Signed-off-by: Takanori Hirano <me@hrntknr.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoifstat: handle unlink return value
Denis Kirjanov [Thu, 29 Feb 2024 12:26:34 +0000 (07:26 -0500)] 
ifstat: handle unlink return value

Print an error message if we can't remove the history file

v2: exit if unlink failed
v3: restore the changelog

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agonstat: convert sprintf to snprintf
Denis Kirjanov [Wed, 28 Feb 2024 13:58:58 +0000 (08:58 -0500)] 
nstat: convert sprintf to snprintf

Use snprintf to print only valid data.
That's the similar change done for ifstat.

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agonstat: use stack space for history file name
Denis Kirjanov [Wed, 28 Feb 2024 13:58:57 +0000 (08:58 -0500)] 
nstat: use stack space for history file name

as the name doesn't require a lot of storage put
it on the stack. Moreover the memory allocated via
malloc wasn't returned.

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agonstat: constify name argument in generic_proc_open
Denis Kirjanov [Wed, 28 Feb 2024 13:58:56 +0000 (08:58 -0500)] 
nstat: constify name argument in generic_proc_open

the argument passed to the function
is always a constant value

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoman8: ioam: add doc for monitor command
Justin Iurman [Thu, 22 Feb 2024 15:45:39 +0000 (16:45 +0100)] 
man8: ioam: add doc for monitor command

Add a sentence in the doc to describe what the new "monitor" command
does.

Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoip: ioam6: add monitor command
Justin Iurman [Thu, 22 Feb 2024 15:45:38 +0000 (16:45 +0100)] 
ip: ioam6: add monitor command

Add the "ip ioam monitor" command to be able to read all IOAM data
received. This is based on a netlink multicast group.

Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoUpdate kernel headers
David Ahern [Sun, 3 Mar 2024 22:24:26 +0000 (22:24 +0000)] 
Update kernel headers

Update kernel headers to commit
    4b2765ae410a ("Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")

Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agouapi: update in6.h
Stephen Hemminger [Fri, 1 Mar 2024 00:09:24 +0000 (16:09 -0800)] 
uapi: update in6.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoMerge remote-tracking branch 'main/main' into next
David Ahern [Tue, 27 Feb 2024 04:09:35 +0000 (04:09 +0000)] 
Merge remote-tracking branch 'main/main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoMerge branch 'ss-socket-local-storage' into next
David Ahern [Tue, 27 Feb 2024 04:08:34 +0000 (04:08 +0000)] 
Merge branch 'ss-socket-local-storage' into next

Quentin Deslandes  says:

====================

BPF allows programs to store socket-specific data using
BPF_MAP_TYPE_SK_STORAGE maps. The data is attached to the socket itself,
and Martin added INET_DIAG_REQ_SK_BPF_STORAGES, so it can be fetched
using the INET_DIAG mechanism.

Currently, ss doesn't request the socket-local data, this patch aims to
fix this.

The first patch requests the socket-local data for the requested map ID
(--bpf-map-id=) or all the maps (--bpf-maps). It then prints the map_id
in COL_EXT.

Patch #2 uses libbpf and BTF to pretty print the map's content, like
`bpftool map dump` would do.

Patch #3 updates ss' man page to explain new options.

While I think it makes sense for ss to provide the socket-local storage
content for the sockets, it's difficult to conciliate the column-based
output of ss and having readable socket-local data. Hence, the
socket-local data is printed in a readable fashion over multiple lines
under its socket statistics, independently of the column-based approach.

Here is an example of ss' output with --bpf-maps:
[...]
ESTAB                  340116             0 [...]
    map_id: 114 [
        (struct my_sk_storage){
            .field_hh = (char)3,
            (union){
                .a = (int)17,
                .b = (int)17,
            },
        }
    ]

Changed this series to an RFC as the merging window for net-next is
closed.

Changes from v8:
* Remove usage of libbpf_bpf_map_type_str() which requires libbpf-1.0+
  and provide very little added value (David).
* Use ENABLE_BPF_SKSTORAGE_SUPPORT to gate the BPF socket-local storage
  support, instead of HAVE_LIBBPF. iproute2 depends on libbpf-0.1, but
  this change needs libbpf-0.5+. If the requirements are not met, ss can
  still be compiled and used without BPF socket-local storage support, but
  a warning will be printed at compile time.
Changes from v7:
* Fix comment format and checkpatch warnings (Stephen, David).
* Replaced Co-authored-by with Co-developed-by + Signed-off-by for
  Martin's contribution on patch #1 to follow checkpatch requirements,
  with Martin's approval.
Changes from v6:
* Remove column dedicated to BPF socket-local storage (COL_SKSTOR),
  use COL_EXT instead (Matthieu).
Changes from v5:
* Add support for --oneline when printing socket-local data.
* Use \t to indent instead of "  " to be consistent with other columns.
* Removed Martin's ack on patch #2 due to amount of lines changed.
Changes from v4:
* Fix return code for 2 calls.
* Fix issue when inet_show_netlink() retries a request.
* BPF dump object is created in bpf_map_opts_load_info().
Changes from v3:
* Minor refactoring to reduce number of HAVE_LIBBF usage.
* Update ss' man page.
* btf_dump structure created to print the socket-local data is cached
  in bpf_map_opts. Creation of the btf_dump structure is performed if
  needed, before printing the data.
* If a map can't be pretty-printed, print its ID and a message instead
  of skipping it.
* If show_all=true, send an empty message to the kernel to retrieve all
  the maps (as Martin suggested).
Changes from v2:
* bpf_map_opts_is_enabled is not inline anymore.
* Add more #ifdef HAVE_LIBBPF to prevent compilation error if
  libbpf support is disabled.
* Fix erroneous usage of args instead of _args in vout().
* Add missing btf__free() and close(fd).
Changes from v1:
* Remove the first patch from the series (fix) and submit it separately.
* Remove double allocation of struct rtattr.
* Close BPF map FDs on exit.
* If bpf_map_get_fd_by_id() fails with ENOENT, print an error message
  and continue to the next map ID.
* Fix typo in new command line option documentation.
* Only use bpf_map_info.btf_value_type_id and ignore
  bpf_map_info.btf_vmlinux_value_type_id (unused for socket-local storage).
* Use btf_dump__dump_type_data() instead of manually using BTF to
  pretty-print socket-local storage data. This change alone divides the size
  of the patch series by 2.

====================

Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoss: update man page to document --bpf-maps and --bpf-map-id=
Quentin Deslandes [Wed, 21 Feb 2024 15:16:21 +0000 (16:16 +0100)] 
ss: update man page to document --bpf-maps and --bpf-map-id=

Document new --bpf-maps and --bpf-map-id= options.

Signed-off-by: Quentin Deslandes <qde@naccy.de>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoss: pretty-print BPF socket-local storage
Quentin Deslandes [Wed, 21 Feb 2024 15:16:20 +0000 (16:16 +0100)] 
ss: pretty-print BPF socket-local storage

ss is able to print the map ID(s) for which a given socket has BPF
socket-local storage defined (using --bpf-maps or --bpf-map-id=). However,
the actual content of the map remains hidden.

This change aims to pretty-print the socket-local storage content following
the socket details, similar to what `bpftool map dump` would do. The exact
output format is inspired by drgn, while the BTF data processing is similar
to bpftool's.

ss will use libbpf's btf_dump__dump_type_data() to ease pretty-printing
of binary data. This requires out_bpf_sk_storage_print_fn() as a print
callback function used by btf_dump__dump_type_data(). vout() is also
introduced, which is similar to out() but accepts a va_list as
parameter.

ss' output remains unchanged unless --bpf-maps or --bpf-map-id= is used,
in which case each socket containing BPF local storage will be followed by
the content of the storage before the next socket's info is displayed.

Signed-off-by: Quentin Deslandes <qde@naccy.de>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoip: Add missing command exaplantions in man page
Yedaya Katsman [Sat, 17 Feb 2024 21:21:02 +0000 (23:21 +0200)] 
ip: Add missing command exaplantions in man page

There are a few commands missing from the ip command syntax list, add
them. They are also missing from the see also section, add them there as
well.
Note there isn't a ip-ila man page, so I didn't link to it.

Also fix a few punctuation mistakes.

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoiptuntap: use TUNDEV macro
Denis Kirjanov [Tue, 20 Feb 2024 13:45:44 +0000 (08:45 -0500)] 
iptuntap: use TUNDEV macro

the code already has a path to the tan/tap device

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoss: add support for BPF socket-local storage
Quentin Deslandes [Wed, 21 Feb 2024 15:16:19 +0000 (16:16 +0100)] 
ss: add support for BPF socket-local storage

While sock_diag is able to return BPF socket-local storage in response
to INET_DIAG_REQ_SK_BPF_STORAGES requests, ss doesn't request it.

This change introduces the --bpf-maps and --bpf-map-id= options to request
BPF socket-local storage for all SK_STORAGE maps, or only specific ones.

The bigger part of this change will check the requested map IDs and
ensure they are valid. The column COL_EXT is used to print the
socket-local data into.

When --bpf-maps is used, ss will send an empty
INET_DIAG_REQ_SK_BPF_STORAGES request, in return the kernel will send
all the BPF socket-local storage entries for a given socket. The BTF
data for each map is loaded on demand, as ss can't predict which map ID
are used.

When --bpf-map-id=ID is used, a file descriptor to the requested maps is
open to 1) ensure the map doesn't disappear before the data is printed,
and 2) ensure the map type is BPF_MAP_TYPE_SK_STORAGE. The BTF data for
each requested map is loaded before the request is sent to the kernel.

Co-developed-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Quentin Deslandes <qde@naccy.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoman: ip-link.8: add a note for gso_ipv4_max_size
Xin Long [Mon, 19 Feb 2024 19:16:04 +0000 (14:16 -0500)] 
man: ip-link.8: add a note for gso_ipv4_max_size

As Paolo noticed, a skb->len check against gso_max_size was added in:

  https://lore.kernel.org/netdev/20231219125331.4127498-1-edumazet@google.com/

gso_max_size needs to be set to a value greater than or equal to
gso_ipv4_max_size to make BIG TCP IPv4 work properly.

To not break the current setup, this patch just adds a note into its
man doc for this.

Reported-by: Xiumei Mu <xmu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
17 months agoip: Update command usage in man page
Yedaya Katsman [Fri, 16 Feb 2024 14:49:39 +0000 (16:49 +0200)] 
ip: Update command usage in man page

The usage in the man page was out of date with the usage help, fix it.
Also sort the commands alphabetically, the same as the command usage.

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: Support json option in tc-cgroup, tc-flow and tc-route
Takanori Hirano [Tue, 13 Feb 2024 10:01:04 +0000 (10:01 +0000)] 
tc: Support json option in tc-cgroup, tc-flow and tc-route

Fix json corruption when using the "-json" option in some cases

Signed-off-by: Takanori Hirano <me@hrntknr.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agotc: Change of json format in tc-fw
Takanori Hirano [Sun, 11 Feb 2024 01:38:48 +0000 (01:38 +0000)] 
tc: Change of json format in tc-fw

In the case of a process such as mapping a json to a structure,
it can be difficult if the keys have the same name but different types.
Since handle is used in hex string, change it to fw.

Signed-off-by: Takanori Hirano <me@hrntknr.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
17 months agoifstat: convert sprintf to snprintf
Denis Kirjanov [Wed, 14 Feb 2024 12:56:59 +0000 (07:56 -0500)] 
ifstat: convert sprintf to snprintf

Use snprintf to print only valid data

v2: adjust formatting
v3: fix the issue with a buffer length

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agonetlink: display information from missing type extack
Stephen Hemminger [Sat, 10 Feb 2024 17:32:31 +0000 (09:32 -0800)] 
netlink: display information from missing type extack

The kernel will now send missing type information in error response.
Print it if present.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoMerge remote-tracking branch 'main/main' into next
David Ahern [Sun, 18 Feb 2024 17:41:39 +0000 (17:41 +0000)] 
Merge remote-tracking branch 'main/main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
17 months agoiproute2: fix type incompatibility in ifstat.c
Stephen Gallagher [Tue, 6 Feb 2024 16:52:34 +0000 (11:52 -0500)] 
iproute2: fix type incompatibility in ifstat.c

Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
type, however it is defined as __u64. This works by coincidence on many
systems, however on ppc64le, __u64 is a long unsigned.

This patch makes the type definition consistent with all of the places
where it is accessed.

Fixes: 5a52102b7c8f ("ifstat: Add extended statistics to ifstat")
Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>