]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
4 years agoman: rdma-statistic: Add filter description
Andrea Claudi [Fri, 28 Feb 2020 17:36:25 +0000 (18:36 +0100)]
man: rdma-statistic: Add filter description

Add description for filters on rdma statistics show command.
Also add a filter description on the help message of the command.
Additionally, fix some whitespace issue in the man page.

Reported-by: Zhaojuan Guo <zguo@redhat.com>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: rdma.8: Add missing resource subcommand description
Andrea Claudi [Fri, 28 Feb 2020 17:36:24 +0000 (18:36 +0100)]
man: rdma.8: Add missing resource subcommand description

Add resource subcommand in the OBJECT section and a short
description for it.

Reported-by: Zhaojuan Guo <zguo@redhat.com>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoxfrm: not try to delete ipcomp states when using deleteall
Xin Long [Mon, 24 Feb 2020 14:57:01 +0000 (09:57 -0500)]
xfrm: not try to delete ipcomp states when using deleteall

In kernel space, ipcomp(sub) states used by main states are not
allowed to be deleted by users, they would be freed only when
all main states are destroyed and no one uses them.

In user space, ip xfrm sta deleteall doesn't filter these ipcomp
states out, and it causes errors:

  # ip xfrm state add src 192.168.0.1 dst 192.168.0.2 spi 0x1000 \
      proto comp comp deflate mode tunnel sel src 192.168.0.1 dst \
      192.168.0.2 proto gre
  # ip xfrm sta deleteall
  Failed to send delete-all request
  : Operation not permitted

This patch is to fix it by filtering ipcomp states with a check
xsinfo->id.proto == IPPROTO_IPIP.

Fixes: c7699875bee0 ("Import patch ipxfrm-20040707_2.diff")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: ip.8: Add missing vrf subcommand description
Andrea Claudi [Thu, 27 Feb 2020 16:45:43 +0000 (17:45 +0100)]
man: ip.8: Add missing vrf subcommand description

Add description to the vrf subcommand and a reference to the
dedicated man page.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip route: Do not imply pref and ttl-propagate are per nexthop
Donald Sharp [Tue, 25 Feb 2020 13:12:13 +0000 (08:12 -0500)]
ip route: Do not imply pref and ttl-propagate are per nexthop

Currently `ip -6 route show` gives us this output:

sharpd@eva ~/i/ip (master)> ip -6 route show
::1 dev lo proto kernel metric 256 pref medium
4:5::6:7 nhid 18 proto static metric 20
        nexthop via fe80::99 dev enp39s0 weight 1
        nexthop via fe80::44 dev enp39s0 weight 1 pref medium

Displaying `pref medium` as the last bit of output implies
that the RTA_PREF is a per nexthop value, when it is infact
a per route piece of data.

Change the output to display RTA_PREF and RTA_TTL_PROPAGATE
before the RTA_MULTIPATH data is shown:

sharpd@eva ~/i/ip (master)> ./ip -6 route show
::1 dev lo proto kernel metric 256 pref medium
4:5::6:7 nhid 18 proto static metric 20 pref medium
        nexthop via fe80::99 dev enp39s0 weight 1
        nexthop via fe80::44 dev enp39s0 weight 1

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonstat: print useful error messages in abort() cases
Andrea Claudi [Mon, 17 Feb 2020 13:46:18 +0000 (14:46 +0100)]
nstat: print useful error messages in abort() cases

When nstat temporary file is corrupted or in some other corner cases,
nstat use abort() to stop its execution. This can puzzle some users,
wondering what is the reason for the crash.

This commit replaces abort() with some meaningful error messages and exit()

Reported-by: Renaud Métrich <rmetrich@redhat.com>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoerspan: set erspan_ver to 1 by default
Xin Long [Tue, 18 Feb 2020 03:50:20 +0000 (11:50 +0800)]
erspan: set erspan_ver to 1 by default

Commit 289763626721 ("erspan: add erspan version II support")
breaks the command:

 # ip link add erspan1 type erspan key 1 seq erspan 123 \
    local 10.1.0.2 remote 10.1.0.1

as erspan_ver is set to 0 by default, then IFLA_GRE_ERSPAN_INDEX
won't be set in gre_parse_opt().

  # ip -d link show erspan1
    ...
    erspan remote 10.1.0.1 local 10.1.0.2 ... erspan_index 0 erspan_ver 1
                                              ^^^^^^^^^^^^^^

This patch is to change to set erspan_ver to 1 by default.

Fixes: 289763626721 ("erspan: add erspan version II support")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: William Tu <u9012063@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update magic.h
Stephen Hemminger [Tue, 11 Feb 2020 16:16:42 +0000 (08:16 -0800)]
uapi: update magic.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: add support for FQ-PIE packet scheduler
Mohit P. Tahiliani [Tue, 4 Feb 2020 10:49:19 +0000 (16:19 +0530)]
tc: add support for FQ-PIE packet scheduler

This patch adds support for the FQ-PIE packet Scheduler

Principles:
  - Packets are classified on flows.
  - This is a Stochastic model (as we use a hash, several flows might
                                be hashed to the same slot)
  - Each flow has a PIE managed queue.
  - Flows are linked onto two (Round Robin) lists,
    so that new flows have priority on old ones.
  - For a given flow, packets are not reordered.
  - Drops during enqueue only.
  - ECN capability is off by default.
  - ECN threshold (if ECN is enabled) is at 10% by default.
  - Uses timestamps to calculate queue delay by default.

Usage:
tc qdisc ... fq_pie [ limit PACKETS ] [ flows NUMBER ]
                    [ target TIME ] [ tupdate TIME ]
                    [ alpha NUMBER ] [ beta NUMBER ]
                    [ quantum BYTES ] [ memory_limit BYTES ]
                    [ ecn_prob PERCENTAGE ] [ [no]ecn ]
                    [ [no]bytemode ] [ [no_]dq_rate_estimator ]

defaults:
  limit: 10240 packets, flows: 1024
  target: 15 ms, tupdate: 15 ms (in jiffies)
  alpha: 1/8, beta : 5/4
  quantum: device MTU, memory_limit: 32 Mb
  ecnprob: 10%, ecn: off
  bytemode: off, dq_rate_estimator: off

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Sachin D. Patil <sdp.sachin@gmail.com>
Signed-off-by: V. Saicharan <vsaicharan1998@gmail.com>
Signed-off-by: Mohit Bhasi <mohitbhasi1998@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoss: fix tests to reflect compact output
Peter Junos [Wed, 29 Jan 2020 22:33:48 +0000 (23:33 +0100)]
ss: fix tests to reflect compact output

This fixes broken tests in commit c4f5862994589 ("ss: use compact output
for undetected screen width")

It also escapes stars as grep is used and more bugs could sneak under
the radar with the previous solution.

Signed-off-by: Peter Junos <petoju@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: fix warning from unchecked write
Stephen Hemminger [Sun, 2 Feb 2020 12:20:58 +0000 (04:20 -0800)]
devlink: fix warning from unchecked write

Warning seen on Ubuntu

devlink.c: In function ‘cmd_dev_flash’:
devlink.c:3071:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
 3071 |   write(pipe_w, &err, sizeof(err));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 9b13cddfe268 ("devlink: implement flash status monitoring")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip link: xstats: fix TX IGMP reports string
Andrea Claudi [Wed, 29 Jan 2020 14:31:11 +0000 (15:31 +0100)]
ip link: xstats: fix TX IGMP reports string

This restore the string format we have before jsonification, adding a
missing space between v2 and v3 on TX IGMP reports string.

Fixes: a9bc23a79227a ("ip: bridge: add xstats json support")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip-xfrm: Fix help messages
Andrea Claudi [Wed, 29 Jan 2020 14:56:40 +0000 (15:56 +0100)]
ip-xfrm: Fix help messages

After commit 8589eb4efdf2a ("treewide: refactor help messages") help
messages for xfrm state and policy are broken, printing many times the
same protocol in UPSPEC section:

$ ip xfrm state help
[...]
UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] |
                  { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] |
                  gre [ key { DOTTED-QUAD | NUMBER } ] | PROTO }

This happens because strxf_proto function is non-reentrant and gets called
multiple times in the same fprintf instruction.

This commit fix the issue avoiding calls to strxf_proto() with a constant
param, just hardcoding strings for protocol names.

Fixes: 8589eb4efdf2a ("treewide: refactor help messages")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: updates to tcp.h, snmp.h and if_bridge.h
Stephen Hemminger [Wed, 29 Jan 2020 13:48:19 +0000 (05:48 -0800)]
uapi: updates to tcp.h, snmp.h and if_bridge.h

Upstream changes

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi/pkt_sched: upstream changes from fq_pie
Stephen Hemminger [Wed, 29 Jan 2020 13:46:43 +0000 (05:46 -0800)]
uapi/pkt_sched: upstream changes from fq_pie

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update bpf.h and btf.h
Stephen Hemminger [Wed, 29 Jan 2020 13:45:53 +0000 (05:45 -0800)]
uapi: update bpf.h and btf.h

Upstream headers from 5.6 pre rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/network/iproute2/iproute2-next
Stephen Hemminger [Wed, 29 Jan 2020 13:44:53 +0000 (05:44 -0800)]
Merge branch 'master' of git://git.kernel.org/pub/scm/network/iproute2/iproute2-next

Resolved conflict in tc/f_flower.c

4 years agov5.5.0
Stephen Hemminger [Mon, 27 Jan 2020 13:53:09 +0000 (05:53 -0800)]
v5.5.0

4 years agodevlink: Replace pr_out_bool/uint() wrappers with common print functions
Ron Diskin [Thu, 23 Jan 2020 10:32:31 +0000 (12:32 +0200)]
devlink: Replace pr_out_bool/uint() wrappers with common print functions

Replace calls for pr_out_bool() and pr_out_uint() with direct calls
to common json_print library function print_bool() and print_uint().

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Replace pr_#type_value wrapper functions with common functions
Ron Diskin [Thu, 23 Jan 2020 10:32:30 +0000 (12:32 +0200)]
devlink: Replace pr_#type_value wrapper functions with common functions

Replace calls for pr_bool/uint/uint64_value with direct calls for the
matching common json_print library function: print_bool(), print_uint()
and print_u64()

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Replace pr_out_str wrapper function with common function
Ron Diskin [Thu, 23 Jan 2020 10:32:29 +0000 (12:32 +0200)]
devlink: Replace pr_out_str wrapper function with common function

Replace calls for pr_out_str() and pr_out_str_value() with direct calls to
common json_print library functions.

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Replace json prints by common library functions
Ron Diskin [Thu, 23 Jan 2020 10:32:28 +0000 (12:32 +0200)]
devlink: Replace json prints by common library functions

Substitute json prints to use json_print.c common library functions,
instead of directly calling jsonw_functions.

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agojson_print: Add new json object function not as array item
Ron Diskin [Thu, 23 Jan 2020 10:32:27 +0000 (12:32 +0200)]
json_print: Add new json object function not as array item

Currently new json object opens (and delete_json_obj closes) the object as
an array, what adds prints for the matching bracket '[' ']' at the
start/end of the object. This patch adds new_json_obj_plain() and the
matching delete_json_obj_plain() to enable opening and closing json object,
not as array and leave it to the using function to decide which type of
object to open/close as the main object.

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agojson_print: Introduce print_#type_name_value
Ron Diskin [Thu, 23 Jan 2020 10:32:26 +0000 (12:32 +0200)]
json_print: Introduce print_#type_name_value

Until now print_#type functions supported printing constant names and
unknown (variable) values only.
Add functions to allow printing when the name is also sent to the
function as a variable.

Signed-off-by: Ron Diskin <rondi@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: parse attributes with NLA_F_NESTED flag
Leslie Monis [Thu, 16 Jan 2020 15:57:01 +0000 (21:27 +0530)]
tc: parse attributes with NLA_F_NESTED flag

The kernel now requires all new nested attributes to set the
NLA_F_NESTED flag. Enable tc {qdisc,class,filter} to parse
attributes that have the NLA_F_NESTED flag set.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: xfrm: add espintcp encapsulation
Sabrina Dubroca [Sun, 19 Jan 2020 10:32:09 +0000 (11:32 +0100)]
ip: xfrm: add espintcp encapsulation

While at it, convert xfrm_xfrma_print and xfrm_encap_type_parse to use
the UAPI macros for encap_type as suggested by David Ahern, and add the
UAPI udp.h header (sync'd from ipsec-next to get the TCP_ENCAP_ESPINTCP
definition).

Co-developed-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers and import udp.h
David Ahern [Wed, 22 Jan 2020 03:40:26 +0000 (03:40 +0000)]
Update kernel headers and import udp.h

Update kernel headers to commit:
    4f2c17e0f332 ("Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next")

and import udp.h for the next patch.

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: flower: fix print with oneline option
Roi Dayan [Tue, 21 Jan 2020 08:53:30 +0000 (10:53 +0200)]
tc: flower: fix print with oneline option

This commit fix all location in flower to use _SL_ instead of \n for
newline to allow support for oneline option.

Example before this commit:

filter protocol ip pref 2 flower chain 0 handle 0x1
  indev ens1f0
  dst_mac 11:22:33:44:55:66
  eth_type ipv4
  ip_proto tcp
  src_ip 2.2.2.2
  src_port 99
  dst_port 1-10\  tcp_flags 0x5/5
  ip_flags frag
  ct_state -trk\  ct_zone 4\  ct_mark 255
  ct_label 00000000000000000000000000000000
  skip_hw
  not_in_hw\    action order 1: ct zone 5 pipe
         index 1 ref 1 bind 1 installed 287 sec used 287 sec
        Action statistics:\     Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0\

Example output after this commit:

filter protocol ip pref 2 flower chain 0 handle 0x1 \  indev ens1f0\  dst_mac 11:22:33:44:55:66\  eth_type ipv4\  ip_proto tcp\  src_ip 2.2.2.2\  src_port 99\  dst_port 1-10\  tcp_flags 0x5/5\  ip_flags frag\  ct_state -trk\  ct_zone 4\  ct_mark 255\  ct_label 00000000000000000000000000000000\  skip_hw\  not_in_hw\action order 1: ct zone 5 pipe
         index 1 ref 1 bind 1 installed 346 sec used 346 sec
        Action statistics:\     Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0\

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agomake yacc usage POSIX compatible
Ethan Sommer [Wed, 8 Jan 2020 19:57:05 +0000 (14:57 -0500)]
make yacc usage POSIX compatible

config: put YACC in config.mk and use environmental variable if present

ss:
use YACC variable instead of hardcoding bison
place options before source file argument
use -b to specify file prefix instead of output file, as -o isn't POSIX
compatible, this generates ssfilter.tab.c instead of ssfilter.c
replace any references to ssfilter.c with references to ssfilter.tab.c

tc:
use -p flag to set name prefix instead of bison-specific api.prefix
directive
remove unneeded bison-specific directives
use -b instead of -o, replace references to previously generated
emp_ematch.yacc.[ch] with references to newly generated
emp_ematch.tab.[ch]

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobuild: fix build failure with -fno-common
Jan Engelhardt [Wed, 8 Jan 2020 10:04:24 +0000 (11:04 +0100)]
build: fix build failure with -fno-common

$ make CCOPTS=-fno-common
gcc ... -o ip
ld: rt_names.o (symbol from plugin): in function "rtnl_rtprot_n2a":
(.text+0x0): multiple definition of "numeric"; ip.o (symbol from plugin):(.text+0x0): first defined here

gcc ... -o tipc
ld: ../lib/libutil.a(utils.o):(.bss+0xc): multiple definition of `pretty';
tipc.o:tipc.c:28: first defined here

References: https://bugzilla.opensuse.org/1160244
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip: use print_nl() to handle one line mode
Stephen Hemminger [Mon, 20 Jan 2020 17:29:05 +0000 (09:29 -0800)]
ip: use print_nl() to handle one line mode

The helper function print_nl() does the right thing and prints
the newline or backslash.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip: fix link type and vlan oneline output
Vladis Dronov [Sun, 19 Jan 2020 01:12:51 +0000 (02:12 +0100)]
ip: fix link type and vlan oneline output

Move link type printing in print_linkinfo() so multiline output does not
break link options line. Add oneline support for vlan's ingress and egress
qos maps.

Before the fix:

5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
    vlan protocol 802.1Q id 4000 <REORDER_HDR>               the option line is broken ^^^
      ingress-qos-map { 1:2 }
      egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\    link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 \    vlan protocol 802.1Q id 4000 <REORDER_HDR>
      ingress-qos-map { 1:2 }   <<< a multiline output despite -oneline
      egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

After the fix:

5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    vlan protocol 802.1Q id 4000 <REORDER_HDR>
      ingress-qos-map { 1:2 }
      egress-qos-map { 2:1 }

5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\    link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 \    vlan protocol 802.1Q id 4000 <REORDER_HDR> \      ingress-qos-map { 1:2 } \      egress-qos-map { 2:1 }

Fixes: 5c302d518f10 ("vlan support")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206241
Reported-by: George Shuklin <george.shuklin@gmail.com>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoMerge branch 'tc-ets-qdisc' into next
David Ahern [Sat, 18 Jan 2020 21:54:42 +0000 (21:54 +0000)]
Merge branch 'tc-ets-qdisc' into next

Petr Machata  says:

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

A new Qdisc, "ETS", has been accepted into Linux at kernel commit
6bff00170277 ("Merge branch 'ETS-qdisc'"). Add iproute2 support for this
Qdisc.

Patch #1, changes libnetlink to admit NLA_F_NESTED in nested attributes.
Patch #2 then adds ETS support as such.

Examples (taken from the kernel patchset):

- Add a Qdisc with 6 bands, 3 strict and 3 ETS with 45%-30%-25% weights:

    # tc qdisc add dev swp1 root handle 1: \
ets strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5
    # tc qdisc sh dev swp1
    qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5

- Tweak quantum of one of the classes of the previous Qdisc:

    # tc class ch dev swp1 classid 1:4 ets quantum 1000
    # tc qdisc sh dev swp1
    qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 1000 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5
    # tc class ch dev swp1 classid 1:3 ets quantum 1000
    Error: Strict bands do not have a configurable quantum.

- Purely strict Qdisc with 1:1 mapping between priorities and TCs:

    # tc qdisc add dev swp1 root handle 1: \
ets strict 8 priomap 7 6 5 4 3 2 1 0
    # tc qdisc sh dev swp1
    qdisc ets 1: root refcnt 2 bands 8 strict 8 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7

- Use "bands" to specify number of bands explicitly. Underspecified bands
  are implicitly ETS and their quantum is taken from MTU. The following
  thus gives each band the same weight:

    # tc qdisc add dev swp1 root handle 1: \
ets bands 8 priomap 7 6 5 4 3 2 1 0
    # tc qdisc sh dev swp1
    qdisc ets 1: root refcnt 2 bands 8 quanta 1514 1514 1514 1514 1514 1514 1514 1514 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7

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

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: Add support for ETS Qdisc
Petr Machata [Mon, 13 Jan 2020 14:16:29 +0000 (15:16 +0100)]
tc: Add support for ETS Qdisc

Add a new module to generate and parse options specific to the ETS Qdisc.

Example output:

    bands 8 strict 3 priomap 0 1 2 3 4 5 6 7
qdisc ets 1: root refcnt 2 offloaded bands 8 strict 3 quanta 1514 1514 1514 1514 1514 priomap 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7
[
  {
    "kind": "ets",
    "handle": "1:",
    "root": true,
    "refcnt": 2,
    "offloaded": true,
    "options": {
      "bands": 8,
      "strict": 3,
      "quanta": [1514, 1514, 1514, 1514, 1514],
      "priomap": [0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7]
    }
  }
]

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agolibnetlink: parse_rtattr_nested should allow NLA_F_NESTED flag
Petr Machata [Mon, 13 Jan 2020 14:16:28 +0000 (15:16 +0100)]
libnetlink: parse_rtattr_nested should allow NLA_F_NESTED flag

In kernel commit 8cb081746c03 ("netlink: make validation more configurable
for future strictness"), Linux started implicitly flagging nests with
NLA_F_NESTED, unless the nest is created with nla_nest_start_noflag().

The ETS code uses nla_nest_start() where possible, so it does not work with
the current iproute2 code. Have libnetlink catch up by admitting the flag
in the attribute.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip route: Print "rt_offload" and "rt_trap" indication
Ido Schimmel [Thu, 16 Jan 2020 18:43:48 +0000 (20:43 +0200)]
ip route: Print "rt_offload" and "rt_trap" indication

The kernel now signals the offload state of a route using the
'RTM_F_OFFLOAD' and 'RTM_F_TRAP' flags. Print these to help users
understand the offload state of each route. The "rt_" prefix is used in
order to distinguish it from the offload state of nexthops.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Sat, 18 Jan 2020 21:39:15 +0000 (21:39 +0000)]
Update kernel headers

Update kernel headers to commit
    9aaa29494030 ("Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue")

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotipc: fix clang warning in tipc/node.c
Tuong Lien [Mon, 30 Dec 2019 03:03:33 +0000 (10:03 +0700)]
tipc: fix clang warning in tipc/node.c

When building tipc with clang, the following warning is found:

tipc
    CC       bearer.o
    CC       cmdl.o
    CC       link.o
    CC       media.o
    CC       misc.o
    CC       msg.o
    CC       nametable.o
    CC       node.o
node.c:182:24: warning: field 'key' with variable sized type 'struct tipc_aead_key' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
                struct tipc_aead_key key;

This commit fixes it by putting the memory area allocated for the user
input key along with the variable-sized 'key' structure in the 'union'
form instead.

Fixes: 24bee3bf9752 ("tipc: add new commands to set TIPC AEAD key")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: skbprio: add support for JSON output
Stephen Hemminger [Sun, 29 Dec 2019 18:07:18 +0000 (10:07 -0800)]
tc: skbprio: add support for JSON output

Print limit in JSON

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: prio: fix space in JSON tag
Stephen Hemminger [Sun, 29 Dec 2019 18:58:13 +0000 (10:58 -0800)]
tc: prio: fix space in JSON tag

The priomap should not have extra space in the tag.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoss: use compact output for undetected screen width
Peter Junos [Thu, 26 Dec 2019 13:07:09 +0000 (14:07 +0100)]
ss: use compact output for undetected screen width

This change fixes calculation of width in case user pipes the output.

SS output output works correctly when stdout is a terminal. When one
pipes the output, it tries to use 80 or 160 columns. That adds a
line-break if user has terminal width of 100 chars and output is of
the similar width. No width is assumed here.

To reproduce the issue, call
ss | less
and see every other line empty if your screen is between 80 and 160
columns wide.

This second version of the patch fixes screen_width being set to arbitrary
value.

Signed-off-by: Peter Junos <petoju@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Thu, 2 Jan 2020 17:49:45 +0000 (17:49 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoiplink: bond: print lacp actor/partner oper states as strings
Andy Roulin [Tue, 31 Dec 2019 12:15:02 +0000 (04:15 -0800)]
iplink: bond: print lacp actor/partner oper states as strings

The 802.3ad/LACP actor/partner operating states are only printed as
numbers, e.g,

ad_actor_oper_port_state 15

Add an additional output in ip link show that prints a string describing
the individual 3ad bit meanings in the following way:

ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync>

JSON output is also supported, the field becomes a json array:

"ad_actor_oper_port_state_str":
["active","short_timeout","aggregating","in_sync"]

Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Thu, 2 Jan 2020 17:26:50 +0000 (17:26 +0000)]
Update kernel headers

Update kernel headers to commit:
    fe23d63422c8 Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: fq_codel: fix missing statistic in JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:18 +0000 (00:34 +0530)]
tc: fq_codel: fix missing statistic in JSON output

Print JSON object even if tc_fq_codel_xstats->class_stats.drop_next
is negative.

Cc: Toke Høiland-Jørgensen <toke@toke.dk>
Fixes: 997f2dc19378 ("tc: Add JSON output of fq_codel stats")
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: tbf: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:17 +0000 (00:34 +0530)]
tc: tbf: add support for JSON output

Enable proper JSON output for the TBF Qdisc.
Also, fix the style of the statement that's calculating "latency" in
tbf_print_opt().

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: sfq: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:16 +0000 (00:34 +0530)]
tc: sfq: add support for JSON output

Enable proper JSON output for the SFQ Qdisc.
Use the long double format specifier to print the value of
"probability".
Also, fix the indentation in the online output of the contents in the
tc_sfqred_stats structure.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: sfb: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:15 +0000 (00:34 +0530)]
tc: sfb: add support for JSON output

Enable proper JSON output for the SFB Qdisc.
Make the output for options "rehash" and "db" explicit.
Use the long double format specifier to print probability values.
Use sprint_time() to print time values.
Also, fix the indentation in sfb_print_opt().

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: pie: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:14 +0000 (00:34 +0530)]
tc: pie: add support for JSON output

Enable proper JSON output for the PIE Qdisc.
Use sprint_time() to print the value of tc_pie_xstats->delay.
Use the long double format specifier to print tc_pie_xstats->prob.
Also, fix the indentation in the oneline output of statistics and update
the man page to reflect this change.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: hhf: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:13 +0000 (00:34 +0530)]
tc: hhf: add support for JSON output

Enable proper JSON output for the HHF Qdisc.
Also, use sprint_size() to print size values.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fq: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:12 +0000 (00:34 +0530)]
tc: fq: add support for JSON output

Enable proper JSON output for the FQ Qdisc.
Use the "KEY VALUE" format for oneline output of statistics instead of
"VALUE KEY", and remove unnecessary commas from the output.
Use sprint_size() to print size values in fq_print_opt().
Use sprint_time64() to print time values in fq_print_xstats().
Also, update the man page to reflect the changes in the output format.

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: codel: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:11 +0000 (00:34 +0530)]
tc: codel: add support for JSON output

Enable proper JSON output for the CoDel Qdisc.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: choke: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:10 +0000 (00:34 +0530)]
tc: choke: add support for JSON output

Enable proper JSON output for the choke Qdisc.
Also, use the long double format specifier to print the value of
"probability".

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: cbs: add support for JSON output
Leslie Monis [Wed, 25 Dec 2019 19:04:09 +0000 (00:34 +0530)]
tc: cbs: add support for JSON output

Enable proper JSON output for the CBS Qdisc.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoutils: fix indentation
Stephen Hemminger [Sun, 29 Dec 2019 17:53:09 +0000 (09:53 -0800)]
utils: fix indentation

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoip: xfrm if_id -ve value is error
Antony Antony [Thu, 19 Dec 2019 14:18:03 +0000 (15:18 +0100)]
ip: xfrm if_id -ve value is error

if_id is u32, error on -ve values instead of setting to 0

after :
 ip link add ipsec1 type xfrm dev lo if_id -10
 Error: argument "-10" is wrong: if_id value is invalid

before : note xfrm if_id 0
 ip link add ipsec1 type xfrm dev lo if_id -10
 ip -d  link show dev ipsec1
 9: ipsec1@lo: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/none 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
    xfrm if_id 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Fixes: 286446c1e8c ("ip: support for xfrm interfaces")
Signed-off-by: Antony Antony <antony@phenome.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoiplink: add support for STP xstats
Vivien Didelot [Thu, 12 Dec 2019 01:07:11 +0000 (20:07 -0500)]
iplink: add support for STP xstats

Add support for the BRIDGE_XSTATS_STP xstats, as follow:

    # ip link xstats type bridge_slave dev lan4 stp
    lan4
                        STP BPDU:  RX: 0 TX: 61
                        STP TCN:   RX: 0 TX: 0
                        STP Transitions: Blocked: 2 Forwarding: 1

Or below as JSON:

    # ip -j -p link xstats type bridge_slave dev lan0 stp
    [ {
            "ifname": "lan0",
            "stp": {
                "rx_bpdu": 0,
                "tx_bpdu": 500,
                "rx_tcn": 0,
                "tx_tcn": 0,
                "transition_blk": 0,
                "transition_fwd": 0
            }
        } ]

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip link: show permanent hardware address
Michal Kubecek [Sun, 15 Dec 2019 21:06:10 +0000 (22:06 +0100)]
ip link: show permanent hardware address

Display permanent hardware address of an interface in output of
"ip link show" and "ip addr show". To reduce noise, permanent address is
only shown if it is different from current one.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Tue, 17 Dec 2019 16:25:26 +0000 (16:25 +0000)]
Update kernel headers

Update kernel headers to commit:
    6f6dded1385c ("Merge branch 'WireGuard-CI-and-housekeeping'")

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agodevlink: Fix fmsg nesting in non JSON output
Aya Levin [Wed, 11 Dec 2019 15:45:36 +0000 (17:45 +0200)]
devlink: Fix fmsg nesting in non JSON output

When an object or an array opening follows a name (label), add a new
line and indentation before printing the label. When name (label) is
followed by a value, print both at the same line.

Prior to this patch nesting was not visible in a non JSON output:
JSON:
{
    "Common config": {
        "SQ": {
            "stride size": 64,
            "size": 1024
        },
        "CQ": {
            "stride size": 64,
            "size": 1024
        } },
    "SQs": [ {
            "channel ix": 0,
            "sqn": 10,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0,
            "CQ": {
                "cqn": 6,
                "HW status": 0
            }
         },{
            "channel ix": 0,
            "sqn": 14,
            "HW state": 1,
            "stopped": false,
            "cc": 0,
            "pc": 0,
            "CQ": {
                "cqn": 10,
                "HW status": 0
            }
         } ]
}

Before this patch:
Common Config: SQ: stride size: 64 size: 1024
CQ: stride size: 64 size: 1024
SQs:
  channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0
  channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0

With this patch:
Common config:
  SQ:
    stride size: 64 size: 1024
    CQ:
      stride size: 64 size: 1024
SQs:
  channel ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0
  CQ:
    cqn: 6 HW status: 0
  channel ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0
  CQ:
    cqn: 10 HW status: 0

Fixes: 7b8baf834d5e ("devlink: Add devlink health diagnose command")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Add a new time-stamp format for health reporter's dump
Aya Levin [Wed, 11 Dec 2019 15:45:35 +0000 (17:45 +0200)]
devlink: Add a new time-stamp format for health reporter's dump

Introduce a new attribute representing a new time-stamp format: current
time in ns (to comply with y2038) instead of jiffies. If the new
attribute was received, translate the time-stamp accordingly (ns).

Fixes: 2f1242efe9d0 ("devlink: Add devlink health show command")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: Print health reporter's dump time-stamp in a helper function
Aya Levin [Wed, 11 Dec 2019 15:45:34 +0000 (17:45 +0200)]
devlink: Print health reporter's dump time-stamp in a helper function

Add pr_out_dump_reporter prefix to the helper function's name and
encapsulate the print in it.

Fixes: 2f1242efe9d0 ("devlink: Add devlink health show command")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Fix tunnelshow json output
Benjamin Poirier [Mon, 16 Dec 2019 06:43:44 +0000 (15:43 +0900)]
bridge: Fix tunnelshow json output

repeats for "vlan tunnelshow" what commit 0f36267485e3 ("bridge: fix vlan
show formatting") did for "vlan show". This fixes problems in json output.

Note that the resulting json output format of "vlan tunnelshow" is not the
same as the original, introduced in commit 8652eeb3ab12 ("bridge: vlan:
support for per vlan tunnel info"). Changes similar to the ones done for
"vlan show" in commit 0f36267485e3 ("bridge: fix vlan show formatting") are
carried over to "vlan tunnelshow".

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Fixes: 0f36267485e3 ("bridge: fix vlan show formatting")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Deduplicate vlan show functions
Benjamin Poirier [Mon, 16 Dec 2019 06:43:43 +0000 (15:43 +0900)]
bridge: Deduplicate vlan show functions

print_vlan() and print_vlan_tunnel() are almost identical copies, save for
a missing newline in the latter which leads to broken output of "vlan
tunnelshow" in normal mode.

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Fix vni printing
Benjamin Poirier [Mon, 16 Dec 2019 06:43:42 +0000 (15:43 +0900)]
bridge: Fix vni printing

Since commit c7c1a1ef51ae ("bridge: colorize output and use JSON print
library"), print_range() is used for vid (16bits) and vni. However, the
latter are 32bits so they get truncated. They got truncated even before
that commit though.

Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Fix BRIDGE_VLAN_TUNNEL attribute sizes
Benjamin Poirier [Mon, 16 Dec 2019 06:43:41 +0000 (15:43 +0900)]
bridge: Fix BRIDGE_VLAN_TUNNEL attribute sizes

As per the kernel's vlan_tunnel_policy, IFLA_BRIDGE_VLAN_TUNNEL_VID and
IFLA_BRIDGE_VLAN_TUNNEL_FLAGS have type NLA_U16.

Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Fix src_vni argument in man page
Benjamin Poirier [Mon, 16 Dec 2019 06:43:40 +0000 (15:43 +0900)]
bridge: Fix src_vni argument in man page

"SRC VNI" is only one argument and should appear as such. Moreover, this
argument to the src_vni option is documented under three forms: "SRC_VNI",
"SRC VNI" and "VNI" in different places. Consistenly use the simplest form,
"VNI".

Fixes: c5b176e5ba1f ("bridge: fdb: add support for src_vni option")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobridge: Fix typo in error messages
Benjamin Poirier [Mon, 16 Dec 2019 06:43:39 +0000 (15:43 +0900)]
bridge: Fix typo in error messages

Fixes: 9eff0e5cc447 ("bridge: Add vlan configuration support")
Fixes: 7abf5de677e3 ("bridge: vlan: add support to display per-vlan statistics")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotestsuite: Fix line count test
Benjamin Poirier [Mon, 16 Dec 2019 06:43:38 +0000 (15:43 +0900)]
testsuite: Fix line count test

a substring match is not enough, ex: 10 != 1

Fixes: 30383b074de1 ("tests: Add output testing")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agojson_print: Remove declaration without implementation
Benjamin Poirier [Mon, 16 Dec 2019 06:43:37 +0000 (15:43 +0900)]
json_print: Remove declaration without implementation

Fixes: 6377572f0aa8 ("ip: ip_print: add new API to print JSON or regular format output")
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoadd support for table name in SRv6 End.DT* behaviors
Paolo Lungaroni [Fri, 6 Dec 2019 18:11:54 +0000 (19:11 +0100)]
add support for table name in SRv6 End.DT* behaviors

it allows to specify also the table name in addition to the table number in
SRv6 End.DT* behaviors.

To add an End.DT6 behavior route specifying the table by name:

    $ ip -6 route add 2001:db8::1 encap seg6local action End.DT6 table main dev eth0

The ip route show to print output this route:

    $ ip -6 route show 2001:db8::1
    2001:db8::1  encap seg6local action End.DT6 table main dev eth0 metric 1024 pref medium

The JSON output:
    $ ip -6 -j -p route show 2001:db8::1
    [ {
            "dst": "2001:db8::1",
            "encap": "seg6local",
            "action": "End.DT6",
            "table": "main",
            "dev": "eth0",
            "metric": 1024,
            "flags": [ ],
            "pref": "medium"
        } ]

Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: do not output newline in oneline mode
Stephen Hemminger [Wed, 4 Dec 2019 23:37:26 +0000 (15:37 -0800)]
tc: do not output newline in oneline mode

In oneline mode the line seperator should be \
but several parts of tc aren't doing it right.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Wed, 11 Dec 2019 17:13:49 +0000 (17:13 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoss: fix end-of-line printing in misc/ss.c
Brian Vazquez [Wed, 4 Dec 2019 21:32:28 +0000 (13:32 -0800)]
ss: fix end-of-line printing in misc/ss.c

The previous change to ss to show header broke the printing of
end-of-line for the last entry.

Tested:

diff <(./ss.old -nltp) <(misc/ss -nltp)
38c38
< LISTEN   0  128   [::1]:35417  [::]:*  users:(("foo",pid=65254,fd=116))
\ No newline at end of file

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fix warning in tc/q_pie.c
Brian Vazquez [Wed, 4 Dec 2019 21:32:03 +0000 (13:32 -0800)]
tc: fix warning in tc/q_pie.c

Warning was:
q_pie.c:202:22: error: implicit conversion from 'unsigned long' to
'double'

Fixes: 492ec9558b30 ("tc: pie: change maximum integer value of tc_pie_xstats->prob")
Cc: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Brian Vazquez <brianvv@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: fix warning in tc/m_ct.c
Brian Vazquez [Wed, 27 Nov 2019 05:19:34 +0000 (21:19 -0800)]
tc: fix warning in tc/m_ct.c

Warning was:
m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever
'if' condition is false

Cc: Paul Blakey <paulb@mellanox.com>
Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Brian Vazquez <brianvv@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoman: Fix unequal number of .RS and .RE macros
Bjarni Ingi Gislason [Mon, 2 Dec 2019 00:18:04 +0000 (00:18 +0000)]
man: Fix unequal number of .RS and .RE macros

Add missing or excessive ".RE" macros.

  Remove an excessive ".EE" macro.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: pie: add dq_rate_estimator option
Gautam Ramakrishnan [Tue, 26 Nov 2019 11:58:07 +0000 (17:28 +0530)]
tc: pie: add dq_rate_estimator option

PIE now uses per packet timestamps to calculate queuing
delay. The average dequeue rate based queue delay
calculation is now made optional. This patch adds the option
to enable or disable the use of Little's law to calculate
queuing delay.

Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc_util: break long lines
Stephen Hemminger [Wed, 4 Dec 2019 18:45:47 +0000 (10:45 -0800)]
tc_util: break long lines

Try to keep lines less than 100 characters or so.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc_util: support TCA_STATS_PKT64 attribute
Eric Dumazet [Tue, 3 Dec 2019 15:47:01 +0000 (07:47 -0800)]
tc_util: support TCA_STATS_PKT64 attribute

Kernel exports 64bit packet counters for qdisc/class stats in linux-5.5

Tested:

$ tc -s -d qd sh dev eth1 | grep pkt
 Sent 4041158922097 bytes 46393862190 pkt (dropped 0, overlimits 0 requeues 2072)
 Sent 501362903764 bytes 5762621697 pkt (dropped 0, overlimits 0 requeues 247)
 Sent 533282357858 bytes 6128246542 pkt (dropped 0, overlimits 0 requeues 329)
 Sent 515878280709 bytes 5875638916 pkt (dropped 0, overlimits 0 requeues 267)
 Sent 516221011694 bytes 5933395197 pkt (dropped 0, overlimits 0 requeues 258)
 Sent 513175109761 bytes 5898402114 pkt (dropped 0, overlimits 0 requeues 231)
 Sent 480207942964 bytes 5519535407 pkt (dropped 0, overlimits 0 requeues 229)
 Sent 483111196765 bytes 5552917950 pkt (dropped 0, overlimits 0 requeues 240)
 Sent 497920120322 bytes 5723104387 pkt (dropped 0, overlimits 0 requeues 271)
$ tc -s -d cl sh dev eth1 | grep pkt
 Sent 513196316238 bytes 5898645862 pkt (dropped 0, overlimits 0 requeues 231)
 Sent 533304444981 bytes 6128500406 pkt (dropped 0, overlimits 0 requeues 329)
 Sent 480227709687 bytes 5519762597 pkt (dropped 0, overlimits 0 requeues 229)
 Sent 501383660279 bytes 5762860276 pkt (dropped 0, overlimits 0 requeues 247)
 Sent 483131168192 bytes 5553147506 pkt (dropped 0, overlimits 0 requeues 240)
 Sent 515899485505 bytes 5875882649 pkt (dropped 0, overlimits 0 requeues 267)
 Sent 497940747031 bytes 5723341475 pkt (dropped 0, overlimits 0 requeues 271)
 Sent 516242376893 bytes 5933640774 pkt (dropped 0, overlimits 0 requeues 258)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agouapi: update to magic.h
Stephen Hemminger [Wed, 4 Dec 2019 18:42:32 +0000 (10:42 -0800)]
uapi: update to magic.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotipc: add new commands to set TIPC AEAD key
Tuong Lien [Thu, 21 Nov 2019 03:46:46 +0000 (10:46 +0700)]
tipc: add new commands to set TIPC AEAD key

Two new commands are added as part of 'tipc node' command:

 $tipc node set key KEY [algname ALGNAME] [nodeid NODEID]
 $tipc node flush key

which enable user to set and remove AEAD keys in kernel TIPC (requires
the kernel option - 'TIPC_CRYPTO').

For the 'set key' command, the given 'nodeid' parameter decides the
mode to be applied to the key, particularly:

- If NODEID is empty, the key is a 'cluster' key which will be used for
all message encryption/decryption from/to the node (i.e. both TX & RX).
The same key will be set in the other nodes.

- If NODEID is own node, the key is used for message encryption (TX)
from the node. Whereas, if NODEID is a peer node, the key is for
message decryption (RX) from that peer node. This is the 'per-node-key'
mode that each nodes in the cluster has its specific (TX) key.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoUpdate kernel headers
David Ahern [Mon, 25 Nov 2019 23:13:09 +0000 (23:13 +0000)]
Update kernel headers

Update kernel headers to commit:
    c431047c4efe ("enetc: add support Credit Based Shaper(CBS) for hardware offload")

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: flower: support masked port destination and source match
Eli Britstein [Wed, 20 Nov 2019 12:42:45 +0000 (14:42 +0200)]
tc: flower: support masked port destination and source match

Extend destination and source port match to support masks, accepting
both decimal and hexadecimal formats.
Also add missing documentation to synopsis in manpage.

$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 protocol ip parent ffff: prio 1 flower skip_hw \
      ip_proto tcp dst_port 1234/0xff00 action drop

$ tc -s filter show dev eth0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port 1234/0xff00
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 26 sec used 26 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

$ tc -p -j filter show dev eth0 parent ffff:
        "options": {
            "keys": {
                "dst_port": 1234,
                "dst_port_mask": 65280
                ...

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc_util: add functions for big endian masked numbers
Eli Britstein [Wed, 20 Nov 2019 12:42:44 +0000 (14:42 +0200)]
tc_util: add functions for big endian masked numbers

Add functions for big endian masked numbers as a pre-step towards masked
port numbers.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agotc: flower: add u16 big endian parse option
Eli Britstein [Wed, 20 Nov 2019 12:42:43 +0000 (14:42 +0200)]
tc: flower: add u16 big endian parse option

Add u16 big endian parse option as a pre-step towards TCP/UDP/SCTP
ports usage.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip: fix oneline output
Moshe Shemesh [Sun, 24 Nov 2019 16:02:38 +0000 (18:02 +0200)]
ip: fix oneline output

Ip tool oneline option should output each record on a single line. While
oneline option is active the variable _SL_ replaces line feeds with the
'\' character. However, at the end of print_linkinfo() the variable _SL_
shouldn't be used, otherwise the whole output is on a single line.

Before this fix:
$ip -o link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode
DEFAULT group default qlen 1000\    link/loopback 00:00:00:00:00:00 brd
00:00:00:00:00:00\2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
qdisc fq_codel state UP mode DEFAULT group default qlen 1000\
link/ether 52:54:00:60:0a:db brd ff:ff:ff:ff:ff:ff\3: eth1:
<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode
DEFAULT group default qlen 1000\    link/ether 00:50:56:1b:05:cd brd
ff:ff:ff:ff:ff:ff\

After this fix:
$ip -o link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode
DEFAULT group default qlen 1000\    link/loopback 00:00:00:00:00:00 brd
00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
UP mode DEFAULT group default qlen 1000\    link/ether 52:54:00:60:0a:db
brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
UP mode DEFAULT group default qlen 1000\    link/ether 00:50:56:1b:05:cd
brd ff:ff:ff:ff:ff:ff

Fixes: 3aa0e51be64b ("ip: add support for alternative name addition/deletion/list")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Mon, 25 Nov 2019 21:33:28 +0000 (21:33 +0000)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agov5.4.0 v5.4.0
Stephen Hemminger [Mon, 25 Nov 2019 16:07:24 +0000 (08:07 -0800)]
v5.4.0

4 years agonetem: remove redundant README
Stephen Hemminger [Mon, 25 Nov 2019 16:02:43 +0000 (08:02 -0800)]
netem: remove redundant README

The README for distribution format was already in netem/

4 years agoremove no longer useful README for lnstat
Stephen Hemminger [Mon, 25 Nov 2019 16:01:23 +0000 (08:01 -0800)]
remove no longer useful README for lnstat

Superseded by man page.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodevlink: fix requiring either handle
Jakub Kicinski [Wed, 20 Nov 2019 17:56:06 +0000 (09:56 -0800)]
devlink: fix requiring either handle

devlink sb occupancy show requires device or port handle.
It passes both device and port handle bits as required to
dl_argv_parse() so since commit 1896b100af46 ("devlink: catch
missing strings in dl_args_required") devlink will now
complain that only one is present:

$ devlink sb occupancy show pci/0000:06:00.0/0
BUG: unknown argument required but not found

Drop the bit for the handle which was not found from required.

Reported-by: Shalom Toledo <shalomt@mellanox.com>
Fixes: 1896b100af46 ("devlink: catch missing strings in dl_args_required")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Tested-by: Shalom Toledo <shalomt@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoMerge branch 'master' into next
David Ahern [Wed, 20 Nov 2019 02:31:01 +0000 (02:31 +0000)]
Merge branch 'master' into next

Conflicts:
include/uapi/linux/devlink.h

Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agordma: Rewrite custom JSON and prints logic to use common API
Ido Kalir [Mon, 18 Nov 2019 08:35:30 +0000 (10:35 +0200)]
rdma: Rewrite custom JSON and prints logic to use common API

Instead of doing open-coded solution to generate JSON and prints, let's
reuse existing infrastructure and APIs to do the same as ip/*.

Before this change:
 if (rd->json_output)
     jsonw_uint_field(rd->jw, "sm_lid", sm_lid);
 else
     pr_out("sm_lid %u ", sm_lid);

After this change:
 print_uint(PRINT_ANY, "sm_lid", "sm_lid %u ", sm_lid);

All the print functions are converted to support color but for now the
type of color is COLOR_NONE. This is done as a preparation to addition
of color enable option. Such change will require rewrite of command line
arguments parser which is out-of-scope for this patch.

Signed-off-by: Ido Kalir <idok@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agoip link: Add support to get SR-IOV VF node GUID and port GUID
Danit Goldberg [Mon, 18 Nov 2019 07:49:12 +0000 (09:49 +0200)]
ip link: Add support to get SR-IOV VF node GUID and port GUID

Extend iplink to show VF GUIDs (IFLA_VF_IB_NODE_GUID, IFLA_VF_IB_PORT_GUID),
giving the ability for user-space application to print GUID values.
This ability is added to the one of setting new node GUID and port GUID values.

Suitable ip link command:
- ip link show <device>

For example:
- ip link set ib4 vf 0 node_guid 22:44:33:00:33:11:00:33
- ip link set ib4 vf 0 port_guid 10:21:33:12:00:11:22:10
- ip link show ib4
ib4: <BROADCAST,MULTICAST> mtu 4092 qdisc noop state DOWN mode DEFAULT group default qlen 256
link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0     link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff,
spoof checking off, NODE_GUID 22:44:33:00:33:11:00:33, PORT_GUID 10:21:33:12:00:11:22:10, link-state disable, trust off, query_rss off

Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
4 years agouapi: devlink.h health timestamp
Stephen Hemminger [Tue, 19 Nov 2019 19:38:17 +0000 (11:38 -0800)]
uapi: devlink.h health timestamp

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: flower: fix output for ip tos and ttl
Eli Britstein [Thu, 14 Nov 2019 12:44:41 +0000 (14:44 +0200)]
tc: flower: fix output for ip tos and ttl

Fix the output for ip tos and ttl to be numbers in JSON format.

Example:
$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 protocol ip parent ffff: prio 1 flower skip_hw \
      ip_tos 5/0xf action drop

Non JSON format remains the same:
$ tc filter show dev eth0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ip_tos 5/0xf
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1

JSON format is changed (partial output):
$ tc -p -j filter show dev eth0 parent ffff:
Before:
        "options": {
            "keys": {
                "ip_tos": "0x5/f",
                ...
After:
        "options": {
            "keys": {
                "ip_tos": 5,
                "ip_tos_mask": 15,
                ...

Fixes: 6ea2c2b1cff6 ("tc: flower: add support for matching on ip tos and ttl")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc_util: fix JSON prints for ct-mark and ct-zone
Eli Britstein [Thu, 14 Nov 2019 12:44:40 +0000 (14:44 +0200)]
tc_util: fix JSON prints for ct-mark and ct-zone

Fix the output of ct-mark and ct-zone (both for matches and actions) to
be different in JSON/non-JSON mode.

Example:
$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 protocol ip parent ffff: prio 1 flower skip_hw \
      ct_zone 5 ct_mark 6/0xf action ct commit zone 7 mark 8/0xf drop

Non JSON format remains the same:
$ tc filter show dev eth0 parent ffff:
$ tc -s filter show dev ens1f0_0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ct_zone 5
  ct_mark 6/0xf
  skip_hw
  not_in_hw
        action order 1: ct commit mark 8/0xf zone 7 drop
         index 1 ref 1 bind 1 installed 108 sec used 108 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

JSON format is changed (partial output):
$ tc -p -j filter show dev eth0 parent ffff:
Before:
        "options": {
            "keys": {
                "ct_zone": "5",
                "ct_mark": "6/0xf"
                ...
        "actions": [ {
                "order": 1,
                "kind": "ct",
                "action": "commit",
                "mark": "8/0xf",
                "zone": "7",
                ...
After:
        "options": {
            "keys": {
                "ct_zone": 5,
                "ct_mark": 6,
                "ct_mark_mask": 15
                ...
        "actions": [ {
                "order": 1,
                "kind": "ct",
                "action": "commit",
                "mark": 8,
                "mark_mask": 15,
                "zone": 7,
                ...

Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc: flower: fix newline prints for ct-mark and ct-zone
Eli Britstein [Thu, 14 Nov 2019 12:44:39 +0000 (14:44 +0200)]
tc: flower: fix newline prints for ct-mark and ct-zone

Matches of ct-mark and ct-zone were printed all in the same line. Fix
that so each ct match is printed in a separate line.

Example:
$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 protocol ip parent ffff: prio 1 flower skip_hw \
      ct_zone 5 ct_mark 6/0xf action ct commit zone 7 mark 8/0xf drop

Before:
$ tc -s filter show dev eth0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4 ct_zone 5 ct_mark 6/0xf
  skip_hw
  not_in_hw
        action order 1: ct commit mark 8/0xf zone 7 drop
         index 1 ref 1 bind 1 installed 31 sec used 31 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

After:
$ tc -s filter show dev eth0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ct_zone 5
  ct_mark 6/0xf
  skip_hw
  not_in_hw
        action order 1: ct commit mark 8/0xf zone 7 drop
         index 1 ref 1 bind 1 installed 108 sec used 108 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agotc_util: add an option to print masked numbers with/without a newline
Eli Britstein [Thu, 14 Nov 2019 12:44:38 +0000 (14:44 +0200)]
tc_util: add an option to print masked numbers with/without a newline

Add an option to print masked numbers with or without a newline, as a
pre-step towards using a common function.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>