]> git.ipfire.org Git - thirdparty/iproute2.git/log
thirdparty/iproute2.git
3 years agoip: iplink_vxlan: add support to set vnifiltering flag on vxlan device
Roopa Prabhu [Sun, 8 May 2022 04:53:39 +0000 (04:53 +0000)] 
ip: iplink_vxlan: add support to set vnifiltering flag on vxlan device

This patch adds option to set vnifilter flag on a vxlan device. vnifilter is
only supported on a collect metadata device.

example: set vnifilter flag
$ ip link add vxlan0 type vxlan external vnifilter local 172.16.0.1

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobridge: vxlan device vnifilter support
Roopa Prabhu [Sun, 8 May 2022 04:53:38 +0000 (04:53 +0000)] 
bridge: vxlan device vnifilter support

This patch adds bridge command to manage
recently added vnifilter on a collect metadata
vxlan device.

examples:
$bridge vni add dev vxlan0 vni 400

$bridge vni add dev vxlan0 vni 200 group 239.1.1.101

$bridge vni del dev vxlan0 vni 400

$bridge vni show

$bridge -s vni show

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agolibbpf: Remove use of bpf_map_is_offload_neutral
David Ahern [Sat, 23 Apr 2022 15:23:00 +0000 (09:23 -0600)] 
libbpf: Remove use of bpf_map_is_offload_neutral

bpf_map_is_offload_neutral is deprecated as of v0.8+;
import definition to maintain backwards compatibility.

Signed-off-by: David Ahern <dsahern@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
3 years agolibbpf: Remove use of bpf_program__set_priv and bpf_program__priv
David Ahern [Sat, 23 Apr 2022 15:22:59 +0000 (09:22 -0600)] 
libbpf: Remove use of bpf_program__set_priv and bpf_program__priv

bpf_program__set_priv and bpf_program__priv are deprecated as of
libbpf v0.7+. Rather than store the map as priv on the program,
change find_legacy_tail_calls to take an argument to return a reference
to the map.

find_legacy_tail_calls is invoked twice from load_bpf_object - the
first time to check for programs that should be loaded. In this case
a reference to the map is not needed, but it does validate the map
exists. The second is invoked from update_legacy_tail_call_maps where
the map pointer is needed.

Signed-off-by: David Ahern <dsahern@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
3 years agolibbpf: Use bpf_object__load instead of bpf_object__load_xattr
David Ahern [Sat, 23 Apr 2022 15:22:58 +0000 (09:22 -0600)] 
libbpf: Use bpf_object__load instead of bpf_object__load_xattr

bpf_object__load_xattr is deprecated as of v0.8+; remove it
in favor of bpf_object__load.

Signed-off-by: David Ahern <dsahern@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
3 years agof_flower: add number of vlans man entry
Boris Sukholitko [Thu, 28 Apr 2022 08:32:33 +0000 (11:32 +0300)] 
f_flower: add number of vlans man entry

The documentation was missing in the number of vlans commit.

Fixes: 5ba31bcf (f_flower: Add num of vlans parameter)
Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'flower-vlans' into next
David Ahern [Thu, 28 Apr 2022 02:18:25 +0000 (20:18 -0600)] 
Merge branch 'flower-vlans' into next

Boris Sukholitko  says:

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

Our customers in the fiber telecom world have network configurations
where they would like to control their traffic according to the number
of tags appearing in the packet.

For example, TR247 GPON conformance test suite specification mostly
talks about untagged, single, double tagged packets and gives lax
guidelines on the vlan protocol vs. number of vlan tags.

This is different from the common IT networks where 802.1Q and 802.1ad
protocols are usually describe single and double tagged packet. GPON
configurations that we work with have arbitrary mix the above protocols
and number of vlan tags in the packet.

The following patch series implement number of vlans flower filter. They
add num_of_vlans flower filter as an alternative to vlan ethtype protocol
matching. The end result is that the following command becomes possible:

tc filter add dev eth1 ingress flower \
  num_of_vlans 1 vlan_prio 5 action drop

Also, from our logs, we have redirect rules such that:

tc filter add dev $GPON ingress flower num_of_vlans $N \
     action mirred egress redirect dev $DEV

where N can range from 0 to 3 and $DEV is the function of $N.

Also there are rules setting skb mark based on the number of vlans:

tc filter add dev $GPON ingress flower num_of_vlans $N vlan_prio \
    $P action skbedit mark $M

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agof_flower: Check args with num_of_vlans
Boris Sukholitko [Tue, 26 Apr 2022 09:14:17 +0000 (12:14 +0300)] 
f_flower: Check args with num_of_vlans

Having more than one vlan allows matching on the vlan tag parameters.
This patch changes vlan key validation to take number of vlan tags into
account.

Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agof_flower: Add num of vlans parameter
Boris Sukholitko [Tue, 26 Apr 2022 09:14:16 +0000 (12:14 +0300)] 
f_flower: Add num of vlans parameter

Our customers in the fiber telecom world have network configurations
where they would like to control their traffic according to the number
of tags appearing in the packet.

For example, TR247 GPON conformance test suite specification mostly
talks about untagged, single, double tagged packets and gives lax
guidelines on the vlan protocol vs. number of vlan tags.

This is different from the common IT networks where 802.1Q and 802.1ad
protocols are usually describe single and double tagged packet. GPON
configurations that we work with have arbitrary mix the above protocols
and number of vlan tags in the packet.

This patch adds num_of_vlans flower key and associated print and parse
routines. The following command becomes possible:

tc filter add dev eth1 ingress flower num_of_vlans 1 action drop

Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'ip-stats' into next
David Ahern [Thu, 28 Apr 2022 02:13:35 +0000 (20:13 -0600)] 
Merge branch 'ip-stats' into next

Petr Machata  says:

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

A new rtnetlink message, RTM_SETSTATS, has been added recently in kernel
commit ca0a53dcec94 ("Merge branch 'net-hw-counters-for-soft-devices'").

At the same time, RTM_GETSTATS has been around for a while. The users of
this API are spread in a couple different places: "ip link xstats" reads
stats from the IFLA_STATS_LINK_XSTATS and _XSTATS_SLAVE subgroups, "ip
link afstats" then reads IFLA_STATS_AF_SPEC.

Finally, to read IFLA_STATS_LINK_OFFLOAD_XSTATS, one would use ifstats.
This does not seem to be a good fit for IFLA_OFFLOAD_XSTATS_HW_S_INFO in
particular.

The obvious place to expose all these offload stats suites would be
under a new link subcommand "ip link offload_xstats", or similar, which
would then have syntax for both showing stats and setting them.

However, this looks like a good opportunity to introduce a new top-level
command, "ip stats", that would be the go-to place to access anything
backed by RTM_GETSTATS and RTM_SETSTATS.

This patchset therefore does the following:

- It adds the new "stats" infrastructure

- It adds specifically the ability to toggle and show the suites that
  were recently added to Linux, IFLA_OFFLOAD_XSTATS_HW_S_INFO and
  IFLA_OFFLOAD_XSTATS_L3_STATS.

- It adds support to dump IFLA_OFFLOAD_XSTATS_CPU_HIT, which was not
  available under "ip" at all.

- Does all this in a way that is easy to extend for new stats suites.

The patchset proceeds as follows:

- Patches #1 and #2 lay some groundwork and tweak existing code.

- Patch #3 adds the shell of the new "ip stats" command.

- Patch #4 adds "ip stats set" and the ability to toggle l3_stats in
  particular.

- Patch #5 adds "ip stats show", but no actual stats suites.

- Patches #6-#9 add support for showing individual stats suites:
  respectively, IFLA_STATS_LINK_64, IFLA_OFFLOAD_XSTATS_CPU_HIT,
  IFLA_OFFLOAD_XSTATS_HW_S_INFO and IFLA_OFFLOAD_XSTATS_L3_STATS.

- Patch #10 adds support for monitoring stats events to "ip monitor".

- Patch #11 adds man page verbiage for the above.

The plan is to contribute support for afstats and xstats in a follow-up
patch set.

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: Add man pages for the "stats" functions
Petr Machata [Fri, 22 Apr 2022 08:31:00 +0000 (10:31 +0200)] 
man: Add man pages for the "stats" functions

Add a man page for the new "stats" command.
Also mention the new "stats" group in ip-monitor.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipmonitor: Add monitoring support for stats events
Petr Machata [Fri, 22 Apr 2022 08:30:59 +0000 (10:30 +0200)] 
ipmonitor: Add monitoring support for stats events

Toggles and offloads of HW statistics cause emission of and RTM_NEWSTATS
event. Add support to "ip monitor" for these events.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add offload subgroup "l3_stats"
Petr Machata [Fri, 22 Apr 2022 08:30:58 +0000 (10:30 +0200)] 
ipstats: Add offload subgroup "l3_stats"

Add into the group "offload" a subgroup "l3_stats" for showing
L3 statistics.

For example:

 # ip stats show dev swp2.200 group offload subgroup l3_stats
 4212: swp2.200: group offload subgroup l3_stats on used on
     RX: bytes packets errors dropped   mcast
          1920      21      1       0       0
     TX: bytes packets errors dropped
           756       9      0       0

 # ip -j stats show dev swp2.200 group offload subgroup l3_stats | jq
 [
   {
     "ifindex": 4212,
     "ifname": "swp2.200",
     "group": "offload",
     "subgroup": "l3_stats",
     "info": {
       "request": true,
       "used": true
     },
     "stats64": {
       "rx": {
         "bytes": 1920,
         "packets": 21,
         "errors": 1,
         "dropped": 0,
         "multicast": 0
       },
       "tx": {
         "bytes": 756,
         "packets": 9,
         "errors": 0,
         "dropped": 0
       }
     }
   }
 ]

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add offload subgroup "hw_stats_info"
Petr Machata [Fri, 22 Apr 2022 08:30:57 +0000 (10:30 +0200)] 
ipstats: Add offload subgroup "hw_stats_info"

Add into the group "offload" a subgroup "hw_stats_info" for showing
information about HW statistics counters.

For example:

 # ip stats show dev swp1 group offload subgroup hw_stats_info
 4178: swp1: group offload subgroup hw_stats_info
     l3_stats on used off
 # ip -j stats show dev swp1 group offload subgroup hw_stats_info | jq
 [
   {
     "ifindex": 4178,
     "ifname": "swp1",
     "group": "offload",
     "subgroup": "hw_stats_info",
     "info": {
       "l3_stats": {
         "request": true,
         "used": false
       }
     }
   }
 ]

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add a group "offload", subgroup "cpu_hit"
Petr Machata [Fri, 22 Apr 2022 08:30:56 +0000 (10:30 +0200)] 
ipstats: Add a group "offload", subgroup "cpu_hit"

Add a new group, "offload", for showing counters from the
IFLA_STATS_LINK_OFFLOAD_XSTATS nest, and a subgroup "cpu_hit" for the
IFLA_OFFLOAD_XSTATS_CPU_HIT stats suite.

For example:

 # ip stats show dev swp1 group offload subgroup cpu_hit
 4178: swp1: group offload subgroup cpu_hit
     RX:  bytes packets errors dropped  missed   mcast
          45522     353      0       0       0       0
     TX:  bytes packets errors dropped carrier collsns
          46054     355      0       0       0       0

 # ip -j stats show dev swp1 group offload subgroup cpu_hit | jq
 [
   {
     "ifindex": 4178,
     "ifname": "swp1",
     "group": "offload",
     "subgroup": "cpu_hit",
     "stats64": {
       "rx": {
         "bytes": 45522,
         "packets": 353,
         "errors": 0,
         "dropped": 0,
         "over_errors": 0,
         "multicast": 0
       },
       "tx": {
         "bytes": 46054,
         "packets": 355,
         "errors": 0,
         "dropped": 0,
         "carrier_errors": 0,
         "collisions": 0
       }
     }
   }
 ]

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add a group "link"
Petr Machata [Fri, 22 Apr 2022 08:30:55 +0000 (10:30 +0200)] 
ipstats: Add a group "link"

Add the "link" top-level group for showing IFLA_STATS_LINK_64 statistics.
For example:

 # ip stats show dev swp1 group link
 4178: swp1: group link
     RX:  bytes packets errors dropped  missed   mcast
          47048     354      0       0       0      64
     TX:  bytes packets errors dropped carrier collsns
          47474     355      0       0       0       0

 # ip -j stats show dev swp1 group link | jq
 [
   {
     "ifindex": 4178,
     "ifname": "swp1",
     "group": "link",
     "stats64": {
       "rx": {
         "bytes": 47048,
         "packets": 354,
         "errors": 0,
         "dropped": 0,
         "over_errors": 0,
         "multicast": 64
       },
       "tx": {
         "bytes": 47474,
         "packets": 355,
         "errors": 0,
         "dropped": 0,
         "carrier_errors": 0,
         "collisions": 0
       }
     }
   }
 ]

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add a shell of "show" command
Petr Machata [Fri, 22 Apr 2022 08:30:54 +0000 (10:30 +0200)] 
ipstats: Add a shell of "show" command

Add the scaffolding necessary for adding individual stats suites to show.

Expose some ipstats artifacts in ip_common.h. These will be used to support
"xstats" in a follow-up patchset.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoipstats: Add a "set" command
Petr Machata [Fri, 22 Apr 2022 08:30:53 +0000 (10:30 +0200)] 
ipstats: Add a "set" command

Add a command to allow toggling HW stats. An example usage:

 # ip stats set dev swp1 l3_stats on

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip: Add a new family of commands, "stats"
Petr Machata [Fri, 22 Apr 2022 08:30:52 +0000 (10:30 +0200)] 
ip: Add a new family of commands, "stats"

Add a core of a new frontend tool for interfacing with the RTM_*STATS
family of messages. The following patches will add subcommands for showing
and setting individual statistics suites.

Note that in this patch, "ip stats" is made to be an invalid command line.
This will be changed in later patches to default to "show" when that is
introduced.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip: Publish functions for stats formatting
Petr Machata [Fri, 22 Apr 2022 08:30:51 +0000 (10:30 +0200)] 
ip: Publish functions for stats formatting

Formatting struct rtnl_link_stats64 will be useful outside of iplink.c as
well. Extract from __print_link_stats() a new function, print_stats64(),
make it non-static and publish in the header file.

Additionally, publish the helper size_columns(), which will be useful for
formatting the new struct rtnl_hw_stats64.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agolibnetlink: Add filtering to rtnl_statsdump_req_filter()
Petr Machata [Fri, 22 Apr 2022 08:30:50 +0000 (10:30 +0200)] 
libnetlink: Add filtering to rtnl_statsdump_req_filter()

A number of functions in the rtnl_*_req family accept a caller-provided
callback to set up arbitrary filtering. rtnl_statsdump_req_filter()
currently only allows setting a field in the IFSM header, not custom
attributes. So far these were not necessary, but with introduction of more
detailed filtering settings, the callback becomes necessary.

To that end, add a filter_fn and filter_data arguments to the function.
Unlike the other filters, this one is typed to expect an IFSM pointer, to
permit tweaking the header itself as well.

Pass NULLs in the existing callers.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agodevlink: introduce -[he]x cmdline option to allow dumping numbers in hex format
Jiri Pirko [Mon, 25 Apr 2022 10:36:27 +0000 (12:36 +0200)] 
devlink: introduce -[he]x cmdline option to allow dumping numbers in hex format

For health reporter dumps it is quite convenient to have the numbers in
hexadecimal format. Introduce a command line option to allow user to
achieve that output.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoUpdate kernel headers
David Ahern [Tue, 26 Apr 2022 02:08:38 +0000 (20:08 -0600)] 
Update kernel headers

Update kernel headers to commit:
    cc271ab86606 ("wwan_hwsim: Avoid flush_scheduled_work() usage")

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip-link: put types on man page in alphabetic order
Stephen Hemminger [Wed, 20 Apr 2022 03:11:15 +0000 (20:11 -0700)] 
ip-link: put types on man page in alphabetic order

Lets try and keep man pages using alpha order, it looks like
it started that way then drifted.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip/iplink_virt_wifi: add support for virt_wifi
Baligh Gasmi [Mon, 18 Apr 2022 23:25:07 +0000 (01:25 +0200)] 
ip/iplink_virt_wifi: add support for virt_wifi

Add support for creating virt_wifi devices type.

Syntax:
$ ip link add link eth0 name wlan0 type virt_wifi

Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'main' into next
David Ahern [Thu, 24 Mar 2022 14:10:00 +0000 (08:10 -0600)] 
Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'ss-rpcinfo' into next
David Ahern [Thu, 24 Mar 2022 03:27:39 +0000 (21:27 -0600)] 
Merge branch 'ss-rpcinfo' into next

Andrea Claudi  says:

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

ss uses rpcinfo to get info about rpc service sockets. However, rpcinfo
is not part of iproute2 and it's an implicit dependency for ss.

This series uses libtirpc[1] API to implement the same feature of
rpcinfo for ss. This makes it possible to get info about rpc sockets,
provided ss is compiled with libtirpc support.

As a nice byproduct, this makes ss provide info about some ipv6 rpc
sockets that are not displayed using 'rpcinfo -p'.

- patch 1 adds a configure function to check for libtirpc;
- patch 2 actually rework ss to use libtirpc.

[1] https://git.linux-nfs.org/?p=steved/libtirpc.git

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoss: remove an implicit dependency on rpcinfo
Andrea Claudi [Wed, 16 Mar 2022 18:52:14 +0000 (19:52 +0100)] 
ss: remove an implicit dependency on rpcinfo

ss uses rpcinfo to get info about rpc services socket. This makes it
dependent on a tool not included in iproute2, and makes it impossible to
get info on rpc sockets if rpcinfo is not installed.

This reworks init_service_resolver() to use libtirpc, thus avoiding the
implicity dependency on rpcinfo. Moreover, this also makes it possible
to display info about ipv6 rpc socket that are not included in the
rpcinfo -p output.

For example, before this patch:
$ ss -rtap
LISTEN          0               5                                                        localhost:ipp                                        [::]:*                     users:(("cupsd",pid=1600,fd=9))
LISTEN          0               64                                                            [::]:34265                                      [::]:*
LISTEN          0               64                                                            [::]:rpc.nfs_acl                                [::]:*
LISTEN          0               128                                                           [::]:42253                                      [::]:*                     users:(("rpc.statd",pid=146164,fd=12))

After this patch:
$ ss -rtap
LISTEN          0               5                                                        localhost:ipp                                        [::]:*                     users:(("cupsd",pid=1600,fd=9))
LISTEN          0               64                                                            [::]:rpc.nlockmgr                               [::]:*
LISTEN          0               64                                                            [::]:rpc.nfs_acl                                [::]:*
LISTEN          0               128                                                           [::]:rpc.status                                 [::]:*                     users:(("rpc.statd",pid=146164,fd=12))

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoconfigure: add check_libtirpc()
Andrea Claudi [Wed, 16 Mar 2022 18:52:13 +0000 (19:52 +0100)] 
configure: add check_libtirpc()

This patch adds a configure function to check if libtirpc is installed
on the build system. If this is the case, it makes iproute2 to compile
with libtirpc support.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agov5.17.0 v5.17.0
Stephen Hemminger [Tue, 22 Mar 2022 14:59:11 +0000 (07:59 -0700)] 
v5.17.0

3 years agoip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT
Eyal Birger [Sat, 19 Mar 2022 08:57:40 +0000 (10:57 +0200)] 
ip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT

Add support for creating devices with this property.
Since it cannot be changed, not adding a [no] option.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'gtp-netdev' into next
David Ahern [Sun, 20 Mar 2022 23:48:43 +0000 (17:48 -0600)] 
Merge branch 'gtp-netdev' into next

Wojciech Drewek  says:

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

This patch series introduces GTP support to iproute2. Since this patch
series it is possible to create net devices of GTP type. Then, those
devices can be used in tc in order to offload GTP packets. New field
in tc flower (gtp_opts) can be used to match on QFI and PDU type.

Kernel changes (merged):
https://lore.kernel.org/netdev/164708701228.11169.15700740251869229843.git-patchwork-notify@kernel.org/

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agof_flower: Implement gtp options support
Wojciech Drewek [Thu, 17 Mar 2022 16:27:55 +0000 (17:27 +0100)] 
f_flower: Implement gtp options support

Add support for parsing TCA_FLOWER_KEY_ENC_OPTS_GTP.
Options are as follows: PDU_TYPE:QFI where each
option is represented as 8-bit hexadecimal value.

e.g.
  # ip link add gtp_dev type gtp role sgsn
  # tc qdisc add dev gtp_dev ingress
  # tc filter add dev gtp_dev protocol ip parent ffff: \
      flower \
        enc_key_id 11 \
        gtp_opts 1:8/ff:ff \
      action mirred egress redirect dev eth0

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip: GTP support in ip link
Wojciech Drewek [Thu, 17 Mar 2022 16:27:54 +0000 (17:27 +0100)] 
ip: GTP support in ip link

Support for creating GTP devices through ip link. Two arguments
can be specified by the user when adding device of the GTP type.
 - role (sgsn or ggsn) - indicates whether we are on the GGSN or SGSN
 - hsize - indicates the size of the hash table where PDP sessions
   are stored

IFLA_GTP_FD0 and IFLA_GTP_FD1 arguments would not be provided. Those
are file descriptores to the sockets created in the userspace. Since
we are not going to create sockets in ip link, we don't have to
provide them.

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: bridge: document per-port mcast_router settings
Joachim Wiberg [Wed, 16 Mar 2022 09:02:57 +0000 (10:02 +0100)] 
man: bridge: document per-port mcast_router settings

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
3 years agobridge: support for controlling mcast_router per port
Joachim Wiberg [Wed, 16 Mar 2022 09:02:56 +0000 (10:02 +0100)] 
bridge: support for controlling mcast_router per port

The bridge vlan command supports setting mcast_router per-port and
per-vlan, what's however missing is the ability to set the per-port
mcast_router options, e.g. when VLAN filtering is disabled.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
3 years agoUpdate kernel headers
David Ahern [Sun, 20 Mar 2022 23:33:41 +0000 (17:33 -0600)] 
Update kernel headers

Update kernel headers to commit:
    092d992b76ed ("Merge tag 'mlx5-updates-2022-03-18' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux")

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agovdpa: Update man page with added support to configure max vq pair
Eli Cohen [Tue, 15 Mar 2022 13:13:58 +0000 (15:13 +0200)] 
vdpa: Update man page with added support to configure max vq pair

Update man page to include information how to configure the max
virtqueue pairs for a vdpa device when creating one.

Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agolink_xfrm: if_id must be non zero
Antony Antony [Mon, 14 Mar 2022 08:52:26 +0000 (09:52 +0100)] 
link_xfrm: if_id must be non zero

Since kernel upstream commit
8dce43919566 ("xfrm: interface with if_id 0 should return error")
if_id must be non zero.

Fix the usage and return error for if_id 0.

Signed-off-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agotestsuite: link xfrm delete no if_id test
Antony Antony [Wed, 9 Mar 2022 20:52:58 +0000 (21:52 +0100)] 
testsuite: link xfrm delete no if_id test

Since kernel commit 8dce43919566 ("xfrm: interface with if_id 0 should return error")
if_id should be non zero.
Delete the test without if_id, which defaulted if_id to zero.

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agovdpa: Support reading device features
Eli Cohen [Sun, 13 Mar 2022 17:12:19 +0000 (19:12 +0200)] 
vdpa: Support reading device features

When showing the available management devices, check if
VDPA_ATTR_DEV_SUPPORTED_FEATURES feature is available and print the
supported features for a management device.

Examples:
$ vdpa mgmtdev show
auxiliary/mlx5_core.sf.1:
  supported_classes net
  max_supported_vqs 257
  dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
               CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM

$ vdpa -jp mgmtdev show
{
    "mgmtdev": {
        "auxiliary/mlx5_core.sf.1": {
            "supported_classes": [ "net" ],
            "max_supported_vqs": 257,
            "dev_features": [
"CSUM","GUEST_CSUM","MTU","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ",\
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
        }
    }
}

Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agovdpa: Support for configuring max VQ pairs for a device
Eli Cohen [Sun, 13 Mar 2022 17:12:18 +0000 (19:12 +0200)] 
vdpa: Support for configuring max VQ pairs for a device

Use VDPA_ATTR_DEV_MGMTDEV_MAX_VQS to specify max number of virtqueue
pairs to configure for a vdpa device when adding a device.

Examples:
1. Create a device with 3 virtqueue pairs:
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 3

2. Read the configuration of a vdpa device
$ vdpa dev config show vdpa-a
  vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 3 \
          mtu 1500
  negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
                      CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM

Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agovdpa: Allow for printing negotiated features of a device
Eli Cohen [Sun, 13 Mar 2022 17:12:17 +0000 (19:12 +0200)] 
vdpa: Allow for printing negotiated features of a device

When reading the configuration of a vdpa device, check if the
VDPA_ATTR_DEV_NEGOTIATED_FEATURES is available. If it is, parse the
feature bits and print a string representation of each of the feature
bits.

We keep the strings in two different arrays. One for net device related
devices and one for generic feature bits.

In this patch we parse only net device specific features. Support for
other devices can be added later. If the device queried is not a net
device, we print its bit number only.

Examples:
1. Standard presentation
$ vdpa dev config show vdpa-a
vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 2 mtu 9000
  negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM

2. json output
$ vdpa -j dev config show vdpa-a
{"config":{"vdpa-a":{"mac":"00:00:00:00:88:88","link":"up","link_announce":false,\
"max_vq_pairs":2,"mtu":9000,"negotiated_features":["CSUM","GUEST_CSUM",\
"MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR",\
"VERSION_1","ACCESS_PLATFORM"]}}}

3. Pretty json
$ vdpa -jp dev config show vdpa-a
{
    "config": {
        "vdpa-a": {
            "mac": "00:00:00:00:88:88",
            "link ": "up",
            "link_announce ": false,
            "max_vq_pairs": 2,
            "mtu": 9000,
            "negotiated_features": [
"CSUM","GUEST_CSUM","MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ",\
"MQ","CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
        }
    }
}

Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agovdpa: Remove unsupported command line option
Eli Cohen [Sun, 13 Mar 2022 17:12:16 +0000 (19:12 +0200)] 
vdpa: Remove unsupported command line option

"-v[erbose]" option is not supported.
Remove it.

Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMakefile: move HAVE_MNL check to top-level Makefile
Andrea Claudi [Wed, 9 Mar 2022 17:03:26 +0000 (18:03 +0100)] 
Makefile: move HAVE_MNL check to top-level Makefile

dcb, devlink, rdma, tipc and vdpa rely on libmnl to compile, so they
check for libmnl to be installed on their Makefiles.

This moves HAVE_MNL check from the tools to top-level Makefile, thus
avoiding to call their Makefiles if libmnl is not present.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'bridge-broadcast-flooding' into next
David Ahern [Sat, 12 Mar 2022 15:59:03 +0000 (08:59 -0700)] 
Merge branch 'bridge-broadcast-flooding' into next

Joachim Wiberg  says:

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

this patch set address a slight omission in controlling broadcast
flooding per bridge port, which the bridge has had support for a good
while now.

v3:
  - Move bcast_flood option in manual files to before the mcast_flood
    option, instead of breaking the two mcast options.  Unfortunately
    the other options are not alphabetically sorted, so this was the
    least worst option. (Stephen)
  - Add missing closing " for 'bridge mdb show' in bridge(8) SYNOPSIS
v2:
  - Add bcast_flood also to ip/iplink_bridge_slave.c (Nik)
  - Update man page for ip-link(8) with new bcast_flood flag
  - Update mcast_flood in same man page slightly
  - Fix minor weird whitespace issues causing sudden line breaks
v1:
  - Add bcast_flood to bridge/link.c
  - Update man page for bridge(8) with bcast_flood for brports

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'main' into next
David Ahern [Sat, 12 Mar 2022 15:58:37 +0000 (08:58 -0700)] 
Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: ip-link: whitespace fixes to odd line breaks mid sentence
Joachim Wiberg [Wed, 9 Mar 2022 19:23:16 +0000 (20:23 +0100)] 
man: ip-link: whitespace fixes to odd line breaks mid sentence

Some options, spread across the man page, were accidentally (?) space
indented (possible bullet list auto-indent in editors), causing odd line
breaks in presentation mode (emacs, nroff, etc.).  This patch aligns the
multi-line descriptions to column zero, in line with other such option
descriptions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: ip-link: mention bridge port's default mcast_flood state
Joachim Wiberg [Wed, 9 Mar 2022 19:23:15 +0000 (20:23 +0100)] 
man: ip-link: mention bridge port's default mcast_flood state

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: ip-link: document new bcast_flood flag on bridge ports
Joachim Wiberg [Wed, 9 Mar 2022 19:23:14 +0000 (20:23 +0100)] 
man: ip-link: document new bcast_flood flag on bridge ports

The options are not alphabetically sorted, so placing bcast_flood right
before mcast_flood for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip: iplink_bridge_slave: support for broadcast flooding
Joachim Wiberg [Wed, 9 Mar 2022 19:23:13 +0000 (20:23 +0100)] 
ip: iplink_bridge_slave: support for broadcast flooding

Add per-port support for controlling flooding of broadcast traffic.
Similar to unicast and multcast flooding that already exist.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: bridge: add missing closing " in bridge show mdb
Joachim Wiberg [Wed, 9 Mar 2022 19:23:12 +0000 (20:23 +0100)] 
man: bridge: add missing closing " in bridge show mdb

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman: bridge: document new bcast_flood flag for bridge ports
Joachim Wiberg [Wed, 9 Mar 2022 19:23:11 +0000 (20:23 +0100)] 
man: bridge: document new bcast_flood flag for bridge ports

The bridge link options are not alphabetically sorted, so placing
bcast_flood right before mcast_flood for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobridge: support for controlling flooding of broadcast per port
Joachim Wiberg [Wed, 9 Mar 2022 19:23:10 +0000 (20:23 +0100)] 
bridge: support for controlling flooding of broadcast per port

Add per-port support for controlling flooding of broadcast traffic.
Similar to unicast and multcast flooding that already exist.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agordma: make RES_PID and RES_KERN_NAME alternative to each other
Andrea Claudi [Tue, 8 Mar 2022 17:04:57 +0000 (18:04 +0100)] 
rdma: make RES_PID and RES_KERN_NAME alternative to each other

RDMA_NLDEV_ATTR_RES_PID and RDMA_NLDEV_ATTR_RES_KERN_NAME cannot be set
together, as evident for the fill_res_name_pid() function in the kernel
infiniband driver. This commit makes this clear at first glance, using
an else branch for the RDMA_NLDEV_ATTR_RES_KERN_NAME case.

This also helps coverity to better understand this code and avoid
producing a bogus warning complaining about mnl_attr_get_str overwriting
comme, and thus leaking the storage that comm points to.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agouapi: update vdpa.h
Stephen Hemminger [Sat, 12 Mar 2022 03:16:25 +0000 (19:16 -0800)] 
uapi: update vdpa.h

Update header from upstream.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoipaddress: remove 'label' compatibility with Linux-2.0 net aliases
Maxime de Roucy [Mon, 7 Mar 2022 11:40:57 +0000 (12:40 +0100)] 
ipaddress: remove 'label' compatibility with Linux-2.0 net aliases

As Linux-2.0 is getting old and systemd allows non Linux-2.0 compatible
aliases to be set, I think iproute2 should be able to manage such
aliases.

Signed-off-by: Maxime de Roucy <maxime.deroucy@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agolib/fs: fix memory leak in get_task_name()
Andrea Claudi [Tue, 8 Mar 2022 17:04:56 +0000 (18:04 +0100)] 
lib/fs: fix memory leak in get_task_name()

asprintf() allocates memory which is not freed on the error path of
get_task_name(), thus potentially leading to memory leaks.
%m specifier on fscanf allocates memory, too, which needs to be freed by
the caller.

This reworks get_task_name() to avoid memory allocation.
- Pass a buffer and its length to the function, similarly to what
  get_command_name() does, thus avoiding to allocate memory for
  the string to be returned;
- Use snprintf() instead of asprintf();
- Use fgets() instead of fscanf() to limit string length.

Fixes: 81bfd01a4c9e ("lib: move get_task_name() from rdma")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoip/batadv: allow to specify RA when creating link
Nicolas Escande [Fri, 4 Mar 2022 10:33:54 +0000 (11:33 +0100)] 
ip/batadv: allow to specify RA when creating link

This patch adds the possibility to specify batadv specific options when
creating a new batman link. The only option available on link creation
is IFLA_BATADV_ALGO_NAME which specifies the routing algorithm.
Note there is no batadv specific attr to be handled on link dump.

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoImport batman_adv.h header from last kernel sync point
David Ahern [Fri, 11 Mar 2022 16:20:30 +0000 (09:20 -0700)] 
Import batman_adv.h header from last kernel sync point

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agouapi: update magic.h
Stephen Hemminger [Fri, 11 Mar 2022 01:23:23 +0000 (17:23 -0800)] 
uapi: update magic.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoRevert "configure: Allow command line override of toolchain"
David Ahern [Tue, 8 Mar 2022 16:24:17 +0000 (09:24 -0700)] 
Revert "configure: Allow command line override of toolchain"

This reverts commit 386ae64c8312dd27b09508993a7c8386aff8b1d3.

Ido reported compile breakage on Fedora with this patch, so
reverting.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agotc: separate action print for filter and action dump
Baowen Zheng [Fri, 4 Mar 2022 02:01:40 +0000 (10:01 +0800)] 
tc: separate action print for filter and action dump

We need to separate action print for filter and action dump since
in action dump, we need to print hardware status and flags. But in
filter dump, we do not need to print action hardware status and
hardware related flags.

In filter dump, actions hardware status should be same with filter.
so we will not print action hardware status in this case.

Action print for action dump:
  action order 0:  police 0xff000100 rate 0bit burst 0b mtu 64Kb pkts_rate 50000 pkts_burst 10000 action drop/pipe overhead 0b linklayer unspec
  ref 4 bind 3  installed 666 sec used 0 sec firstused 106 sec
  Action statistics:
  Sent 7634140154 bytes 5109889 pkt (dropped 0, overlimits 0 requeues 0)
  Sent software 84 bytes 3 pkt
  Sent hardware 7634140070 bytes 5109886 pkt
  backlog 0b 0p requeues 0
  in_hw in_hw_count 1
  used_hw_stats delayed

Action print for filter dump:
  action order 1:  police 0xff000100 rate 0bit burst 0b mtu 64Kb pkts_rate 50000 pkts_burst 10000 action drop/pipe overhead 0b linklayer unspec
  ref 4 bind 3  installed 680 sec used 0 sec firstused 119 sec
  Action statistics:
  Sent 8627975846 bytes 5775107 pkt (dropped 0, overlimits 0 requeues 0)
  Sent software 84 bytes 3 pkt
  Sent hardware 8627975762 bytes 5775104 pkt
  backlog 0b 0p requeues 0
  used_hw_stats delayed

Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agordma: Fix the logic to print unsigned int.
Shangyan Zhou [Sun, 6 Mar 2022 06:56:06 +0000 (14:56 +0800)] 
rdma: Fix the logic to print unsigned int.

Use the corresponding function and fmt string to print unsigned int32
and int64.

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoRevert "rdma: Fix res_print_uint() and add res_print_u64()"
Stephen Hemminger [Mon, 7 Mar 2022 19:27:07 +0000 (11:27 -0800)] 
Revert "rdma: Fix res_print_uint() and add res_print_u64()"

This reverts commit 9d0badecea4c5e85345577984a328f38c75685c3.

3 years agoMerge branch 'libbpf-fixups' into next
David Ahern [Mon, 7 Mar 2022 15:52:21 +0000 (08:52 -0700)] 
Merge branch 'libbpf-fixups' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobpf: Remove use of bpf_create_map_xattr
David Ahern [Mon, 7 Feb 2022 01:00:32 +0000 (18:00 -0700)] 
bpf: Remove use of bpf_create_map_xattr

bpf_create_map_xattr is deprecated in v0.7 in favor of bpf_map_create.
bpf_map_create and its bpf_map_create_opts are not available across the
range of v0.1 and up versions of libbpf, so change create_map to use
the bpf syscall directly.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobpf: Export bpf syscall wrapper
David Ahern [Mon, 7 Feb 2022 00:59:24 +0000 (17:59 -0700)] 
bpf: Export bpf syscall wrapper

Move bpf syscall wrapper to bpf_glue to make it available to libbpf
based functions.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobpf_glue: Remove use of bpf_load_program from libbpf
David Ahern [Mon, 7 Feb 2022 00:32:43 +0000 (17:32 -0700)] 
bpf_glue: Remove use of bpf_load_program from libbpf

bpf_load_program is deprecated starting in v0.7. The preferred
bpf_prog_load requires bpf_prog_load_opts from v0.6. This creates an
ugly scenario for iproute2 to work across libbpf versions from v0.1
and up.

Since bpf_program_load is only used to load the builtin vrf program,
just remove the libbpf call and use the legacy code.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agordma: Fix res_print_uint() and add res_print_u64()
Shangyan Zhou [Fri, 4 Mar 2022 12:46:37 +0000 (20:46 +0800)] 
rdma: Fix res_print_uint() and add res_print_u64()

Use the corresponding function and fmt string to print unsigned int32
and int64.

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agouapi: update to xfrm.h
Stephen Hemminger [Fri, 4 Mar 2022 22:26:09 +0000 (14:26 -0800)] 
uapi: update to xfrm.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoss: display advertised TCP receive window and out-of-order counter
Davide Caratti [Thu, 3 Mar 2022 15:19:32 +0000 (16:19 +0100)] 
ss: display advertised TCP receive window and out-of-order counter

these members of TCP_INFO have been included in v5.4.

tested with:
 # ss -nti

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'link-layer-protocols' into next
David Ahern [Fri, 4 Mar 2022 16:24:25 +0000 (09:24 -0700)] 
Merge branch 'link-layer-protocols' into next

Daniel Braunwarth  says:

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

Update the llproto_names array to allow users to reference the PROFINET
and EtherCAT protocols with the names 'profinet' and 'ethercat'.

These patches depends on the below referenced patch, which extends if_ether.h
with the used ETH_P_xxx defines.

Link: https://lore.kernel.org/netdev/20220228133029.100913-1-daniel@braunwarth.dev/
====================

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agotc: bash-completion: Add profinet and ethercat to procotol completion list
Daniel Braunwarth [Mon, 28 Feb 2022 13:45:20 +0000 (14:45 +0100)] 
tc: bash-completion: Add profinet and ethercat to procotol completion list

Add the 'profinet' and 'ethercat' protocols to bash completion.

Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
3 years agolib: add profinet and ethercat as link layer protocol names
Daniel Braunwarth [Mon, 28 Feb 2022 13:45:19 +0000 (14:45 +0100)] 
lib: add profinet and ethercat as link layer protocol names

Update the llproto_names array to allow users to reference the PROFINET
and EtherCAT protocols with the names 'profinet' and 'ethercat'.

Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
3 years agoMerge branch '802.1X-locked-bridge-ports' into next
David Ahern [Fri, 4 Mar 2022 16:18:24 +0000 (09:18 -0700)] 
Merge branch '802.1X-locked-bridge-ports' into next

Hans Schultz  says:

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

This patch set is to complement the kernel locked port patches, such
that iproute2 can be used to lock/unlock a port and check if a port
is locked or not. To lock or unlock a port use the command:

bridge link set dev DEV locked {on | off}

To show the detailed setting of a port, including if the locked flag is
enabled for the port(s), use the command:

bridge -d link show [dev DEV]

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

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman8/ip-link.8: add locked port feature description and cmd syntax
Hans Schultz [Mon, 28 Feb 2022 13:36:50 +0000 (14:36 +0100)] 
man8/ip-link.8: add locked port feature description and cmd syntax

Signed-off-by: Hans Schultz <schultz.hans+netdev@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoman8/bridge.8: add locked port feature description and cmd syntax
Hans Schultz [Mon, 28 Feb 2022 13:36:49 +0000 (14:36 +0100)] 
man8/bridge.8: add locked port feature description and cmd syntax

Signed-off-by: Hans Schultz <schultz.hans+netdev@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoip: iplink_bridge_slave: add locked port flag support
Hans Schultz [Mon, 28 Feb 2022 13:36:48 +0000 (14:36 +0100)] 
ip: iplink_bridge_slave: add locked port flag support

Syntax: ip link set dev DEV type bridge_slave locked {on | off}

Signed-off-by: Hans Schultz <schultz.hans+netdev@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobridge: link: add command to set port in locked mode
Hans Schultz [Mon, 28 Feb 2022 13:36:47 +0000 (14:36 +0100)] 
bridge: link: add command to set port in locked mode

Add support for setting a bridge port in locked mode to use with 802.1X,
so that only authorized clients are allowed access through the port.

Syntax: bridge link set dev DEV locked {on, off}

Signed-off-by: Hans Schultz <schultz.hans+netdev@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoUpdate kernel headers
David Ahern [Fri, 4 Mar 2022 16:10:50 +0000 (09:10 -0700)] 
Update kernel headers

Update kernel headers to commit:
    1039135aedfc ("net: ethernet: sun: Remove redundant code")

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoconfigure: Allow command line override of toolchain
David Ahern [Mon, 7 Feb 2022 00:02:44 +0000 (17:02 -0700)] 
configure: Allow command line override of toolchain

Easy way to build for both gcc and clang.

Signed-off-by: David Ahern <dsahern@kernel.org>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agomptcp: add port support for setting flags
Geliang Tang [Wed, 23 Feb 2022 06:50:39 +0000 (14:50 +0800)] 
mptcp: add port support for setting flags

This patch updated the port keyword check for the setting flags, allow
to use the port keyword with the non-signal flags. Don't allow to use
the port keyword with the id number.

With this patch, we can use setting flags in two forms, using the address
and port number directly or the id number of the address:

 ip mptcp endpoint change id 1 fullmesh
 ip mptcp endpoint change 10.0.2.1 fullmesh
 ip mptcp endpoint change 10.0.2.1 port 10100 fullmesh

Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agomptcp: add fullmesh support for setting flags
Geliang Tang [Wed, 23 Feb 2022 06:50:38 +0000 (14:50 +0800)] 
mptcp: add fullmesh support for setting flags

A pair of new flags, fullmesh and nofullmesh, had been added in the
setting flags of MPTCP PM netlink in kernel space recently by the commit
73c762c1f07d ("mptcp: set fullmesh flag in pm_netlink").

This patch added the corresponding logic to pass these two flags to the
netlink in user space.

These new flags can be used like this:

 ip mptcp endpoint change id 1 fullmesh
 ip mptcp endpoint change id 1 nofullmesh
 ip mptcp endpoint change id 1 backup fullmesh
 ip mptcp endpoint change id 1 nobackup nofullmesh

Here's an example of setting fullmesh flags:

 > sudo ip mptcp endpoint add 10.0.2.1 subflow
 > sudo ip mptcp endpoint show
 10.0.2.1 id 1 subflow
 > sudo ip mptcp endpoint change id 1 fullmesh
 > sudo ip mptcp endpoint show
 10.0.2.1 id 1 subflow fullmesh
 > sudo ip mptcp endpoint change id 1 nofullmesh
 > sudo ip mptcp endpoint show
 10.0.2.1 id 1 subflow

It can be seen that 'ip mptcp endpoint show' already supports showing
the fullmesh flag.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agomptcp: add fullmesh check for adding address
Geliang Tang [Wed, 23 Feb 2022 06:50:37 +0000 (14:50 +0800)] 
mptcp: add fullmesh check for adding address

The fullmesh flag mustn't be used with the signal flag when adding an
address. Commands like this should be treated as invalid commands:

 ip mptcp endpoint add 10.0.2.1 signal fullmesh

This patch added the necessary flags check for this case.

Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobond: add ns_ip6_target option
Hangbin Liu [Mon, 21 Feb 2022 05:54:58 +0000 (13:54 +0800)] 
bond: add ns_ip6_target option

Similar with arp_ip_target, this option add bond IPv6 NS/NA monitor
support. When IPv6 target was set, the ARP target will be disabled.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoMerge branch 'main' into next
David Ahern [Mon, 28 Feb 2022 01:25:02 +0000 (18:25 -0700)] 
Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agodevlink: Remove strtouint8_t in favor of get_u8
David Ahern [Thu, 17 Feb 2022 02:08:10 +0000 (19:08 -0700)] 
devlink: Remove strtouint8_t in favor of get_u8

strtouint8_t duplicates get_u8; remove it.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agodevlink: Remove strtouint16_t in favor of get_u16
David Ahern [Thu, 17 Feb 2022 02:06:16 +0000 (19:06 -0700)] 
devlink: Remove strtouint16_t in favor of get_u16

strtouint16_t duplicates get_u16; remove it.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agodevlink: Remove strtouint32_t in favor of get_u32
David Ahern [Thu, 17 Feb 2022 02:04:39 +0000 (19:04 -0700)] 
devlink: Remove strtouint32_t in favor of get_u32

strtouint32_t duplicates get_u32; remove it.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agodevlink: Remove strtouint64_t in favor of get_u64
David Ahern [Thu, 17 Feb 2022 01:59:43 +0000 (18:59 -0700)] 
devlink: Remove strtouint64_t in favor of get_u64

strtouint64_t duplicates get_u64; remove it.

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agoUpdate kernel headers
David Ahern [Mon, 21 Feb 2022 16:26:21 +0000 (09:26 -0700)] 
Update kernel headers

Update kernel headers to commit:
    7b779cc8846a ("Merge branch 'octeontx2-ptp-updates'")

Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agof_flower: fix indentation for enc_key_id and u32
Wojciech Drewek [Thu, 10 Feb 2022 12:57:15 +0000 (13:57 +0100)] 
f_flower: fix indentation for enc_key_id and u32

Commit b2450e46b7b2 ("flower: fix clang warnings") caused enc_key_id
and u32 to be printed without indentation. Fix this by printing two
spaces before calling print_uint_name_value.

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
3 years agobridge: Remove vlan listing from `bridge link`
Benjamin Poirier [Mon, 14 Feb 2022 01:44:46 +0000 (10:44 +0900)] 
bridge: Remove vlan listing from `bridge link`

vlan listing from `bridge link -d` was broken by commit f32e4977dcb0 ("bridge:
add json support for link command"). print_vlan_info() expects to be passed a
IFLA_AF_SPEC attribute (as is done in print_vlan()) but that commit changed
the call in link.c to pass a IFLA_BRIDGE_VLAN_INFO attribute instead. As a
result, a struct bridge_vlan_info is mistakenly parsed as a struct rtattr and
print_vlan_info() usually exits early in this callpath.

The output style of print_vlan_info() (one line per vlan) is different from
the output style of `bridge link` (multiple attributes per line). The json
output is also unsuitable for `bridge link`. Since vlan listing is available
from `bridge vlan`, remove it from `bridge link` instead of trying to change
print_vlan_info().

Note that previously, bridge master devices would be included in the output
when specifying '-d' (and only in that case) but they are no longer
included because there is no detailed information to show for master
devices if we are not printing a vlan listing:
$ bridge link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
$ bridge -d link
3: br0: <BROADCAST,MULTICAST> mtu 1500 master br0
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
    hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off
$ ./bridge/bridge -d link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
    hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off

Fixes: f32e4977dcb0 ("bridge: add json support for link command")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agobridge: Fix error string typo
Benjamin Poirier [Mon, 14 Feb 2022 01:44:45 +0000 (10:44 +0900)] 
bridge: Fix error string typo

Fixes: fab9a18a2e52 ("bridge: request vlans along with link information")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agolnstat: fix strdup leak in -w argument parsing
Maxim Petrov [Tue, 15 Feb 2022 20:53:47 +0000 (23:53 +0300)] 
lnstat: fix strdup leak in -w argument parsing

'tmp' string is used for safe tokenizing, but it is not required after
getting all the widths in -w option. As 'tmp' string is obtained by strdup
call, the caller has to deallocate it to avoid memory leak.

Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agoiplink_can: print_usage: typo fix, add missing spaces
Vincent Mailhol [Sat, 12 Feb 2022 13:27:27 +0000 (22:27 +0900)] 
iplink_can: print_usage: typo fix, add missing spaces

The can help menu misses three spaces for the TDCV, TDCO and TDCF
parameters, making the closing curly bracket unaligned.

For reference, before this patch:

| $ ip link help can
| Usage: ip link set DEVICE type can
|  [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
|  [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1
|     phase-seg2 PHASE-SEG2 [ sjw SJW ] ]
|
|  [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
|  [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1
|     dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]
|  [ tdcv TDCV tdco TDCO tdcf TDCF ]
|
|  [ loopback { on | off } ]
|  [ listen-only { on | off } ]
|  [ triple-sampling { on | off } ]
|  [ one-shot { on | off } ]
|  [ berr-reporting { on | off } ]
|  [ fd { on | off } ]
|  [ fd-non-iso { on | off } ]
|  [ presume-ack { on | off } ]
|  [ cc-len8-dlc { on | off } ]
|  [ tdc-mode { auto | manual | off } ]
|
|  [ restart-ms TIME-MS ]
|  [ restart ]
|
|  [ termination { 0..65535 } ]
|
|  Where: BITRATE := { NUMBER in bps }
|    SAMPLE-POINT := { 0.000..0.999 }
|    TQ := { NUMBER in ns }
|    PROP-SEG := { NUMBER in tq }
|    PHASE-SEG1 := { NUMBER in tq }
|    PHASE-SEG2 := { NUMBER in tq }
|    SJW := { NUMBER in tq }
|    TDCV := { NUMBER in tc}
|    TDCO := { NUMBER in tc}
|    TDCF := { NUMBER in tc}
|    RESTART-MS := { 0 | NUMBER in ms }

... and after this patch:

| $ ip link help can
| Usage: ip link set DEVICE type can
|  [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
|  [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1
|     phase-seg2 PHASE-SEG2 [ sjw SJW ] ]
|
|  [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
|  [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1
|     dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]
|  [ tdcv TDCV tdco TDCO tdcf TDCF ]
|
|  [ loopback { on | off } ]
|  [ listen-only { on | off } ]
|  [ triple-sampling { on | off } ]
|  [ one-shot { on | off } ]
|  [ berr-reporting { on | off } ]
|  [ fd { on | off } ]
|  [ fd-non-iso { on | off } ]
|  [ presume-ack { on | off } ]
|  [ cc-len8-dlc { on | off } ]
|  [ tdc-mode { auto | manual | off } ]
|
|  [ restart-ms TIME-MS ]
|  [ restart ]
|
|  [ termination { 0..65535 } ]
|
|  Where: BITRATE := { NUMBER in bps }
|    SAMPLE-POINT := { 0.000..0.999 }
|    TQ := { NUMBER in ns }
|    PROP-SEG := { NUMBER in tq }
|    PHASE-SEG1 := { NUMBER in tq }
|    PHASE-SEG2 := { NUMBER in tq }
|    SJW := { NUMBER in tq }
|    TDCV := { NUMBER in tc }
|    TDCO := { NUMBER in tc }
|    TDCF := { NUMBER in tc }
|    RESTART-MS := { 0 | NUMBER in ms }

Fixes: 0c263d7c36ff ("iplink_can: add new CAN FD bittiming parameters:
Transmitter Delay Compensat ion (TDC)")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agodcb: Fix error reporting when accessing "dcb app"
Petr Machata [Wed, 9 Feb 2022 14:41:40 +0000 (15:41 +0100)] 
dcb: Fix error reporting when accessing "dcb app"

Currently dcb decodes the response from "dcb app add" and "del" by
interpreting the returned attribute as u8. But the value stored there is
actually a negative errno value.

Additionally, "dcb app" currently shows two sets of messages, one in
dcb_set_attribute_attr_cb() where the issue is detected, and another as a
result of error return from that function.

The current state is as follows:

# dcb app add dev swp36 dscp-prio 20:2
Error when attempting to set attribute: Unknown error 239
Attribute write: No such file or directory

Fix the "unknown error" issue by correctly decoding the attribute as i8 and
negating it. Furthermore, set errno to that value, and let the top-level
"attribute write" error message show the correct message.

Initialize errno to 0 before the dcb_talk() dispatch, and make the error
print conditional on errno != 0. This way the few error messages that are
worth describing in the place where they are detected will not cause the
second error message to be printed.

The fixed reporting looks like this:

# dcb app add dev swp36 dscp-prio 20:2
Attribute write: File exists

Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agotc: fix duplicate fall-through
Stephen Hemminger [Mon, 14 Feb 2022 21:07:49 +0000 (13:07 -0800)] 
tc: fix duplicate fall-through

Cleanup from last patch

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agolibnetlink: fix socket leak in rtnl_open_byproto()
Maxim Petrov [Tue, 8 Feb 2022 17:20:45 +0000 (20:20 +0300)] 
libnetlink: fix socket leak in rtnl_open_byproto()

rtnl_open_byproto() does not close the opened socket in case of
errors, and the socket is returned to the caller in the `fd` field of
the struct. However, none of the callers care about the socket, so
close it in the function immediately to avoid any potential resource
leaks.

Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>