]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
7 years agolwt: BPF support for LWT
Thomas Graf [Mon, 12 Dec 2016 00:14:35 +0000 (01:14 +0100)]
lwt: BPF support for LWT

Adds support to configure BPF programs as nexthop actions via the LWT
framework.

Example:
   ip route add 192.168.253.2/32 \
     encap bpf out obj lwt_len_hist_kern.o section len_hist \
     dev veth0

Signed-off-by: Thomas Graf <tgraf@suug.ch>
7 years agoupdate to net-next headers (pre 4.10 rc)
Stephen Hemminger [Mon, 12 Dec 2016 23:26:34 +0000 (15:26 -0800)]
update to net-next headers (pre 4.10 rc)

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 12 Dec 2016 23:24:40 +0000 (15:24 -0800)]
Merge branch 'master' into net-next

7 years agov4.9.0
Stephen Hemminger [Mon, 12 Dec 2016 23:07:42 +0000 (15:07 -0800)]
v4.9.0

7 years agoupdate to 4.9 release headers
Stephen Hemminger [Mon, 12 Dec 2016 23:05:59 +0000 (15:05 -0800)]
update to 4.9 release headers

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMakefile: really suppress printing of directories
David Ahern [Wed, 7 Dec 2016 20:55:09 +0000 (12:55 -0800)]
Makefile: really suppress printing of directories

Makefile adds --no-print-directory to MAKEFLAGS if VERBOSE is not
defined however Config always defines VERBOSE. Update the check to
whether VERBOSE is 0.

Fixes: 57bdf8b76451 ("Make builds default to quiet mode")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agotc: flower: support matching on ICMP type and code
Simon Horman [Wed, 7 Dec 2016 13:54:03 +0000 (14:54 +0100)]
tc: flower: support matching on ICMP type and code

Support matching on ICMP type and code.

Example usage:

tc qdisc add dev eth0 ingress

tc filter add dev eth0 protocol ip parent ffff: flower \
indev eth0 ip_proto icmp type 8 code 0 action drop

tc filter add dev eth0 protocol ipv6 parent ffff: flower \
indev eth0 ip_proto icmpv6 type 128 code 0 action drop

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: introduce enum flower_endpoint
Simon Horman [Wed, 7 Dec 2016 13:54:02 +0000 (14:54 +0100)]
tc: flower: introduce enum flower_endpoint

Introduce enum flower_endpoint and use it instead of a bool
as the type for paramatising source and destination.

This is intended to improve read-ability and provide some type
checking of endpoint parameters.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agobpf: add initial support for attaching xdp progs
Daniel Borkmann [Tue, 6 Dec 2016 01:21:57 +0000 (02:21 +0100)]
bpf: add initial support for attaching xdp progs

Now that we made the BPF loader generic as a library, reuse it
for loading XDP programs as well. This basically adds a minimal
start of a facility for iproute2 to load XDP programs. There
currently only exists the xdp1_user.c sample code in the kernel
tree that sets up netlink directly and an iovisor/bcc front-end.

Since we have all the necessary infrastructure in place already
from tc side, we can just reuse its loader back-end and thus
facilitate migration and usability among the two for people
familiar with tc/bpf already. Sharing maps, performing tail calls,
etc works the same way as with tc. Naturally, once kernel
configuration API evolves, we will extend new features for XDP
here as well, resp. extend dumping of related netlink attributes.

Minimal example:

  clang -target bpf -O2 -Wall -c prog.c -o prog.o
  ip [-force] link set dev em1 xdp obj prog.o       # attaching
  ip [-d] link                                      # dumping
  ip link set dev em1 xdp off                       # detaching

For the dump, intention is that in the first line for each ip
link entry, we'll see "xdp" to indicate that this device has an
XDP program attached. Once we dump some more useful information
via netlink (digest, etc), idea is that 'ip -d link' will then
display additional relevant program information below the "link/
ether [...]" output line for such devices, for example.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
7 years agobpf: check for owner_prog_type and notify users when differ
Daniel Borkmann [Tue, 6 Dec 2016 01:17:58 +0000 (02:17 +0100)]
bpf: check for owner_prog_type and notify users when differ

Kernel commit 21116b7068b9 ("bpf: add owner_prog_type and accounted mem
to array map's fdinfo") added support for telling the owner prog type in
case of prog arrays. Give a notification to the user when they differ,
and the program eventually fails to load.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
7 years agobpf: Fix number of retries when growing log buffer
Thomas Graf [Wed, 7 Dec 2016 09:47:59 +0000 (10:47 +0100)]
bpf: Fix number of retries when growing log buffer

The log buffer is automatically grown when the verifier output does not
fit into the default buffer size. The number of growing attempts was
not sufficient to reach the maximum buffer size so far.

Perform 9 iterations to reach max and let the 10th one fail.

j:0     i:65536         max:16777215
j:1     i:131072        max:16777215
j:2     i:262144        max:16777215
j:3     i:524288        max:16777215
j:4     i:1048576       max:16777215
j:5     i:2097152       max:16777215
j:6     i:4194304       max:16777215
j:7     i:8388608       max:16777215
j:8     i:16777216      max:16777215

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agodevlink: Add option to set and show eswitch inline mode
Roi Dayan [Sun, 27 Nov 2016 11:21:03 +0000 (13:21 +0200)]
devlink: Add option to set and show eswitch inline mode

This is needed for some HWs to do proper macthing and steering.
Possible values are none, link, network, transport.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
7 years agodevlink: Add usage help for eswitch subcommand
Roi Dayan [Sun, 27 Nov 2016 11:21:02 +0000 (13:21 +0200)]
devlink: Add usage help for eswitch subcommand

Add missing usage help for devlink dev eswitch subcommand.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
7 years agoupdate kernel headers from net-next
Stephen Hemminger [Fri, 9 Dec 2016 20:39:39 +0000 (12:39 -0800)]
update kernel headers from net-next

Net-next now closed.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 9 Dec 2016 20:38:51 +0000 (12:38 -0800)]
Merge branch 'master' into net-next

7 years agoupdate kernel headers
Stephen Hemminger [Fri, 9 Dec 2016 20:38:35 +0000 (12:38 -0800)]
update kernel headers

7 years agoRevert "devlink: Add usage help for eswitch subcommand"
Stephen Hemminger [Fri, 9 Dec 2016 20:37:39 +0000 (12:37 -0800)]
Revert "devlink: Add usage help for eswitch subcommand"

This reverts commit 11f4cd31d2776bbffecceb6775d0210fe16cc04e.

7 years agoRevert "devlink: Add option to set and show eswitch inline mode"
Stephen Hemminger [Fri, 9 Dec 2016 20:37:19 +0000 (12:37 -0800)]
Revert "devlink: Add option to set and show eswitch inline mode"

This reverts commit b9dcf9c2826cc193937e5c337dee96a4c111e56a.

Intended for net-next

7 years agotc: flower: make use of flower_port_attr_type() safe and silent
Simon Horman [Sat, 3 Dec 2016 08:52:40 +0000 (09:52 +0100)]
tc: flower: make use of flower_port_attr_type() safe and silent

Make use of flower_port_attr_type() safe:
* flower_port_attr_type() may return a valid index into tb[] or -1.
  Only access tb[] in the case of the former.
* Do not access null entries in tb[]

Also make usage silent - it is valid for ip_proto to be invalid,
for example if it is not specified as part of the filter.

Fixes: a1fb0d484237 ("tc: flower: Support matching on SCTP ports")
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: correct name of ip_proto parameter to flower_parse_port()
Simon Horman [Sat, 3 Dec 2016 08:52:39 +0000 (09:52 +0100)]
tc: flower: correct name of ip_proto parameter to flower_parse_port()

This corrects a typo.

Fixes: a1fb0d484237 ("tc: flower: Support matching on SCTP ports")
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: document SCTP ip_proto
Simon Horman [Sat, 3 Dec 2016 08:52:38 +0000 (09:52 +0100)]
tc: flower: document SCTP ip_proto

Add SCTP ip_proto to help text and man page.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: remove references to eth_type in manpage
Simon Horman [Fri, 2 Dec 2016 22:59:43 +0000 (14:59 -0800)]
tc: flower: remove references to eth_type in manpage

Remove references to eth_type and ether_type (spelling error) in
the tc flower manpage.

Also correct formatting of boldface text with whitespace.

Cc: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate kernel headers from net-next
Stephen Hemminger [Fri, 2 Dec 2016 22:54:33 +0000 (14:54 -0800)]
update kernel headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 2 Dec 2016 22:19:08 +0000 (14:19 -0800)]
Merge branch 'master' into net-next

7 years agoss: initialise variables outside of for loop
Simon Horman [Fri, 2 Dec 2016 11:56:05 +0000 (12:56 +0100)]
ss: initialise variables outside of for loop

Initialise for loops outside of for loops. GCC flags this as being
out of spec unless C99 or C11 mode is used.

With this change the entire tree appears to compile cleanly with -Wall.

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
...
$ make
...
ss.c: In function ‘unix_show_sock’:
ss.c:3128:4: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
...

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc/act_tunnel: Introduce ip tunnel action
Amir Vadai [Fri, 2 Dec 2016 11:25:15 +0000 (13:25 +0200)]
tc/act_tunnel: Introduce ip tunnel action

This action could be used before redirecting packets to a shared tunnel
device, or when redirecting packets arriving from a such a device.

The 'unset' action is optional. It is used to explicitly unset the
metadata created by the tunnel device during decap. If not used, the
metadata will be released automatically by the kernel.
The 'set' operation, will set the metadata with the specified values for
the encap.

For example, the following flower filter will forward all ICMP packets
destined to 11.11.11.2 through the shared vxlan device 'vxlan0'. Before
redirecting, a metadata for the vxlan tunnel is created using the
tunnel_key action and it's arguments:

$ tc filter add dev net0 protocol ip parent ffff: \
    flower \
      ip_proto 1 \
      dst_ip 11.11.11.2 \
    action tunnel_key set \
      src_ip 11.11.0.1 \
      dst_ip 11.11.0.2 \
      id 11 \
    action mirred egress redirect dev vxlan0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/cls_flower: Classify packet in ip tunnels
Amir Vadai [Fri, 2 Dec 2016 11:25:14 +0000 (13:25 +0200)]
tc/cls_flower: Classify packet in ip tunnels

Introduce classifying by metadata extracted by the tunnel device.
Outer header fields - source/dest ip and tunnel id, are extracted from
the metadata when classifying.

For example, the following will add a filter on the ingress Qdisc of shared
vxlan device named 'vxlan0'. To forward packets with outer src ip
11.11.0.2, dst ip 11.11.0.1 and tunnel id 11. The packets will be
forwarded to tap device 'vnet0':

$ tc filter add dev vxlan0 protocol ip parent ffff: \
    flower \
      enc_src_ip 11.11.0.2 \
      enc_dst_ip 11.11.0.1 \
      enc_key_id 11 \
      dst_ip 11.11.11.1 \
    action mirred egress redirect dev vnet0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agolibnetlink: Introduce rta_getattr_be*()
Amir Vadai [Fri, 2 Dec 2016 11:25:13 +0000 (13:25 +0200)]
libnetlink: Introduce rta_getattr_be*()

Add the utility functions rta_getattr_be16() and rta_getattr_be32(), and
change existing code to use it.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agoss: unix_show: No need to initialize members of calloc'ed structs
Phil Sutter [Fri, 2 Dec 2016 10:40:02 +0000 (11:40 +0100)]
ss: unix_show: No need to initialize members of calloc'ed structs

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make sstate_namel local to scan_state()
Phil Sutter [Fri, 2 Dec 2016 10:40:01 +0000 (11:40 +0100)]
ss: Make sstate_namel local to scan_state()

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make sstate_name local to sock_state_print()
Phil Sutter [Fri, 2 Dec 2016 10:40:00 +0000 (11:40 +0100)]
ss: Make sstate_name local to sock_state_print()

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make unix_state_map local to unix_show()
Phil Sutter [Fri, 2 Dec 2016 10:39:59 +0000 (11:39 +0100)]
ss: Make unix_state_map local to unix_show()

Also make it const, since there won't be any write access happening.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Get rid of single-fielded struct snmpstat
Phil Sutter [Fri, 2 Dec 2016 10:39:58 +0000 (11:39 +0100)]
ss: Get rid of single-fielded struct snmpstat

A struct with only a single field does not make much sense. Besides
that, it was used by print_summary() only.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Get rid of useless goto in handle_follow_request()
Phil Sutter [Fri, 2 Dec 2016 10:39:57 +0000 (11:39 +0100)]
ss: Get rid of useless goto in handle_follow_request()

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make slabstat_ids local to get_slabstat()
Phil Sutter [Fri, 2 Dec 2016 10:39:56 +0000 (11:39 +0100)]
ss: Make slabstat_ids local to get_slabstat()

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make some variables function-local
Phil Sutter [Fri, 2 Dec 2016 10:39:55 +0000 (11:39 +0100)]
ss: Make some variables function-local

addrp_width and screen_width are used in main() only, so no need to have
them globally available.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make user_ent_hash_build_init local to user_ent_hash_build()
Phil Sutter [Fri, 2 Dec 2016 10:39:54 +0000 (11:39 +0100)]
ss: Make user_ent_hash_build_init local to user_ent_hash_build()

By having it statically defined, there is no need for it to be global.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Make tmr_name local to tcp_timer_print()
Phil Sutter [Fri, 2 Dec 2016 10:39:53 +0000 (11:39 +0100)]
ss: Make tmr_name local to tcp_timer_print()

It's used only there, so no need to have it globally defined.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Turn generic_proc_open() wrappers into macros
Phil Sutter [Fri, 2 Dec 2016 10:39:52 +0000 (11:39 +0100)]
ss: Turn generic_proc_open() wrappers into macros

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Eliminate unix_use_proc()
Phil Sutter [Fri, 2 Dec 2016 10:39:51 +0000 (11:39 +0100)]
ss: Eliminate unix_use_proc()

This function is used only at a single place anymore, so replace the
call to it by it's content, which makes that specific part of
unix_show() consistent with e.g. tcp_show().

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Drop list traversal from unix_stats_print()
Phil Sutter [Fri, 2 Dec 2016 10:39:50 +0000 (11:39 +0100)]
ss: Drop list traversal from unix_stats_print()

Although this complicates the dedicated procfs-based code path in
unix_show() a bit, it's the only sane way to get rid of unix_show_sock()
output diverging from other socket types in that it prints all socket
details in a new line.

As a side effect, it allows to eliminate all procfs specific code in
the same function.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: introduce proc_ctx_print()
Phil Sutter [Fri, 2 Dec 2016 10:39:49 +0000 (11:39 +0100)]
ss: introduce proc_ctx_print()

This consolidates identical code in three places. While the function
name is not quite perfect as there is different proc_ctx printing code
in netlink_show_one() as well, I sadly didn't find a more suitable one.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Use sockstat->type in all socket types
Phil Sutter [Fri, 2 Dec 2016 10:39:48 +0000 (11:39 +0100)]
ss: Use sockstat->type in all socket types

Unix sockets used that field already to hold info about the socket type.
By replicating this approach in all other socket types, we can get rid
of protocol parameter in inet_stats_print() and have sock_state_print()
figure things out by itself.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Add missing tab when printing UNIX details
Phil Sutter [Fri, 2 Dec 2016 10:39:47 +0000 (11:39 +0100)]
ss: Add missing tab when printing UNIX details

When dumping UNIX sockets and show_details is active but not show_mem
(ss -xne), the socket details are printed without being prefixed by tab.
Fix this by printing the tab character when either one of '-e' or '-m'
has been specified.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Drop empty lines in UDP output
Phil Sutter [Fri, 2 Dec 2016 10:39:46 +0000 (11:39 +0100)]
ss: Drop empty lines in UDP output

When dumping UDP sockets and show_tcpinfo (-i) is active but not
show_mem (-m), print_tcpinfo() does not output anything leading to an
empty line being printed after every socket. Fix this by skipping the
call to print_tcpinfo() and the previous newline printing in that case.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: Mark fall through in arg parsing switch()
Phil Sutter [Fri, 2 Dec 2016 10:39:45 +0000 (11:39 +0100)]
ss: Mark fall through in arg parsing switch()

As there is a certain chance of overlooking this, better add a comment
to draw readers' attention.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoss: print new tcp_info fields: busy, rwnd-limited, sndbuf-limited times
Yuchung Cheng [Thu, 1 Dec 2016 18:21:40 +0000 (13:21 -0500)]
ss: print new tcp_info fields: busy, rwnd-limited, sndbuf-limited times

Dump some new fields added to tcp_info in v4.10: tcpi_busy_time,
tcpi_rwnd_limited, tcpi_sndbuf_limited.

Example output for a flow busy for 110ms but never measurably limited by
receive window or send buffer:
   busy:110ms

Example output for a flow usually limited by receive window:
   busy:111ms rwnd_limited:101ms(91.0%)

Example output for a flow sometimes limited by send buffer:
   busy:50ms sndbuf_limited:10ms(20.0%)

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
7 years agoss: print new tcp_info fields: delivery_rate and app_limited
Neal Cardwell [Thu, 1 Dec 2016 18:21:39 +0000 (13:21 -0500)]
ss: print new tcp_info fields: delivery_rate and app_limited

Dump the new delivery_rate and delivery_rate_app_limited fields that
were added to tcp_info in Linux v4.9.

Example output:
  pacing_rate 65.7Mbps delivery_rate 62.9Mbps

And for the application-limited case this looks like:
  pacing_rate 1031.1Mbps delivery_rate 87.4Mbps app_limited

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
7 years agoss: Add inet raw sockets information gathering via netlink diag interface
Cyrill Gorcunov [Wed, 2 Nov 2016 13:14:56 +0000 (16:14 +0300)]
ss: Add inet raw sockets information gathering via netlink diag interface

unix, tcp, udp[lite], packet, netlink sockets already support diag
interface for their collection and killing. Implement support
for raw sockets.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
7 years agolibnetlink: Add test for error code returned from netlink reply
Cyrill Gorcunov [Wed, 2 Nov 2016 13:14:55 +0000 (16:14 +0300)]
libnetlink: Add test for error code returned from netlink reply

In case if some diag module is not present in the system,
say the kernel is not modern enough, we simply skip the
error code reported. Instead we should check for data
length in NLMSG_DONE and process unsupported case.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
7 years agoUpdate kernel headers for XDP and tcp_info
Stephen Hemminger [Thu, 1 Dec 2016 18:52:30 +0000 (10:52 -0800)]
Update kernel headers for XDP and tcp_info

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Thu, 1 Dec 2016 18:48:05 +0000 (10:48 -0800)]
Merge branch 'master' into net-next

7 years agoman: ip-route.8: Add notes about dropped IPv4 route cache
Phil Sutter [Wed, 30 Nov 2016 08:29:48 +0000 (09:29 +0100)]
man: ip-route.8: Add notes about dropped IPv4 route cache

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Thu, 1 Dec 2016 18:29:12 +0000 (10:29 -0800)]
Merge branch 'master' into net-next

7 years agodevlink: Add option to set and show eswitch inline mode
Roi Dayan [Sun, 27 Nov 2016 11:21:03 +0000 (13:21 +0200)]
devlink: Add option to set and show eswitch inline mode

This is needed for some HWs to do proper macthing and steering.
Possible values are none, link, network, transport.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
7 years agodevlink: Add usage help for eswitch subcommand
Roi Dayan [Sun, 27 Nov 2016 11:21:02 +0000 (13:21 +0200)]
devlink: Add usage help for eswitch subcommand

Add missing usage help for devlink dev eswitch subcommand.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
7 years agolink: add team and team_slave link type
Zhang Shengju [Fri, 25 Nov 2016 14:01:29 +0000 (22:01 +0800)]
link: add team and team_slave link type

Add missing team and team_slave link type.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
7 years agol2tp: style cleanup
Stephen Hemminger [Tue, 29 Nov 2016 21:40:06 +0000 (13:40 -0800)]
l2tp: style cleanup

Make l2tp conform to kernel style guidelines

7 years agoman: ip-l2tp.8: document UDP checksum options
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:26 +0000 (22:45 +0000)]
man: ip-l2tp.8: document UDP checksum options

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: show tunnel: expose UDP checksum state
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:25 +0000 (22:45 +0000)]
l2tp: show tunnel: expose UDP checksum state

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: support sequence numbering
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:24 +0000 (22:45 +0000)]
l2tp: support sequence numbering

This patch implement and documents the user interface for
sequence numbering.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: read IPv6 UDP checksum attributes from kernel
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:23 +0000 (22:45 +0000)]
l2tp: read IPv6 UDP checksum attributes from kernel

In case of an older kernel that doesn't set L2TP_ATTR_UDP_ZERO_CSUM6_{RX,TX}
the old hard-coded value is being preserved, since the attribute flag will be
missing.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: fix L2TP_ATTR_UDP_CSUM handling
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:22 +0000 (22:45 +0000)]
l2tp: fix L2TP_ATTR_UDP_CSUM handling

L2TP_ATTR_UDP_CSUM is read by the kernel as a NLA_FLAG value,
but is validated as a NLA_U8, so we will write it as an u8,
but the value isn't actually being read by the kernel.

It is written by the kernel as a NLA_U8, so we will read as
such.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:21 +0000 (22:45 +0000)]
l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling

L2TP_ATTR_RECV_SEQ and L2TP_ATTR_SEND_SEQ are declared as NLA_U8
attributes in the kernel, so let's threat them accordingly.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agol2tp: fix integers with too few significant bits
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:20 +0000 (22:45 +0000)]
l2tp: fix integers with too few significant bits

udp6_csum_{tx,rx}, tunnel and session are the only ones
currently used.

recv_seq, send_seq, lns_mode and data_seq are partially
implemented in a useless way.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agoman: ip-l2tp.8: remove non-existent tunnel parameter name
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:19 +0000 (22:45 +0000)]
man: ip-l2tp.8: remove non-existent tunnel parameter name

The name parameter is only valid for sessions, not tunnels.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agoman: ip-l2tp.8: fix l2spec_type documentation
Asbjørn Sloth Tønnesen [Wed, 16 Nov 2016 22:45:18 +0000 (22:45 +0000)]
man: ip-l2tp.8: fix l2spec_type documentation

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
7 years agotc: distinguish Add/Replace filter operations
Roman Mashak [Wed, 16 Nov 2016 22:30:20 +0000 (17:30 -0500)]
tc: distinguish Add/Replace filter operations

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
7 years agomacsec: Nr. of packets and octets for macsec tx stats were swapped
Daniel Hopf [Tue, 29 Nov 2016 21:22:12 +0000 (13:22 -0800)]
macsec: Nr. of packets and octets for macsec tx stats were swapped

Acked-by: Rami Rosen <roszenrami@gmail.com>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Daniel Hopf <daniel.hopf@continental-corporation.com>
7 years agoifstat/nstat: fix help output alignment
Mike Frysinger [Wed, 16 Nov 2016 03:34:14 +0000 (22:34 -0500)]
ifstat/nstat: fix help output alignment

Some lines use tabs while others use spaces.  Use spaces everywhere.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
7 years agolibnetlink: style cleanups
Stephen Hemminger [Tue, 29 Nov 2016 21:15:08 +0000 (13:15 -0800)]
libnetlink: style cleanups

Follow kernel style related cleanups:
 * break long lines
 * remove unnecessary void * cast

7 years agolibnetlink: reduce size of message sent to kernel
Zhang Shengju [Sat, 19 Nov 2016 15:50:13 +0000 (23:50 +0800)]
libnetlink: reduce size of message sent to kernel

Fixes commit 246f57c4086d99fa ("ip link: Add support for kernel
side filtering").

This patch reduce the size of message sent to kernel space. Before this
patch, for command: 'ip link show', we will sent 1056 bytes. With this
patch, we only need to send 40 bytes.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
7 years agoiproute2: fix the link group name getting error
Zhang Shengju [Fri, 18 Nov 2016 01:12:53 +0000 (09:12 +0800)]
iproute2: fix the link group name getting error

In the situation where more than one entry live in the same hash bucket,
loop to get the correct one.

Before:
$ cat /etc/iproute2/group
0 default
256     test

$ sudo ip link set group test dummy1

$ ip link show type dummy
11: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group 0 qlen 1000
    link/ether 4e:3b:d3:6c:f0:e6 brd ff:ff:ff:ff:ff:ff
12: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group test qlen 1000
    link/ether d6:9c:a4:1f:e7:e5 brd ff:ff:ff:ff:ff:ff

After:
$ ip link show type dummy
11: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 4e:3b:d3:6c:f0:e6 brd ff:ff:ff:ff:ff:ff
12: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group test qlen 1000
    link/ether d6:9c:a4:1f:e7:e5 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
7 years agoiproute2: a non-expected rtnl message is an error
david decotigny [Fri, 11 Nov 2016 18:55:37 +0000 (10:55 -0800)]
iproute2: a non-expected rtnl message is an error

7 years agoiproute2: avoid exit in case of error.
david decotigny [Fri, 11 Nov 2016 18:55:36 +0000 (10:55 -0800)]
iproute2: avoid exit in case of error.

Be consistent with how non-0 print_route() return values are handled
elesewhere: return -1.

7 years agoiproute2: macvlan: add "source" mode
michael-dev@fami-braun.de [Tue, 22 Nov 2016 10:59:13 +0000 (11:59 +0100)]
iproute2: macvlan: add "source" mode

Adjusting iproute2 utility to support new macvlan link type mode called
"source".

Example of commands that can be applied:
  ip link add link eth0 name macvlan0 type macvlan mode source
  ip link set link dev macvlan0 type macvlan macaddr add 00:11:11:11:11:11
  ip link set link dev macvlan0 type macvlan macaddr del 00:11:11:11:11:11
  ip link set link dev macvlan0 type macvlan macaddr flush
  ip -details link show dev macvlan0

Based on previous work of Stefan Gula <steweg@gmail.com>

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
Cc: steweg@gmail.com
v5:
 - rebase and fix checkpatch

v4:
 - add MACADDR_SET support
 - skip FLAG_UNICAST / FLAG_UNICAST_ALL as this is not upstream
 - fix man page

7 years agobpf: make tc's bpf loader generic and move into lib
Daniel Borkmann [Thu, 10 Nov 2016 00:20:59 +0000 (01:20 +0100)]
bpf: make tc's bpf loader generic and move into lib

This work moves the bpf loader into the iproute2 library and reworks
the tc specific parts into generic code. It's useful as we can then
more easily support new program types by just having the same ELF
loader backend. Joint work with Thomas Graf. I hacked a rough start
of a test suite to make sure nothing breaks [1] and looks all good.

  [1] https://github.com/borkmann/clsact/blob/master/test_bpf.sh

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
7 years agoip: support UID range routing.
Lorenzo Colitti [Sun, 6 Nov 2016 16:26:51 +0000 (01:26 +0900)]
ip: support UID range routing.

- Support adding, deleting and showing IP rules with UID ranges.
- Support querying per-UID routes via "ip route get uid <UID>".

UID range routing was added to net-next in 4fb7450683 ("Merge
branch 'uid-routing'")

Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
7 years agotc: flower checkpatch cleanups
Stephen Hemminger [Tue, 29 Nov 2016 19:48:52 +0000 (11:48 -0800)]
tc: flower checkpatch cleanups

break long lines and minor whitespace changes.

7 years agotc: flower: Support matching on SCTP ports
Simon Horman [Thu, 3 Nov 2016 12:26:41 +0000 (13:26 +0100)]
tc: flower: Support matching on SCTP ports

Support matching on SCTP ports in the same way that matching
on TCP and UDP ports is already supported.

Example usage:

tc qdisc add dev eth0 ingress

tc filter add dev eth0 protocol ip parent ffff: \
        flower indev eth0 ip_proto sctp dst_port 80 \
        action drop

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agoupdate net-next headers
Stephen Hemminger [Tue, 29 Nov 2016 19:43:40 +0000 (11:43 -0800)]
update net-next headers

7 years agoupdate headers based on 4.9-rc7
Stephen Hemminger [Tue, 29 Nov 2016 19:36:47 +0000 (11:36 -0800)]
update headers based on 4.9-rc7

7 years agotc: cleanup style of qdisc code
Stephen Hemminger [Tue, 15 Nov 2016 18:29:09 +0000 (10:29 -0800)]
tc: cleanup style of qdisc code

Get rid of lingering mismatches with kernel style.

7 years agotc: print raw qdisc handle.
Roman Mashak [Mon, 14 Nov 2016 22:59:20 +0000 (17:59 -0500)]
tc: print raw qdisc handle.

This is v2 patch with fixed code indentation.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
7 years agotc: improved usage help for fw classifier.
Roman Mashak [Thu, 10 Nov 2016 16:02:57 +0000 (11:02 -0500)]
tc: improved usage help for fw classifier.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
7 years agoipaddress: Print IFLA_VF_QUERY_RSS_EN setting
Phil Sutter [Mon, 14 Nov 2016 08:29:54 +0000 (09:29 +0100)]
ipaddress: Print IFLA_VF_QUERY_RSS_EN setting

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agotc: updated man page to reflect GET command to retrieve a single filter.
Roman Mashak [Mon, 7 Nov 2016 02:27:38 +0000 (21:27 -0500)]
tc: updated man page to reflect GET command to retrieve a single filter.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
7 years agoip: style cleanup
Stephen Hemminger [Mon, 14 Nov 2016 08:28:09 +0000 (09:28 +0100)]
ip: style cleanup

Make code more inline with current kernel style

7 years agoipaddress: Simplify vf_info parsing
Phil Sutter [Tue, 8 Nov 2016 21:29:11 +0000 (22:29 +0100)]
ipaddress: Simplify vf_info parsing

Commit 7b8179c780a1a ("iproute2: Add new command to ip link to
enable/disable VF spoof check") tried to add support for
IFLA_VF_SPOOFCHK in a backwards-compatible manner, but aparently overdid
it: parse_rtattr_nested() handles missing attributes perfectly fine in
that it will leave the relevant field unassigned so calling code can
just compare against NULL. There is no need to layback from the previous
(IFLA_VF_TX_RATE) attribute to the next to check if IFLA_VF_SPOOFCHK is
present or not. To the contrary, it establishes a potentially incorrect
assumption of these two attributes directly following each other which
may not be the case (although up to now, kernel aligns them this way).

This patch cleans up the code to adhere to the common way of checking
for attribute existence. It has been tested to return correct results
regardless of whether the kernel exports IFLA_VF_SPOOFCHK or not.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Greg Rose <grose@lightfleet.com>
7 years agoss: break really long lines
Stephen Hemminger [Sun, 13 Nov 2016 06:59:15 +0000 (09:59 +0300)]
ss: break really long lines

7 years agoss: Add support for SCTP protocol
Phil Sutter [Wed, 9 Nov 2016 11:12:24 +0000 (12:12 +0100)]
ss: Add support for SCTP protocol

This makes use of the sctp_diag interface recently added to the kernel.

Joint work with Xin Long who provided the PoC implementation which I
merely polished up a bit.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoinclude: Add linux/sctp.h
Phil Sutter [Wed, 9 Nov 2016 11:12:23 +0000 (12:12 +0100)]
include: Add linux/sctp.h

Add sanitized UAPI linux/sctp.h header file.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agotc: flower: Fix usage message
Paul Blakey [Wed, 2 Nov 2016 15:09:58 +0000 (17:09 +0200)]
tc: flower: Fix usage message

Remove left over usage from removal of eth_type argument.

Fixes: 488b41d020fb ('tc: flower no need to specify the ethertype')
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agoiproute2: ss: escape all null bytes in abstract unix domain socket
Isaac Boukris [Sat, 29 Oct 2016 19:20:19 +0000 (22:20 +0300)]
iproute2: ss: escape all null bytes in abstract unix domain socket

Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
7 years agoip: update link types to show 6lowpan and ieee802.15.4 monitor
stefan@datenfreihafen.org [Fri, 28 Oct 2016 09:42:03 +0000 (11:42 +0200)]
ip: update link types to show 6lowpan and ieee802.15.4 monitor

Both types have been missing here and thus ip always showed
only the numbers.

Based on a suggestion from Alexander Aring.

Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
7 years agotc: m_mirred: Add support for ingress redirect/mirror
Shmulik Ladkani [Wed, 19 Oct 2016 14:14:09 +0000 (17:14 +0300)]
tc: m_mirred: Add support for ingress redirect/mirror

So far, only the 'egress' direction was implemented.

Allow specifying 'ingress' as the direction packet appears on the target
interface.

For example, this takes incoming 802.1q frames on veth0 and redirects
them for input on dummy0:

 # tc filter add dev veth0 parent ffff: pref 1 protocol 802.1q basic \
     action mirred ingress redirect dev dummy0

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
7 years agoupdate kernel headers to 4.9-net-next
Stephen Hemminger [Wed, 26 Oct 2016 18:20:29 +0000 (11:20 -0700)]
update kernel headers to 4.9-net-next

7 years agocleanup debris from revert
Stephen Hemminger [Wed, 26 Oct 2016 18:19:11 +0000 (11:19 -0700)]
cleanup debris from revert

Last revert didn't come out clean.

7 years agoRevert "iproute2: macvlan: add "source" mode"
Stephen Hemminger [Wed, 26 Oct 2016 18:15:09 +0000 (11:15 -0700)]
Revert "iproute2: macvlan: add "source" mode"

This reverts commit f33b7276102c019795c034816b91de72a26cdda3.

The upstream changes are not in 4.9

7 years agotc, ipt: don't enforce iproute2 dependency on iptables-devel
Daniel Borkmann [Tue, 18 Oct 2016 12:13:09 +0000 (14:13 +0200)]
tc, ipt: don't enforce iproute2 dependency on iptables-devel

Since 5cd1adba79d3 ("Update to current iptables headers") compilation
of iproute2 broke for systems without iptables-devel package [1].
Reason is that even though we fall back to build m_ipt.c, the include
depends on a xtables-version.h header, which only ships with
iptables-devel. Machines not having this package fail compilation with:

    [...]
    CC       m_ipt.o
In file included from ../include/iptables.h:5:0,
                 from m_ipt.c:17:
../include/xtables.h:34:29: fatal error: xtables-version.h: No such file or directory
compilation terminated.
../Config:31: recipe for target 'm_ipt.o' failed
make[1]: *** [m_ipt.o] Error 1

The configure script only barks that package xtables was not found in
the pkg-config search path. The generated Config then only contains f.e.
TC_CONFIG_IPSET. In tc's Makefile we thus fall back to adding m_ipt.o
to TCMODULES. m_ipt.c then includes the local include/iptables.h header
copy, which includes the include/xtables.h copy. Latter then includes
xtables-version.h, which only ships with iptables-devel.

One way to resolve this is to skip this whole mess when pkg-config has
no xtables config available. I've carried something along these lines
locally for a while now, but it's just too annyoing. :/ Build works fine
now also when xtables.pc is not available.

  [1] http://www.spinics.net/lists/netdev/msg366162.html

Fixes: 5cd1adba79d3 ("Update to current iptables headers")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>