]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
6 years agordma: Print supplied device name in case of wrong name
Leon Romanovsky [Wed, 27 Dec 2017 07:57:55 +0000 (09:57 +0200)]
rdma: Print supplied device name in case of wrong name

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agordma: Check that port index exists before operate on link layer
Leon Romanovsky [Wed, 27 Dec 2017 07:57:54 +0000 (09:57 +0200)]
rdma: Check that port index exists before operate on link layer

Link layer operates on port layer, hence it should check
it existence before execution commands.

Fixes: da990ab40a92 ("rdma: Add link object")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agordma: Fix misspelled SYS_IMAGE_GUID
Leon Romanovsky [Wed, 27 Dec 2017 07:57:53 +0000 (09:57 +0200)]
rdma: Fix misspelled SYS_IMAGE_GUID

SYS_IMAGE_GUIG is actually SYS_IMAGE_GUID.

Fixes: da990ab40a92 ("rdma: Add link object")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agordma: Move per-device handler function to generic code
Leon Romanovsky [Wed, 27 Dec 2017 07:57:52 +0000 (09:57 +0200)]
rdma: Move per-device handler function to generic code

Most of the proposed objects are working in the scope "dev"
and will implement the same logic. Move the code to utils.c,
so other objects will be able to reuse the code.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agordma: Protect dev_map_lookup from wrong input
Leon Romanovsky [Wed, 27 Dec 2017 07:57:51 +0000 (09:57 +0200)]
rdma: Protect dev_map_lookup from wrong input

Despite the fact that all callers to dev_map_lookup are ensuring that
there is always device name prior to call to that function, it is better
and safer to check that in the dev_map_lookup itself.

Fixes: 40df8263a0f0 ("rdma: Add dev object")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agordma: Reduce scope of _dev_map_lookup call
Leon Romanovsky [Wed, 27 Dec 2017 07:57:50 +0000 (09:57 +0200)]
rdma: Reduce scope of _dev_map_lookup call

There is no external users of _dev_map_lookup function,
so let's limit its scope to be local.

Fixes: 40df8263a0f0 ("rdma: Add dev object")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agoerspan: add erspan usage description
William Tu [Tue, 26 Dec 2017 18:31:16 +0000 (10:31 -0800)]
erspan: add erspan usage description

The patch adds erspan usage description, so 'ip link help erspan'
and 'ip link help ip6erspan' shows the options.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agoerspan: add erspan version II support
William Tu [Wed, 20 Dec 2017 02:01:06 +0000 (18:01 -0800)]
erspan: add erspan version II support

The patch adds support for configuring the erspan v2, for both
ipv4 and ipv6 erspan implementation.  Three additional fields
are added: 'erspan_ver' for distinguishing v1 or v2, 'erspan_dir'
for specifying direction of the mirrored traffic, and 'erspan_hwid'
for users to set ERSPAN engine ID within a system.

As for manpage, the ERSPAN descriptions used to be under GRE, IPIP,
SIT Type paragraph.  Since IP6GRE/IP6GRETAP also supports ERSPAN,
the patch removes the old one, creates a separate ERSPAN paragrah,
and adds an example.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agoUpdate headers from 4.15-rc3
David Ahern [Tue, 19 Dec 2017 20:58:58 +0000 (12:58 -0800)]
Update headers from 4.15-rc3

Update kernel headers to commit f39a5c01c3d2 ("Merge branch
'nfp-flower-add-Geneve-tunnel-support'")

Signed-off-by: David Ahern <dsahern@gmail.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 15 Dec 2017 05:19:54 +0000 (21:19 -0800)]
Merge branch 'master' into net-next

6 years agogre6: add collect metadata support
William Tu [Wed, 13 Dec 2017 02:22:52 +0000 (18:22 -0800)]
gre6: add collect metadata support

The patch adds 'external' option to support collect metadata
gre6 tunnel.  The 'external' keyword is already used to set the
device into collect metadata mode such as vxlan, geneve, ipip,
etc.  This patch extends support for ipv6 gre and gretap.
Example of L3 and L2 gre device:
bash:~# ip link add dev ip6gre123 type ip6gre external
bash:~# ip link add dev ip6gretap123 type ip6gretap external

Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
6 years agotc: fix command "tc actions del" hang issue
Chris Mi [Thu, 14 Dec 2017 09:09:00 +0000 (18:09 +0900)]
tc: fix command "tc actions del" hang issue

If command is RTM_DELACTION, a non-NULL pointer is passed to rtnl_talk().
Then flag NLM_F_ACK is not set on n->nlmsg_flags and netlink_ack() will
not be called. Command tc will wait for the reply for ever.

Fixes: 86bf43c7c2fd ("lib/libnetlink: update rtnl_talk to support malloc buff at run time")
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoiplink: add definitions for GSO_MAX
Stephen Hemminger [Fri, 15 Dec 2017 02:22:56 +0000 (18:22 -0800)]
iplink: add definitions for GSO_MAX

Until kernel exports these, add GSO_MAX values into iplink
rather than assuming they are UINT_MAX + 1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoiplink: validate maximum gso_max_size
Solio Sarabia [Tue, 12 Dec 2017 22:25:22 +0000 (14:25 -0800)]
iplink: validate maximum gso_max_size

Validate the upper limit for gso_max_size, valid range is [0-65,536]
inclusive. Fix minor whitespace in iplink man page.

Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>
6 years agotc: fix json array closing
Jiri Pirko [Wed, 13 Dec 2017 19:56:16 +0000 (20:56 +0100)]
tc: fix json array closing

Fixes: 2704bd625583 ("tc: jsonify actions core")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agoip: add vxcan to help text
Oliver Hartkopp [Wed, 13 Dec 2017 20:21:28 +0000 (21:21 +0100)]
ip: add vxcan to help text

Add missing tag 'vxcan' inside the help text which was missing in commit
efe459c76d35f ('ip: link add vxcan support').

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
6 years agoShow 'external' link mode in output
Phil Dibowitz [Tue, 12 Dec 2017 21:54:06 +0000 (13:54 -0800)]
Show 'external' link mode in output

Recently `external` support was added to the tunnel drivers, but there is no way
to introspect this from userspace. This adds support for that.

Now `ip -details link` shows it:

```
7: tunl60@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group
default qlen 1
    link/tunnel6 :: brd :: promiscuity 0
    ip6tnl external any remote :: local :: encaplimit 0 hoplimit 0 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000) addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
```

Signed-off-by: Phil Dibowitz <phil@ipom.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 12 Dec 2017 20:12:20 +0000 (12:12 -0800)]
Merge branch 'master' into net-next

6 years agotc: bash-completion: add missing 'classid' keyword
Davide Caratti [Tue, 12 Dec 2017 15:45:15 +0000 (16:45 +0100)]
tc: bash-completion: add missing 'classid' keyword

users of 'matchall' filter can specify a value for the class id: update
bash-completion accordingly.

Fixes: b32c0b64fa2b ("tc: bash-completion: Add support for matchall")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
6 years agoss: Implement automatic column width calculation
Stefano Brivio [Tue, 12 Dec 2017 00:46:33 +0000 (01:46 +0100)]
ss: Implement automatic column width calculation

Group fitting fields into lines and space them equally using the
remaining screen width for each line. If columns don't fit on
one line, break them into the least possible amount of lines and
keep them aligned across lines.

This is done by:
 - recording the length of the longest item in each column during
   formatting and buffering (which was added in the previous patch)
 - fitting as many fields as possible on each line of output
 - distributing the remaining padding space equally between the
   columns

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
6 years agoss: Buffer raw fields first, then render them as a table
Stefano Brivio [Tue, 12 Dec 2017 00:46:32 +0000 (01:46 +0100)]
ss: Buffer raw fields first, then render them as a table

This allows us to measure the maximum field length for each
column before printing fields and will permit us to apply
optimal field spacing and distribution. Structure of the output
buffer with chunked allocation is described in comments.

Output is still unchanged, original spacing is used.

Running over one million sockets with -tul options by simply
modifying main() to loop 50,000 times over the *_show()
functions, buffering the whole output and rendering it at the
end, with 10 UDP sockets, 10 TCP sockets, while throwing
output away, doesn't show significant changes in execution time
on my laptop with an Intel i7-6600U CPU:

- before this patch:
$ time ./ss -tul > /dev/null
real 0m29.899s
user 0m2.017s
sys 0m27.801s

- after this patch:
$ time ./ss -tul > /dev/null
real 0m29.827s
user 0m1.942s
sys 0m27.812s

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
6 years agoss: Introduce columns lightweight abstraction
Stefano Brivio [Tue, 12 Dec 2017 00:46:31 +0000 (01:46 +0100)]
ss: Introduce columns lightweight abstraction

Instead of embedding spacing directly while printing contents,
logically declare columns and functions to buffer their content,
to print left and right spacing around fields, to flush them to
screen, and to print headers.

This makes it a bit easier to handle layout changes and prepares
for full output buffering, needed for optimal spacing in field
output layout.

Columns are currently set up to retain exactly the same output
as before. This needs some slight adjustments of the values
previously calculated in main(), as the width value introduced
here already includes the width of left delimiters and spacing
is not explicitly printed anymore whenever a field is printed.
These calculations will go away altogether once automatic width
calculation is implemented.

We can also remove explicit printing of newlines after the final
content for a given line is printed, flushing the last field on
a line will cause field_flush() to print newlines where
appropriate.

No changes in output expected here.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
6 years agoss: Replace printf() calls for "main" output by calls to helper
Stefano Brivio [Tue, 12 Dec 2017 00:46:30 +0000 (01:46 +0100)]
ss: Replace printf() calls for "main" output by calls to helper

This is preparation work for output buffering, which will allow
us to use optimal spacing and alignment of logical "columns".

The new out() function is just a re-implementation of a typical
libc's printf(), except that the return value of vfprintf() is
ignored as no callers use it. This implementation will be
replaced in the next patches to provide column width adjustment
and adequate spacing.

All printf() calls that output parts of the socket list are now
replaced by calls to out(). Output of summary and version is
excluded from this.

No functional differences here, output not affected.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 12 Dec 2017 00:06:11 +0000 (16:06 -0800)]
Merge branch 'master' into net-next

6 years agouapi: tun add eBPF based queue selection method
Stephen Hemminger [Tue, 12 Dec 2017 00:03:27 +0000 (16:03 -0800)]
uapi: tun add eBPF based queue selection method

Upstream commit 96f84061620c6325a2ca9a9a05b410e6461d03c3
    tun: add eBPF based queue selection method

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agouapi: add access to snd_cwnd and other sock_ops
Stephen Hemminger [Tue, 12 Dec 2017 00:01:17 +0000 (16:01 -0800)]
uapi: add access to snd_cwnd and other sock_ops

From upstream kernel commit f19397a5c65665d66e3866b42056f1f58b7a366b
    bpf: Add access to snd_cwnd and others in sock_ops

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoss: remove duplicate assignment
Roman Mashak [Mon, 11 Dec 2017 21:24:31 +0000 (16:24 -0500)]
ss: remove duplicate assignment

Fixes: 8250bc9ff4e5 ("ss: Unify inet sockets output")
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoiplink: allow configuring GSO max values
Stephen Hemminger [Fri, 1 Dec 2017 19:52:34 +0000 (11:52 -0800)]
iplink: allow configuring GSO max values

This allows sending GSO maximum values when configuring a device.
The values are advisory. Most devices will ignore them but for some
pseudo devices such as veth pairs they can be set.

Example:
# ip link add dev vm1 type veth peer name vm2 gso_max_size 32768

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sat, 9 Dec 2017 05:32:33 +0000 (21:32 -0800)]
Merge branch 'master' into net-next

6 years agotc: util: Don't call NEXT_ARG_FWD() in __parse_action_control()
Michal Privoznik [Fri, 8 Dec 2017 10:18:07 +0000 (11:18 +0100)]
tc: util: Don't call NEXT_ARG_FWD() in __parse_action_control()

Not all callers want parse_action_control*() to advance the
arguments. For instance act_parse_police() does the argument
advancing itself.

Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoss: print tcpi_rcv_ssthresh
Wei Wang [Fri, 8 Dec 2017 00:12:00 +0000 (16:12 -0800)]
ss: print tcpi_rcv_ssthresh

tcpi_rcv_ssthresh is an important stats when debugging receive side
behavior.
Add it to the ss output.

Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
6 years agoupdate headers from 4.15-rc2
Stephen Hemminger [Wed, 6 Dec 2017 01:30:22 +0000 (17:30 -0800)]
update headers from 4.15-rc2

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoman: tc-csum.8: Fix inconsistency in example description
Phil Sutter [Wed, 29 Nov 2017 17:34:09 +0000 (18:34 +0100)]
man: tc-csum.8: Fix inconsistency in example description

Commit 6bbe5e6290db5 ("man: tc-csum.8: Fix example") changed both source
and destination IP addresses in example code but missed to update the
example's description accordingly.

Fixes: 6bbe5e6290db5 ("man: tc-csum.8: Fix example")
Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agoupdate bpf header from net-next
Stephen Hemminger [Wed, 29 Nov 2017 02:16:51 +0000 (18:16 -0800)]
update bpf header from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 28 Nov 2017 17:53:28 +0000 (09:53 -0800)]
Merge branch 'master' into net-next

6 years agoman: add -json option to tc manpage
Jiri Pirko [Mon, 27 Nov 2017 08:09:04 +0000 (09:09 +0100)]
man: add -json option to tc manpage

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agovxlan: Make id optional when modifying a link
Robert Shearman [Tue, 28 Nov 2017 11:16:50 +0000 (11:16 +0000)]
vxlan: Make id optional when modifying a link

Specifying the IFLA_VXLAN_LINK attribute on a vxlan link modify is
optional in the kernel, so make the id argument optional for "ip link
set ..." to avoid a user needing to specify it when changing another
attribute.

Signed-off-by: Robert Shearman <rs823p@att.com>
6 years agogre: Fix ttl inherit option
Robert Shearman [Tue, 28 Nov 2017 11:16:21 +0000 (11:16 +0000)]
gre: Fix ttl inherit option

Specifying "... ttl inherit" currently does nothing on a GRE link
modify since the previous ttl value is retrieved up front. Fix this by
explicitly setting ttl to 0 when "inherit" is specified for the
option, since 0 represents the semantics of inherit.

Signed-off-by: Robert Shearman <rs823p@att.com>
6 years agolink_gre6: Detect invalid encaplimit values
Phil Sutter [Tue, 28 Nov 2017 15:49:58 +0000 (16:49 +0100)]
link_gre6: Detect invalid encaplimit values

Looks like a typo: get_u8() returns 0 on success and -1 on error, so the
error checking here was ineffective.

Fixes: a11b7b71a6eba ("link_gre6: really support encaplimit option")
Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agom_mirred: style cleanups
Stephen Hemminger [Sun, 26 Nov 2017 20:42:17 +0000 (12:42 -0800)]
m_mirred: style cleanups

Fix whitespace and long lines.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agom_gact: whitespace cleanup
Stephen Hemminger [Sun, 26 Nov 2017 20:38:21 +0000 (12:38 -0800)]
m_gact: whitespace cleanup

Fix whitespace errors reported by checkpatch

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agom_action: style cleanup
Stephen Hemminger [Sun, 26 Nov 2017 20:36:15 +0000 (12:36 -0800)]
m_action: style cleanup

Break long lines, and use bool where possible.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agom_vlan: style cleanups
Stephen Hemminger [Sun, 26 Nov 2017 20:28:55 +0000 (12:28 -0800)]
m_vlan: style cleanups

Break long lines and make duplicated code into function.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agotc: jsonify vlan action
Jiri Pirko [Sat, 25 Nov 2017 14:48:35 +0000 (15:48 +0100)]
tc: jsonify vlan action

Add json output to vlan action.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify mirred action
Jiri Pirko [Sat, 25 Nov 2017 14:48:34 +0000 (15:48 +0100)]
tc: jsonify mirred action

Add json output to mirred action.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify gact action
Jiri Pirko [Sat, 25 Nov 2017 14:48:33 +0000 (15:48 +0100)]
tc: jsonify gact action

Add json output to gact action.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify actions core
Jiri Pirko [Sat, 25 Nov 2017 14:48:32 +0000 (15:48 +0100)]
tc: jsonify actions core

Add json output to actions core.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify matchall filter
Jiri Pirko [Sat, 25 Nov 2017 14:48:31 +0000 (15:48 +0100)]
tc: jsonify matchall filter

Add json output to matchall filter.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify flower filter
Jiri Pirko [Sat, 25 Nov 2017 14:48:30 +0000 (15:48 +0100)]
tc: jsonify flower filter

Add json output to flower filter.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify filter core
Jiri Pirko [Sat, 25 Nov 2017 14:48:29 +0000 (15:48 +0100)]
tc: jsonify filter core

Add json output to filter core.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify htb qdisc
Jiri Pirko [Sat, 25 Nov 2017 14:48:28 +0000 (15:48 +0100)]
tc: jsonify htb qdisc

Add json output to htb qdisc.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify fq_codel qdisc
Jiri Pirko [Sat, 25 Nov 2017 14:48:27 +0000 (15:48 +0100)]
tc: jsonify fq_codel qdisc

Add json output to fq_codel qdisc.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify stats2
Jiri Pirko [Sat, 25 Nov 2017 14:48:26 +0000 (15:48 +0100)]
tc: jsonify stats2

Add json output to stats2.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: jsonify qdisc core
Jiri Pirko [Sat, 25 Nov 2017 14:48:25 +0000 (15:48 +0100)]
tc: jsonify qdisc core

Add json output to qdisc core.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: remove action cookie len from printout
Jiri Pirko [Sat, 25 Nov 2017 10:07:57 +0000 (11:07 +0100)]
tc: remove action cookie len from printout

Make the output same as input and avoid printout of unnecessary len.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agotc: move action cookie print out of the stats if
Jiri Pirko [Sat, 25 Nov 2017 10:07:56 +0000 (11:07 +0100)]
tc: move action cookie print out of the stats if

Cookie print was made dependent on show_stats for no good reason. Fix
this bu pushing cookie print ot of the stats if.

Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
6 years agoiplink: communicate ifindex for xdp offload
Jakub Kicinski [Fri, 24 Nov 2017 02:12:08 +0000 (18:12 -0800)]
iplink: communicate ifindex for xdp offload

When xdpoffload option is used, communicate the ifindex down
to the kernel to trigger device-specific load.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agof_bpf: communicate ifindex for eBPF offload
Jakub Kicinski [Fri, 24 Nov 2017 02:12:07 +0000 (18:12 -0800)]
f_bpf: communicate ifindex for eBPF offload

Split parsing and loading of the eBPF program and if skip_sw is set
load the program for ifindex, to which the qdisc is attached.

Note that the ifindex will be ignored for programs which are already
loaded (e.g. when using pinned programs), but in that case we just
trust the user knows what he's doing.  Hopefully we will get extack
soon in the driver to help debugging this case.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agotc_filter: resolve device name before parsing filter
Jakub Kicinski [Fri, 24 Nov 2017 02:12:06 +0000 (18:12 -0800)]
tc_filter: resolve device name before parsing filter

Move resolving device name into an ifindex before calling filter
specific callbacks.  This way if filters need the ifindex, they
can read it from the request.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years ago{f, m}_bpf: don't allow specifying multiple bpf programs
Jakub Kicinski [Fri, 24 Nov 2017 02:12:05 +0000 (18:12 -0800)]
{f, m}_bpf: don't allow specifying multiple bpf programs

Both BPF filter and action will allow users to specify run
multiple times, and only the last one will be considered by
the kernel.  Explicitly refuse such command lines.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: allow loading programs for a specific ifindex
Jakub Kicinski [Fri, 24 Nov 2017 02:12:04 +0000 (18:12 -0800)]
bpf: allow loading programs for a specific ifindex

For BPF offload we need to specify the ifindex when program is
loaded now.  Extend the bpf common code to accommodate that.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: expose bpf_parse_common() and bpf_load_common()
Jakub Kicinski [Fri, 24 Nov 2017 02:12:03 +0000 (18:12 -0800)]
bpf: expose bpf_parse_common() and bpf_load_common()

Expose bpf_parse_common() and bpf_load_common() functions
for those users who may want to modify the parameters to
load after parsing is done.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: rename bpf_parse_common() to bpf_parse_and_load_common()
Jakub Kicinski [Fri, 24 Nov 2017 02:12:02 +0000 (18:12 -0800)]
bpf: rename bpf_parse_common() to bpf_parse_and_load_common()

bpf_parse_common() parses and loads the program.  Rename it
accordingly.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: split parse from program loading
Jakub Kicinski [Fri, 24 Nov 2017 02:12:01 +0000 (18:12 -0800)]
bpf: split parse from program loading

Parsing command line is currently done together with potentially
loading a new eBPF program.  This makes it more difficult to
provide additional parameters for loading (which may come after
the eBPF program info on the command line).

Split the two (only internally for now).  Verbose parameter
has to be saved in struct bpf_cfg_in to be carried between
the stages.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: allocate opcode table in struct bpf_cfg_in
Jakub Kicinski [Fri, 24 Nov 2017 02:12:00 +0000 (18:12 -0800)]
bpf: allocate opcode table in struct bpf_cfg_in

struct bpf_cfg_in already carries a pointer to sock_filter ops.
It's currently set to a local variable in bpf_parse_opt_tbl(),
shared between parsing and loading stages.  Move the array
entirely to struct bpf_cfg_in, this will allow us to split
parsing and loading.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: keep parsed program mode in struct bpf_cfg_in
Jakub Kicinski [Fri, 24 Nov 2017 02:11:59 +0000 (18:11 -0800)]
bpf: keep parsed program mode in struct bpf_cfg_in

bpf_parse() will parse command line arguments to find out the
program mode.  This mode will later be needed at loading time.
Instead of keeping it locally add it to struct bpf_cfg_in,
this will allow splitting parsing and loading stages.

enum bpf_mode has to be moved to the header file, because C
doesn't allow forward declaration of enums.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: pass program type in struct bpf_cfg_in
Jakub Kicinski [Fri, 24 Nov 2017 02:11:58 +0000 (18:11 -0800)]
bpf: pass program type in struct bpf_cfg_in

Program type is needed both for parsing and loading of
the program.  Parsing may also induce the type based on
signatures from __bpf_prog_meta.  Instead of passing
the type around keep it in struct bpf_cfg_in.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoSPDX license identifiers
Stephen Hemminger [Fri, 24 Nov 2017 20:21:35 +0000 (12:21 -0800)]
SPDX license identifiers

For all files in iproute2 which do not have an obvious license
identification, mark them with SPDK GPL-2

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agotc: break long lines
Stephen Hemminger [Fri, 24 Nov 2017 19:31:36 +0000 (11:31 -0800)]
tc: break long lines

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agotc: B.W limits can now be specified in %.
Nishanth Devarajan [Tue, 21 Nov 2017 02:20:47 +0000 (07:50 +0530)]
tc: B.W limits can now be specified in %.

This patch adapts the tc command line interface to allow bandwidth limits
to be specified as a percentage of the interface's capacity.

Adding this functionality requires passing the specified device string to
each class/qdisc which changes the prototype for a couple of functions: the
.parse_qopt and .parse_copt interfaces. The device string is a required
parameter for tc-qdisc and tc-class, and when not specified, the kernel
returns ENODEV. In this patch, if the user tries to specify a bandwidth
percentage without naming the device, we return an error from userspace.

Signed-off-by: Nishanth Devarajan<ndev2021@gmail.com>
6 years agotc: replace magic constant 16 with #define
Stephen Hemminger [Fri, 24 Nov 2017 19:18:31 +0000 (11:18 -0800)]
tc: replace magic constant 16 with #define

For places where tc is expecting device name use IFNAMSIZ.
For others where it is a filter name, introduce a new constant.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoupdate bpf header from net-next
Stephen Hemminger [Fri, 24 Nov 2017 17:23:13 +0000 (09:23 -0800)]
update bpf header from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoila: fix formatting of help message
Stephen Hemminger [Fri, 24 Nov 2017 17:21:43 +0000 (09:21 -0800)]
ila: fix formatting of help message

Make ip ila help look like ip route help

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoila: create ila_common.h
Tom Herbert [Wed, 22 Nov 2017 20:05:37 +0000 (12:05 -0800)]
ila: create ila_common.h

Move common functions related to checksum, identifier and hook-type
parsing to a common include file.

Signed-off-by: Tom Herbert <tom@quantonium.net>
6 years agoila: support for configuring identifier and hook types
Tom Herbert [Wed, 22 Nov 2017 20:05:36 +0000 (12:05 -0800)]
ila: support for configuring identifier and hook types

Expose identifier type and hook types in ILA configuraiton
and reporting. This adds support in both ip ila ILA LWT.

Signed-off-by: Tom Herbert <tom@quantonium.net>
6 years agoila: support to configure checksum neutral-map-auto
Tom Herbert [Wed, 22 Nov 2017 20:05:35 +0000 (12:05 -0800)]
ila: support to configure checksum neutral-map-auto

Configuration support in both ip ila and ip LWT for checksum
neutral-map-auto. This is a mode of ILA where checksum
neutral mapping is assumed for packets (there is no C-bit
in the identifier to indicate checksum neutral).

Signed-off-by: Tom Herbert <tom@quantonium.net>
6 years agoila: added csum neutral support to ipila
Tom Herbert [Wed, 22 Nov 2017 20:05:34 +0000 (12:05 -0800)]
ila: added csum neutral support to ipila

Add checksum neutral to ip ila configuration. This control whether
the C-bit is interpreted as checksum neutral bit.

Signed-off-by: Tom Herbert <tom@quantonium.net>
6 years agoila: Fix reporting of ILA locators and locator match
Tom Herbert [Wed, 22 Nov 2017 20:05:33 +0000 (12:05 -0800)]
ila: Fix reporting of ILA locators and locator match

Fix retrieval of locator value for RTA to get 64 bits instead of 32.

Signed-off-by: Tom Herbert <tom@quantonium.net>
6 years agoupdate headers from 4.15-rc1
Stephen Hemminger [Fri, 24 Nov 2017 17:07:19 +0000 (09:07 -0800)]
update headers from 4.15-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agobpf: initialize the verifier log
Jakub Kicinski [Thu, 23 Nov 2017 01:00:53 +0000 (17:00 -0800)]
bpf: initialize the verifier log

If program loading fails before verifier prints its first
message, the verifier log will not be initialized.  Always
set the first character of the log buffer to zero to make
sure we don't dump non-printable characters to the terminal.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoman: document ip xfrm policy nosock
Simon Ruderich [Sat, 18 Nov 2017 22:55:12 +0000 (23:55 +0100)]
man: document ip xfrm policy nosock

Signed-off-by: Simon Ruderich <simon@ruderich.org>
6 years agoman: document ip fou show
Simon Ruderich [Sat, 18 Nov 2017 22:54:50 +0000 (23:54 +0100)]
man: document ip fou show

This was forgotten in cf4caf336a (2017-11-16, Add "show" subcommand to
"ip fou").

Signed-off-by: Simon Ruderich <simon@ruderich.org>
6 years agoman: document ip route get mark
Simon Ruderich [Sat, 18 Nov 2017 21:56:49 +0000 (22:56 +0100)]
man: document ip route get mark

Signed-off-by: Simon Ruderich <simon@ruderich.org>
6 years agoiproute2: fixes to compile on some systems.
Lorenzo Colitti [Mon, 20 Nov 2017 03:57:07 +0000 (12:57 +0900)]
iproute2: fixes to compile on some systems.

1. Put the declarations of strlcpy and strlcat inside
   an #ifdef NEED_STRLCPY. Their declarations were already in a
   similar #ifdef.
2. In bpf_scm.h, include sys/un.h for struct sockaddr_un.
3. In utils.h, include time.h for struct timeval.

Tested: builds on ubuntu 14.04 with "make clean distclean; ./configure && make -j64"
Tested: 4.14.1 builds on Android with Android-specific #ifndefs for missing library code
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
6 years agoman: tc-flower: add explanation for hw_tc option
Amritha Nambiar [Fri, 17 Nov 2017 23:00:55 +0000 (15:00 -0800)]
man: tc-flower: add explanation for hw_tc option

Add details explaining the hw_tc option.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
6 years agoman: tc-mqprio: add documentation for new offload options
Amritha Nambiar [Fri, 17 Nov 2017 22:59:15 +0000 (14:59 -0800)]
man: tc-mqprio: add documentation for new offload options

This patch adds documentation for additional offload modes and
associated parameters in tc-mqprio.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
6 years agoAdd "show" subcommand to "ip fou"
Greg Greenway [Fri, 17 Nov 2017 00:53:22 +0000 (16:53 -0800)]
Add "show" subcommand to "ip fou"

Sample output:

$ sudo ./ip/ip fou add port 111 ipproto 11
$ sudo ./ip/ip fou add port 222 ipproto 22 -6
$ ./ip/ip fou show
port 222 ipproto 22 -6
port 111 ipproto 11

Signed-off-by: Greg Greenway <ggreenway@apple.com>
6 years agotc_util: Silence spurious compiler warning
Phil Sutter [Wed, 15 Nov 2017 14:01:31 +0000 (15:01 +0100)]
tc_util: Silence spurious compiler warning

GCC version 7.2.1 complains that 'result1' may be used uninitialized in
parse_action_control_slash_spaces(). This should not be possible in
practice, so the actual value 'result1' is initialized with does not
matter.

Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agotc_util: Drop needless pointer check
Phil Sutter [Wed, 15 Nov 2017 14:01:30 +0000 (15:01 +0100)]
tc_util: Drop needless pointer check

The function parse_action_control_slash() returns early if 'p' is NULL,
so after the first call to action_a2n(), 'p' is guaranteed not to be
NULL. Otherwise, the assignment '*p = 0' above would dereference the
NULL pointer already anyway, so just drop this check here.

Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agotipc: change family attribute from u32 to u16
Jon Maloy [Wed, 15 Nov 2017 16:25:44 +0000 (17:25 +0100)]
tipc: change family attribute from u32 to u16

commit 28033ae4e0f ("net: netlink: Update attr validation to require
exact length for some types") introduces a stricter control on attributes
of type NLA_U* and NLA_S*.

Since the tipc tool is sending a family attribute of u32 instead of as
expected u16 the tool is now effectively broken.

We fix this by changing the type of the said attribute.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 13 Nov 2017 18:35:17 +0000 (10:35 -0800)]
Merge branch 'master' into net-next

6 years agov4.14.1
Stephen Hemminger [Mon, 13 Nov 2017 18:09:57 +0000 (10:09 -0800)]
v4.14.1

6 years agoutils: remove duplicate include of ctype.h
Stephen Hemminger [Mon, 13 Nov 2017 18:08:39 +0000 (10:08 -0800)]
utils: remove duplicate include of ctype.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoip: Fix compilation break on old systems
Leon Romanovsky [Mon, 13 Nov 2017 10:21:19 +0000 (12:21 +0200)]
ip: Fix compilation break on old systems

As was reported [1], the iproute2 fails to compile on old systems,
in Cong's case, it was Fedora 19, in our case it was RedHat 7.2, which
failed with the following errors during compilation:

ipxfrm.c: In function ‘xfrm_selector_print’:
ipxfrm.c:479:7: error: ‘IPPROTO_MH’ undeclared (first use in this
function)
  case IPPROTO_MH:
       ^
ipxfrm.c:479:7: note: each undeclared identifier is reported only once
for each function it appears in
ipxfrm.c: In function ‘xfrm_selector_upspec_parse’:
ipxfrm.c:1345:8: error: ‘IPPROTO_MH’ undeclared (first use in this
function)
   case IPPROTO_MH:
        ^                                                                                                                                                            make[1]: *** [ipxfrm.o] Error 1

The reason to it is the order of headers files. The IPPROTO_MH field is
set in kernel's UAPI header file (in6.h), but only in case
__UAPI_DEF_IPPROTO_V6 is set before. That define comes from other kernel's
header file (libc-compat.h) and is set in case there are no previous
libc relevant declarations.

In ip code, the include of <netdb.h> causes to indirect inclusion of
<netinet/in.h> and it sets __UAPI_DEF_IPPROTO_V6 to be zero and prevents from
IPPROTO_MH declaration.

This patch takes the simplest possible approach to fix the compilation
error by checking if IPPROTO_MH was defined before and in case it
wasn't, it defines it to be the same as in the kernel.

[1] https://www.spinics.net/lists/netdev/msg463980.html

Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Riad Abo Raed <riada@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 13 Nov 2017 00:30:14 +0000 (16:30 -0800)]
Merge branch 'master' into net-next

6 years agov4.14.0
Stephen Hemminger [Mon, 13 Nov 2017 00:29:43 +0000 (16:29 -0800)]
v4.14.0

6 years agodrop unneeded include of syslog.h
Stephen Hemminger [Mon, 13 Nov 2017 00:22:12 +0000 (16:22 -0800)]
drop unneeded include of syslog.h

Only arpd uses syslog

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 13 Nov 2017 00:17:37 +0000 (16:17 -0800)]
Merge branch 'master' into net-next

6 years agodevlink: add batch command support
Ivan Vecera [Fri, 10 Nov 2017 06:20:14 +0000 (07:20 +0100)]
devlink: add batch command support

The patch adds support to batch devlink commands.

Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
6 years agolib: make resolve_hosts variable common
Ivan Vecera [Fri, 10 Nov 2017 06:20:13 +0000 (07:20 +0100)]
lib: make resolve_hosts variable common

Any iproute utility that uses any function from lib/utils.c needs
to declare its own resolve_hosts variable instance although it does
not need/use hostname resolving functionality (currently only 'ip'
and 'ss' commands uses this).
The patch declares single common instance of resolve_hosts directly
in utils.c so the existing ones can be removed (the same approach
that is used for timestamp_short).

Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>