]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
5 years agodrop support for DECnet
Stephen Hemminger [Tue, 11 Dec 2018 16:40:09 +0000 (08:40 -0800)]
drop support for DECnet

DECnet belongs in the history museum of dead protocols along
with Appletalk and IPX.

Linux support has outlived its natural life and the time has
come to remove it from iproute2. Dead code is a source
of bugs and exploits.

If anyone actually has DECnet running on some old distribution
they can just keep to the old version of iproute2.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Fri, 7 Dec 2018 21:02:08 +0000 (13:02 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add support for 'fw_load_policy' generic parameter
Shalom Toledo [Tue, 4 Dec 2018 10:14:08 +0000 (10:14 +0000)]
devlink: Add support for 'fw_load_policy' generic parameter

Add string to uint conversion for 'fw_load_policy' generic parameter.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add string to uint{8,16,32} conversion for generic parameters
Shalom Toledo [Tue, 4 Dec 2018 10:14:07 +0000 (10:14 +0000)]
devlink: Add string to uint{8,16,32} conversion for generic parameters

Allow setting u{8,16,32} generic parameters as a well defined strings in
devlink user space tool.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: align uapi headers with 4.20-rc5
Stephen Hemminger [Fri, 7 Dec 2018 17:25:59 +0000 (09:25 -0800)]
rdma: align uapi headers with 4.20-rc5

Upstream headers were updated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotipc: fix misalignment printout in non-JSON output
Hoang Le [Thu, 6 Dec 2018 01:40:06 +0000 (08:40 +0700)]
tipc: fix misalignment printout in non-JSON output

In the commit 1304f50a5be0ed ("tipc: JSON support for showing nametable"),
introduced misalignment in the columns of the printout in non-JSON mode
compare to the list header. Add one space per column to make alignment
with the list header.

before:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1         1         1         node    4071367628

after:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1          1          1          node     4071367628

Reported-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: iplink_can.c: fix json formatting
Martin Jeřábek [Wed, 5 Dec 2018 15:39:20 +0000 (16:39 +0100)]
ip: iplink_can.c: fix json formatting

Previously the CAN state was always printed in human-readable txt format,
resulting in invalid JSON.

Signed-off-by: Martin Jeřábek <martin.jerabek01@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: Add a test for batch processing
Petr Machata [Tue, 4 Dec 2018 16:07:42 +0000 (16:07 +0000)]
testsuite: Add a test for batch processing

Test that when a second or following command in a batch fails, tc
reports it correctly. This is a test for the previous patch.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolibnetlink: Process further iovs on no error
Petr Machata [Tue, 4 Dec 2018 16:07:41 +0000 (16:07 +0000)]
libnetlink: Process further iovs on no error

When no error is reported in the first iov, do not prematurely return,
but process further iovs. This fixes batch processing.

Fixes: c60389e4f9ea ("libnetlink: fix leak and using unused memory on error")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiproute2: Installation errors without libmnl
Emeric Dupont [Mon, 3 Dec 2018 11:13:06 +0000 (12:13 +0100)]
iproute2: Installation errors without libmnl

When performing make install in iproute2 (current git master),
     if $(HAVE_MNL) is not selected, some Makefiles try to call
     install with an empty target, which causes a non-critical make error.

Signed-off-by: Emeric Dupont <emeric.dupont@zii.aero>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: don't need to call pkg-config twice
Stephen Hemminger [Tue, 4 Dec 2018 22:19:33 +0000 (14:19 -0800)]
devlink: don't need to call pkg-config twice

pkg-config for libmnl is already done in config.mk

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: flower: Classify packets based port ranges
Amritha Nambiar [Tue, 27 Nov 2018 22:40:03 +0000 (14:40 -0800)]
tc: flower: Classify packets based port ranges

Added support for filtering based on port ranges.
UAPI changes have been accepted into net-next.

Example:
1. Match on a port range:
-------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower ip_proto tcp dst_port 20-30 skip_hw\
  action drop

$ tc -s filter show dev enp4s0 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 20-30
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 85 sec used 3 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower dst_ip 192.168.1.1 ip_proto tcp dst_port 100-200\
  skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0 handle 0x2
  eth_type ipv4
  ip_proto tcp
  dst_ip 192.168.1.1
  dst_port 100-200
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 58 sec used 2 sec
        Action statistics:
        Sent 920 bytes 20 pkt (dropped 20, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

v6:
Modified to change json output format as object for sport/dport.

 "dst_port":{
           "start":2000,
           "end":6000
 },
 "src_port":{
           "start":50,
           "end":60
 }

v5:
Simplified some code and used 'sscanf' for parsing. Removed
space in output format.

v4:
Added man updates explaining filtering based on port ranges.
Removed 'range' keyword.

v3:
Modified flower_port_range_attr_type calls.

v2:
Addressed Jiri's comment to sync output format with input

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoRevert "tc: flower: Classify packets based port ranges"
David Ahern [Tue, 4 Dec 2018 00:01:07 +0000 (16:01 -0800)]
Revert "tc: flower: Classify packets based port ranges"

This reverts commit e20e50b0c1643d371dc6597dfc38355d235c84a0.

Inadvertently pushed v3 of this patch.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Mon, 3 Dec 2018 23:39:29 +0000 (15:39 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agol2tp: Fix printing of cookie and peer_cookie values
Andrea Claudi [Fri, 30 Nov 2018 14:34:24 +0000 (15:34 +0100)]
l2tp: Fix printing of cookie and peer_cookie values

print_cookie() invocations miss %s format specifier.
While at it, align printout to the previous lines.

Fixes: 98453b65800f7 ("ip/l2tp: add JSON support")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: add a missing space between rate estimator and backlog
Eric Dumazet [Fri, 30 Nov 2018 13:57:02 +0000 (05:57 -0800)]
tc: add a missing space between rate estimator and backlog

When a rate estimator is active, "tc -s qd" displays
something like :

rate 12616bit 11ppsbacklog 0b 0p requeues 2

instead of :

rate 12616bit 11pps backlog 0b 0p requeues 2

Fixes: 4fcec7f3665b ("tc: jsonify stats2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agossfilter: Fix for inverted last expression
Phil Sutter [Thu, 29 Nov 2018 12:20:37 +0000 (13:20 +0100)]
ssfilter: Fix for inverted last expression

When fixing for shift/reduce conflicts, possibility to invert the last
expression by prefixing with '!' or 'not' was accidentally removed.

Fix this by allowing for expr to be an inverted expr so that any
reference to it in exprlist accepts the inverted prefix.

Reported-by: Eric Dumazet <edumazet@google.com>
Fixes: b2038cc0b2403 ("ssfilter: Eliminate shift/reduce conflicts")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: add support for bytes_sent, bytes_retrans, dsack_dups and reord_seen
Eric Dumazet [Thu, 29 Nov 2018 10:27:54 +0000 (02:27 -0800)]
ss: add support for bytes_sent, bytes_retrans, dsack_dups and reord_seen

Wei Wang added these fields in linux-4.19

Tested:

ss -ti ...

ts sack cubic wscale:8,8 rto:7 rtt:2.678/0.267 mss:1428 pmtu:1500
    rcvmss:536 advmss:1428 cwnd:91 ssthresh:65
(*) bytes_sent:17470606104 bytes_retrans:2856
    bytes_acked:17470483297
    segs_out:12234320 segs_in:622983
    data_segs_out:12234318 send 388.2Mbps lastrcv:986784 lastack:1
    pacing_rate 465.8Mbps delivery_rate 162.7Mbps
    delivered:12234235 delivered_ce:3669056
    busy:986784ms unacked:84 retrans:0/2
(*) dsack_dups:2
    rcv_space:14280 rcv_ssthresh:65535 notsent:2016336 minrtt:0.183

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wei Wang <weiwan@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: ip-route.8: Fix ENCAP references in synopsis
Phil Sutter [Wed, 28 Nov 2018 11:12:32 +0000 (12:12 +0100)]
man: ip-route.8: Fix ENCAP references in synopsis

The different encapsulation types are described in ENCAP_*
non-terminals, but ENCAP definition lists them without the ENCAP_
prefix. Fix this for consistency.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: make -c match -compressvlans first instead of -color
Roopa Prabhu [Wed, 28 Nov 2018 02:02:52 +0000 (18:02 -0800)]
bridge: make -c match -compressvlans first instead of -color

commit c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
broke previous use of -c to represent compressvlans. This restores
previous use of -c to represent compressvlans. Understand the original
motivation to use -c to represent color consistently everywhere but
there are apps and network interface managers out there that are already
using -c to prepresent compressed vlans.

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: add support for delivered and delivered_ce fields
Eric Dumazet [Mon, 26 Nov 2018 22:29:53 +0000 (14:29 -0800)]
ss: add support for delivered and delivered_ce fields

Kernel support was added in linux-4.18 in commit feb5f2ec6464
("tcp: export packets delivery info")

Tested:

ss -ti
...
ESTAB   0 2270520      [2607:f8b0:8099:e16::]:47646   [2607:f8b0:8099:e18::]:38953
 ts sack cubic wscale:8,8 rto:7 rtt:2.824/0.278 mss:1428
     pmtu:1500 rcvmss:536 advmss:1428 cwnd:89 ssthresh:62 bytes_acked:2097871945
    segs_out:1469144 segs_in:65221 data_segs_out:1469142 send 360.0Mbps lastsnd:2
    lastrcv:99231 lastack:2 pacing_rate 431.9Mbps delivery_rate 246.4Mbps
(*) delivered:1469099 delivered_ce:424799
    busy:99231ms unacked:44 rcv_space:14280 rcv_ssthresh:65535
    notsent:2207688 minrtt:0.228

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: rdma: Add reference to rdma-resource.8
Phil Sutter [Mon, 26 Nov 2018 17:58:31 +0000 (18:58 +0100)]
man: rdma: Add reference to rdma-resource.8

All rdma-related man pages list each other in SEE ALSO section, only
rdma-resource.8 is missing. Add it for the sake of consistency.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: tc: update man page for fq packet scheduler
Eric Dumazet [Sun, 25 Nov 2018 01:44:36 +0000 (17:44 -0800)]
man: tc: update man page for fq packet scheduler

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: fq: support ce_threshold attribute
Eric Dumazet [Sat, 24 Nov 2018 06:37:24 +0000 (22:37 -0800)]
tc: fq: support ce_threshold attribute

Kernel commit 48872c11b772 ("net_sched: sch_fq: add dctcp-like marking")
added support for TCA_FQ_CE_THRESHOLD attribute.

This patch adds iproute2 support for it.

It also makes sure fq_print_xstats() can deal with smaller tc_fq_qd_stats
structures given by older kernels.

Usage :

FQATTRS="ce_threshold 4ms"
TXQS=8

for ETH in eth0
do
 tc qd del dev $ETH root 2>/dev/null
 tc qd add dev $ETH root handle 1: mq
 for i in `seq 1 $TXQS`
 do
  tc qd add dev $ETH parent 1:$i fq $FQATTRS
 done
done

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodrop support for IPX
Stephen Hemminger [Thu, 15 Nov 2018 19:26:13 +0000 (11:26 -0800)]
drop support for IPX

IPX has been depracted then removed from upstream kernels.
Drop support from ip route as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'tc-gred-json-perf-vq-config' into iproute2-next
David Ahern [Sat, 24 Nov 2018 15:17:30 +0000 (07:17 -0800)]
Merge branch 'tc-gred-json-perf-vq-config' into iproute2-next

Jakub Kicinski  says:

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

This set brings GRED support up to date with recent kernel changes.
In particular the new netlink attributes for more fine-grained stats
and per-virtual queue flags.

To make GRED usable in modern deployments the patch set starts with
adding JSON output.

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

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: allow controlling and dumping per-DP RED flags
Jakub Kicinski [Mon, 19 Nov 2018 23:03:35 +0000 (15:03 -0800)]
tc: gred: allow controlling and dumping per-DP RED flags

Kernel now support setting ECN and HARDDROP flags per-virtual
queue.  Allow users to tweak the settings, and print them on
dump.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: support controlling RED flags
Jakub Kicinski [Mon, 19 Nov 2018 23:03:34 +0000 (15:03 -0800)]
tc: gred: support controlling RED flags

Kernel GRED qdisc supports ECN marking, and the harddrop flag
but setting and dumping this flag is not possible with iproute2.
Add the support.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: use extended stats if available
Jakub Kicinski [Mon, 19 Nov 2018 23:03:33 +0000 (15:03 -0800)]
tc: gred: use extended stats if available

Use the extended attributes with extra and better stats, when
possible.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: separate out stats printing
Jakub Kicinski [Mon, 19 Nov 2018 23:03:32 +0000 (15:03 -0800)]
tc: gred: separate out stats printing

Printing GRED statistics is long and deserves a function on its own.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: jsonify GRED output
Jakub Kicinski [Mon, 19 Nov 2018 23:03:31 +0000 (15:03 -0800)]
tc: gred: jsonify GRED output

Make GRED dump JSON-compatible.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: move RED flag printing to helper
Jakub Kicinski [Mon, 19 Nov 2018 23:03:30 +0000 (15:03 -0800)]
tc: move RED flag printing to helper

Number of qdiscs use the same set of flags to control shared RED
implementation.  Add a helper for printing those flags.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agojson: add %hhu helpers
Jakub Kicinski [Mon, 19 Nov 2018 23:03:29 +0000 (15:03 -0800)]
json: add %hhu helpers

Add helpers for printing char-size values.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: gred: remove unclear comment
Jakub Kicinski [Mon, 19 Nov 2018 23:03:28 +0000 (15:03 -0800)]
tc: gred: remove unclear comment

The comment about providing a proper message seems similar to
the comment in the kernel which says:

    /* hack -- fix at some point with proper message
       This is how we indicate to tc that there is no VQ
       at this DP */

it's unclear what that message would be, and whether it's needed.
Remove the confusing comment.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoRevert "rdma: make local functions static"
David Ahern [Sat, 24 Nov 2018 15:06:17 +0000 (07:06 -0800)]
Revert "rdma: make local functions static"

This reverts commit e99c4443ae1d582950a2207067368a59152bbd77.

Patch added to iproute2-master breaks builds of -next because of a
more recent patch in -next that relies on the exports. Revert the
offending patch. Unfortunately this leaves a window where builds
break.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Sat, 24 Nov 2018 15:06:11 +0000 (07:06 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobpf: initialise map symbol before retrieving and comparing its type
Quentin Monnet [Tue, 20 Nov 2018 01:26:27 +0000 (01:26 +0000)]
bpf: initialise map symbol before retrieving and comparing its type

In order to compare BPF map symbol type correctly in regard to the
latest LLVM, commit 7a04dd84a7f9 ("bpf: check map symbol type properly
with newer llvm compiler") compares map symbol type to both NOTYPE and
OBJECT. To do so, it first retrieves the type from "sym.st_info" and
stores it into a temporary variable.

However, the type is collected from the symbol "sym" before this latter
symbol is actually updated. gelf_getsym() is called after that and
updates "sym", and when comparison with OBJECT or NOTYPE happens it is
done on the type of the symbol collected in the previous passage of the
loop (or on an uninitialised symbol on the first passage). This may
eventually break map collection from the ELF file.

Fix this by assigning the type to the temporary variable only after the
call to gelf_getsym().

Fixes: 7a04dd84a7f9 ("bpf: check map symbol type properly with newer llvm compiler")
Reported-by: Ron Philip <ron.philip@netronome.com>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@netronome.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipnetns: parse nsid as a signed integer
Nicolas Dichtel [Wed, 21 Nov 2018 09:44:27 +0000 (10:44 +0100)]
ipnetns: parse nsid as a signed integer

Don't confuse the user, nsid is a signed integer, this kind of command
should return an error: 'ip netns set foo 0xffffffff'.

Also, a valid value is a positive value. To let the kernel chooses a value,
the keyword 'auto' must be used.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: flower: Classify packets based port ranges
Amritha Nambiar [Fri, 16 Nov 2018 00:55:13 +0000 (16:55 -0800)]
tc: flower: Classify packets based port ranges

Added support for filtering based on port ranges.
UAPI changes have been accepted into net-next.

Example:
1. Match on a port range:
-------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower ip_proto tcp dst_port range 20-30 skip_hw\
  action drop

$ tc -s filter show dev enp4s0 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 range 20-30
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 85 sec used 3 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower dst_ip 192.168.1.1 ip_proto tcp dst_port range 100-200\
  skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0 handle 0x2
  eth_type ipv4
  ip_proto tcp
  dst_ip 192.168.1.1
  dst_port range 100-200
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 58 sec used 2 sec
        Action statistics:
        Sent 920 bytes 20 pkt (dropped 20, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

v3:
Modified flower_port_range_attr_type calls.

v2:
Addressed Jiri's comment to sync output format with input

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Tue, 20 Nov 2018 22:33:09 +0000 (14:33 -0800)]
Update kernel headers

Update kernel headers to
  b1a200484143 ("net-next/hinic: fix a bug in rx data flow")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:40 +0000 (14:36 -0800)]
rdma: make local functions static

Several functions only used inside utils.c

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/pedit: use structure initialization
Stephen Hemminger [Thu, 15 Nov 2018 22:36:39 +0000 (14:36 -0800)]
tc/pedit: use structure initialization

The pedit callback structure table should be iniatialized using
structure initialization to avoid structure changes problems.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/action: make variables static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:38 +0000 (14:36 -0800)]
tc/action: make variables static

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/meta: make meta_table static and const
Stephen Hemminger [Thu, 15 Nov 2018 22:36:37 +0000 (14:36 -0800)]
tc/meta: make meta_table static and const

The mapping table is only used by em_meta.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/util: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:36 +0000 (14:36 -0800)]
tc/util: make local functions static

The tc util library parse/print has functions only used locally
(and some dead code removed).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/ematch: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:35 +0000 (14:36 -0800)]
tc/ematch: make local functions static

The print handling is only used in tc/m_ematch.c

Remove unused function to print_ematch_tree.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/pedit: make functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:34 +0000 (14:36 -0800)]
tc/pedit: make functions static

The parse and pack functions are only used by the pedit routines.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: make local variables static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:33 +0000 (14:36 -0800)]
ss: make local variables static

Several variables only used in this code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/police: make print_police static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:32 +0000 (14:36 -0800)]
tc/police: make print_police static

print_police function only used by m_police.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc/class: make filter variables static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:31 +0000 (14:36 -0800)]
tc/class: make filter variables static

Only used in this file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotipc: make cmd_find static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:30 +0000 (14:36 -0800)]
tipc: make cmd_find static

Function only used in one file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: drop unused name_to_id function
Stephen Hemminger [Thu, 15 Nov 2018 22:36:29 +0000 (14:36 -0800)]
tc: drop unused name_to_id function

Not used in current code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipxfrm: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:28 +0000 (14:36 -0800)]
ipxfrm: make local functions static

Make functions only used in ipxfrm.c static.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipmonitor: make local variable static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:27 +0000 (14:36 -0800)]
ipmonitor: make local variable static

prefix_banner only used in one file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: make flag names const/static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:26 +0000 (14:36 -0800)]
ip: make flag names const/static

The table of filter flags is only used in ipaddress

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: make local variables static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:25 +0000 (14:36 -0800)]
bridge: make local variables static

enable_color and set_color_palette only used here.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agogenl: remove dead code
Stephen Hemminger [Thu, 15 Nov 2018 22:36:24 +0000 (14:36 -0800)]
genl: remove dead code

The function genl_ctrl_resolve_family is defined but never used
in current code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolibnetlnk: unused and local functions cleanup
Stephen Hemminger [Thu, 15 Nov 2018 22:36:23 +0000 (14:36 -0800)]
libnetlnk: unused and local functions cleanup

rntl_talk_extack and parse_rtattr_index not used in current code.
rtnl_dump_filter_l is only used in this file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/ll_map: make local function static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:22 +0000 (14:36 -0800)]
lib/ll_map: make local function static

ll_idx_a2n is only used in ll_map.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/color: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:21 +0000 (14:36 -0800)]
lib/color: make local functions static

color_enable etc, only used here.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/utils: make local functions static
Stephen Hemminger [Thu, 15 Nov 2018 22:36:20 +0000 (14:36 -0800)]
lib/utils: make local functions static

Some of the print/parsing is only used internally.
Drop unused get_s8/get_s16.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/ll_addr: whitespace and indent cleanup
Stephen Hemminger [Thu, 15 Nov 2018 22:36:19 +0000 (14:36 -0800)]
lib/ll_addr: whitespace and indent cleanup

Run old ll_addr through kernel Lindent.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/shemminger/iproute2
Stephen Hemminger [Mon, 19 Nov 2018 19:40:37 +0000 (11:40 -0800)]
Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/shemminger/iproute2

5 years agoip-address: Fix filtering by negated address flags
Phil Sutter [Thu, 15 Nov 2018 13:28:59 +0000 (14:28 +0100)]
ip-address: Fix filtering by negated address flags

When disabling a flag, one needs to AND with the inverse not the flag
itself. Otherwise specifying for instance 'home -nodad' will effectively
clear the flags variable.

While being at it, simplify the code a bit by merging common parts of
negated and non-negated case branches. Also allow for the "special
cases" to be inverted, too.

Fixes: f73ac674d0abf ("ip: change flag names to an array")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: drop old kernel configs
Stephen Hemminger [Mon, 19 Nov 2018 19:37:08 +0000 (11:37 -0800)]
testsuite: drop old kernel configs

The testsuite directory had several ancient kernel configs.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip-route: Fix nexthop encap parsing
Phil Sutter [Tue, 13 Nov 2018 12:39:04 +0000 (13:39 +0100)]
ip-route: Fix nexthop encap parsing

When parsing nexthop parameters, a buffer of 4k bytes is provided. Yet,
in lwt_parse_encap() and some functions called by it, buffer size was
assumed to be 1k despite the actual size was provided. This led to
spurious buffer size errors if the buffer was filled by previous nexthop
parameters to exceed that 1k boundary.

Fixes: 1e5293056a02c ("lwtunnel: Add encapsulation support to ip route")
Fixes: 5866bddd9aa9e ("ila: Add support for ILA lwtunnels")
Fixes: ed67f83806538 ("ila: Support for checksum neutral translation")
Fixes: 86905c8f057c0 ("ila: support for configuring identifier and hook types")
Fixes: b15f440e78373 ("lwt: BPF support for LWT")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: colorize test result output
Stephen Hemminger [Mon, 12 Nov 2018 16:39:32 +0000 (08:39 -0800)]
testsuite: colorize test result output

When running testsuite it is easy as a human to miss failure.
Add symbol colorizing to SKIPED/PASS/FAIL output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: ip-route.8: Document nexthop limit
Phil Sutter [Tue, 13 Nov 2018 15:55:13 +0000 (16:55 +0100)]
man: ip-route.8: Document nexthop limit

Add a note to 'nexthop' description stating the maximum number of
nexthops per command and pointing at 'append' command as a workaround.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: ss: Fix spacing in expected output for ssfilter.t
Stefano Brivio [Sat, 10 Nov 2018 09:21:59 +0000 (10:21 +0100)]
testsuite: ss: Fix spacing in expected output for ssfilter.t

Since commit 00240899ec0b ("ss: Actually print left delimiter for
columns") changes spacing in ss output, we also need to adjust for that in
the ss filter test.

Fixes: 00240899ec0b ("ss: Actually print left delimiter for columns")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: correctly use CC macros for generate_nlmsg
Luca Boccassi [Fri, 9 Nov 2018 16:31:36 +0000 (16:31 +0000)]
testsuite: correctly use CC macros for generate_nlmsg

It's $(QUIET_CC)$(CC) not $(QUIET_CC), copy-paste error. CI does
verbose build so it slipped through.

Fixes: 6e7d347aabbb ("testsuite: build generate_nlmsg with QUIET_CC")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiplink_geneve: Add DF configuration
Stefano Brivio [Thu, 8 Nov 2018 11:21:26 +0000 (12:21 +0100)]
iplink_geneve: Add DF configuration

Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

v2:
- Indicate in the man page what DF refers to, using RFC 791 wording
  (David Ahern)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink_vxlan: Add DF configuration
Stefano Brivio [Thu, 8 Nov 2018 11:21:25 +0000 (12:21 +0100)]
iplink_vxlan: Add DF configuration

Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

v2:
- Indicate in the man page what DF refers to, using RFC 791 wording
  (David Ahern)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Fri, 9 Nov 2018 16:50:50 +0000 (08:50 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: sctp header change
Stephen Hemminger [Fri, 9 Nov 2018 16:18:26 +0000 (08:18 -0800)]
uapi: sctp header change

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: f_u32: allow skip_hw and skip_sw flags to be last
Jakub Kicinski [Tue, 6 Nov 2018 03:23:27 +0000 (19:23 -0800)]
tc: f_u32: allow skip_hw and skip_sw flags to be last

u32 uses NEXT_ARG() incorrectly when parsing skip_hw and skip_sw
flags.  NEXT_ARG() ensures there is another argument on the command
line, and is used in handling <keyword> <value> syntax to move past
<keyword> and ensure there is a <value> to read.

Commit 5e5b3008d1fb ("tc: f_u32: Add support for skip_hw and skip_sw
flags") seems to have copy pasted the handling from the previous
command - "police", which needs an extra parameter and is kind of
special due to the use of parse_police() helper.

The combination of NEXT_ARG() and continue worked fine as long as
skip_sw/skip_hw wasn't last, e.g.:

$ tc filter add dev dummy0 ingress prio 101 protocol ipv6 \
    u32 match ip6 priority 0xa0 0xe0 skip_hw action pass

But would fail if it was last:

$ tc filter add dev dummy0 ingress prio 101 protocol ipv6 \
    u32 match ip6 priority 0xa0 0xe0 flowid :1 skip_hw
Command line is not complete. Try option "help"

Remove the NEXT_ARG()s and the continues, and let the argc--; argv++;
at the end of the loop do its job.

Fixes: 5e5b3008d1fb ("tc: f_u32: Add support for skip_hw and skip_sw flags")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoPass CPPFLAGS to the compiler
Luca Boccassi [Fri, 2 Nov 2018 12:35:44 +0000 (12:35 +0000)]
Pass CPPFLAGS to the compiler

When building Debian packages pre-processor flags are passed via
CPPFLAGS, as the convention indicates. Specifically, the hardening
-D_FORTIFY_SOURCE=2 flag is used.
Pass CPPFLAGS to all calls of QUIET_CC together with CFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: build generate_nlmsg with QUIET_CC
Luca Boccassi [Fri, 2 Nov 2018 12:35:43 +0000 (12:35 +0000)]
testsuite: build generate_nlmsg with QUIET_CC

Follow the standard pattern, and respect user's verbosity setting.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: Add missing region option to devlink man page
Alex Vesker [Thu, 8 Nov 2018 09:14:13 +0000 (11:14 +0200)]
devlink: Add missing region option to devlink man page

The region field was not added to the devlink man page.

Fixes: 8b4fbf0bed8e6 ("devlink: Add support for devlink-region access")
Signed-off-by: Alex Vesker <valex@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoFix warning in tc-skbprio.8 manpage
Luca Boccassi [Fri, 2 Nov 2018 15:27:31 +0000 (15:27 +0000)]
Fix warning in tc-skbprio.8 manpage

". If" gets interpreted as a macro, so move the period to the previous
line:

  33: warning: macro `If' not defined

Fixes: 141b55f8544e ("Add SKB Priority qdisc support in tc(8)")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: ss.8: break and indent long line
Luca Boccassi [Fri, 2 Nov 2018 13:27:48 +0000 (13:27 +0000)]
man: ss.8: break and indent long line

Fixes groff warning:
  ss.8 92: warning [p 2, 2.8i]: can't break line

And makes the line also more readable.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: fdb: remove redundant dev string in show output
Roopa Prabhu [Wed, 7 Nov 2018 23:14:09 +0000 (15:14 -0800)]
bridge: fdb: remove redundant dev string in show output

After commit 4abb8c723a64 ("bridge: fdb: Fix for missing
keywords in non-JSON output"), I am seeing a double print for dev
in bridge fdb show. eg:
"44:38:39:00:6a:82 dev dev bridge vlan 1 master bridge permanent"

this patch removes the redundant print.

Fixes: 4abb8c723a64 ("bridge: fdb: Fix for missing keywords in non-JSON output")
CC: Phil Sutter <phil@nwl.cc>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: Document IB device renaming option
Leon Romanovsky [Sun, 4 Nov 2018 19:11:22 +0000 (21:11 +0200)]
rdma: Document IB device renaming option

[leonro@server /]$ lspci |grep -i Ether
00:08.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:09.0 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4]
[leonro@server /]$ sudo rdma dev
1: mlx5_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455
sys_image_guid 5254:00c0:fe12:3455
[leonro@server /]$ sudo rdma dev set mlx5_0 name hfi1_0
[leonro@server /]$ sudo rdma dev
1: hfi1_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455
sys_image_guid 5254:00c0:fe12:3455

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoInclude bsd/string.h only in include/utils.h
Luca Boccassi [Thu, 1 Nov 2018 22:25:27 +0000 (22:25 +0000)]
Include bsd/string.h only in include/utils.h

This is simpler and cleaner, and avoids having to include the header
from every file where the functions are used. The prototypes of the
internal implementation are in this header, so utils.h will have to be
included anyway for those.

Fixes: 508f3c231efb ("Use libbsd for strlcpy if available")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update headers to 4.20-rc1
Stephen Hemminger [Mon, 5 Nov 2018 16:37:41 +0000 (08:37 -0800)]
uapi: update headers to 4.20-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: Refresh help section of resource information
Leon Romanovsky [Thu, 1 Nov 2018 08:35:05 +0000 (10:35 +0200)]
rdma: Refresh help section of resource information

After commit 4060e4c0d257 ("rdma: Add PD resource tracking
information"), the resource information shows PDs and MRs,
but help pages didn't fully reflect it.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'rdma-dev-rename' into iproute2-next
David Ahern [Fri, 2 Nov 2018 16:41:12 +0000 (09:41 -0700)]
Merge branch 'rdma-dev-rename' into iproute2-next

Leon Romanovsky  says:

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

An example:

[leonro@server /]$ lspci |grep -i Ether
00:08.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:09.0 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4]
[leonro@server /]$ sudo rdma dev
1: mlx5_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455 sys_image_guid 5254:00c0:fe12:3455
[leonro@server /]$ sudo rdma dev set mlx5_0 name hfi1_0
[leonro@server /]$ sudo rdma dev
1: hfi1_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455 sys_image_guid 5254:00c0:fe12:3455

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

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add an option to rename IB device interface
Leon Romanovsky [Wed, 31 Oct 2018 07:17:57 +0000 (09:17 +0200)]
rdma: Add an option to rename IB device interface

Enrich rdmatool with an option to rename IB devices,
the command interface follows Iproute2 convention:
"rdma dev set [OLD-DEVNAME] name NEW-DEVNAME"

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Introduce command execution helper with required device name
Leon Romanovsky [Wed, 31 Oct 2018 07:17:56 +0000 (09:17 +0200)]
rdma: Introduce command execution helper with required device name

In contradiction to various show commands, the set command explicitly
requires to use device name as an argument. Provide new command
execution helper which enforces it.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Update kernel include file to support IB device renaming
Leon Romanovsky [Wed, 31 Oct 2018 07:17:55 +0000 (09:17 +0200)]
rdma: Update kernel include file to support IB device renaming

Bring kernel header file changes upto commit 05d940d3a3ec
("RDMA/nldev: Allow IB device rename through RDMA netlink")

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip rule: Add ipproto and port range to filter list
David Ahern [Tue, 30 Oct 2018 22:03:30 +0000 (15:03 -0700)]
ip rule: Add ipproto and port range to filter list

Allow ip rule dumps and flushes to filter based on ipproto, sport
and dport. Example:

$ ip ru ls ipproto udp
99: from all to 8.8.8.8 ipproto udp dport 53 lookup 1001
$ ip ru ls dport 53
99: from all to 8.8.8.8 ipproto udp dport 53 lookup 1001

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Fri, 2 Nov 2018 16:34:18 +0000 (09:34 -0700)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip rule: Require at least one argument for add
David Ahern [Tue, 30 Oct 2018 20:59:05 +0000 (13:59 -0700)]
ip rule: Require at least one argument for add

'ip rule add' with no additional arguments just adds another rule
for the main table - which exists by default. Require at least
1 argument similar to delete.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip rule: Honor filter arguments on flush
David Ahern [Tue, 30 Oct 2018 20:58:56 +0000 (13:58 -0700)]
ip rule: Honor filter arguments on flush

'ip ru flush' currently removes all rules with priority > 0 regardless
of any other command line arguments passed in. Update flush_rule to
call filter_nlmsg to determine if the rule should be flushed or not.
This enables rule flushing such as 'ip ru flush table 1001' and
'ip ru flush pref 99'.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUse libbsd for strlcpy if available
Luca Boccassi [Wed, 31 Oct 2018 18:00:11 +0000 (18:00 +0000)]
Use libbsd for strlcpy if available

If libc does not provide strlcpy check for libbsd with pkg-config to
avoid relying on inline version.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobpf: check map symbol type properly with newer llvm compiler
Yonghong Song [Mon, 29 Oct 2018 22:32:03 +0000 (15:32 -0700)]
bpf: check map symbol type properly with newer llvm compiler

With llvm 7.0 or earlier, the map symbol type is STT_NOTYPE.
  -bash-4.4$ cat t.c
  __attribute__((section("maps"))) int g;
  -bash-4.4$ clang -target bpf -O2 -c t.c
  -bash-4.4$ readelf -s t.o

  Symbol table '.symtab' contains 2 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    3 g

The following llvm commit enables BPF target to generate
proper symbol type and size.
  commit bf6ec206615b9718869d48b4e5400d0c6e3638dd
  Author: Yonghong Song <yhs@fb.com>
  Date:   Wed Sep 19 16:04:13 2018 +0000

      [bpf] Symbol sizes and types in object file

      Clang-compiled object files currently don't include the symbol sizes and
      types.  Some tools however need that information.  For example, ctfconvert
      uses that information to generate FreeBSD's CTF representation from ELF
      files.
      With this patch, symbol sizes and types are included in object files.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Reported-by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
Hence, for llvm 8.0.0 (currently trunk), symbol type will be not NOTYPE, but OBJECT.
  -bash-4.4$ clang -target bpf -O2 -c t.c
  -bash-4.4$ readelf -s t.o

  Symbol table '.symtab' contains 3 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS t.c
       2: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    3 g

This patch makes sure bpf library accepts both NOTYPE and OBJECT types
of global map symbols.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: Actually print left delimiter for columns
Stefano Brivio [Mon, 29 Oct 2018 22:04:25 +0000 (23:04 +0100)]
ss: Actually print left delimiter for columns

While rendering columns, we use a local variable to keep track of the
field currently being printed, without touching current_field, which is
used for buffering.

Use the right pointer to access the left delimiter for the current column,
instead of always printing the left delimiter for the last buffered field,
which is usually an empty string.

This fixes an issue especially visible on narrow terminals, where some
columns might be displayed without separation.

Reported-by: YoyPa <yoann.p.public@gmail.com>
Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Tested-by: YoyPa <yoann.p.public@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: fix vlan show stats formatting
Tobias Jungel [Fri, 26 Oct 2018 21:51:03 +0000 (23:51 +0200)]
bridge: fix vlan show stats formatting

The output of -statistics vlan show was broken previous change for json
output. This aligns the format to vlan show.

v2: fixed too greedy deletion that caused a -Wmaybe-uninitialized

Signed-off-by: Tobias Jungel <tobias.jungel@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoutils.h: provide fallback CLOCK_TAI definition
Peter Korsgaard [Sat, 27 Oct 2018 15:31:02 +0000 (17:31 +0200)]
utils.h: provide fallback CLOCK_TAI definition

q_{etf,taprio}.c uses CLOCK_TAI, which isn't exposed by glibc < 2.21 or
uClibc, breaking the build. Provide a fallback definition like it is done
for IPPROTO_MPLS and others.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Tue, 23 Oct 2018 17:55:09 +0000 (10:55 -0700)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip/geneve: fix ttl inherit behavior
Hangbin Liu [Mon, 22 Oct 2018 07:46:18 +0000 (15:46 +0800)]
ip/geneve: fix ttl inherit behavior

Currently when we add geneve with "ttl inherit", we only set ttl to 0, which
is actually use whatever default value instead of inherit the inner protocol's
ttl value.

To make a difference with ttl inherit and ttl == 0, we add an attribute
IFLA_GENEVE_TTL_INHERIT in kernel commit 52d0d404d39dd ("geneve: add ttl
inherit support"). Now let's use "ttl inherit" to inherit the inner
protocol's ttl, and use "ttl auto" to means "use whatever default value",
the same behavior with ttl == 0.

v2:
1) remove IFLA_GENEVE_TTL_INHERIT defination in if_link.h as it's already
   updated.
2) Still use addattr8() so we can enable/disable ttl inherit, as Michal
   suggested.

v3: Update man page

Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>