]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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.

8 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

8 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>
8 years agodevlink: Convert conditional in dl_argv_handle_port() to switch()
Hangbin Liu [Sun, 9 Oct 2016 02:14:18 +0000 (10:14 +0800)]
devlink: Convert conditional in dl_argv_handle_port() to switch()

Discovered by Phil's covscan. The final return statement is never reached.
This is not inherently clear from looking at the code, so change the
conditional to a switch() statement which should clarify this.

CC: Phil Sutter <phil@nwl.cc>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
8 years agobridge: add support for the multicast flood flag
Nikolay Aleksandrov [Thu, 13 Oct 2016 15:54:20 +0000 (17:54 +0200)]
bridge: add support for the multicast flood flag

Recently a new per-port flag was added which controls the flooding of
unknown multicast, this patch adds support for controlling it via iproute2.
It also updates the man pages with information about the new flag.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
8 years agotc: cls_bpf: handle skip_sw and skip_hw flags
Jakub Kicinski [Wed, 12 Oct 2016 15:46:36 +0000 (16:46 +0100)]
tc: cls_bpf: handle skip_sw and skip_hw flags

Add support for controling hardware offload using (now standard)
skip_sw and skip_hw flags in cls_bpf.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
8 years agobridge: vlan: remove wrong stats help
Nikolay Aleksandrov [Wed, 12 Oct 2016 13:02:28 +0000 (15:02 +0200)]
bridge: vlan: remove wrong stats help

When I did the per-vlan stats iproute2 support, I left out a hunk from a
previous version of the patch that was using a special subcommand "stats".
Since the latest version uses the -s switch remove the help for the stats
subcommand.

Fixes: 7abf5de677e32 ("bridge: vlan: add support to display per-vlan statistics")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
8 years agoip: macvlan style cleanup
Stephen Hemminger [Wed, 12 Oct 2016 22:23:27 +0000 (15:23 -0700)]
ip: macvlan style cleanup

breaklong lines.

8 years agoiproute2: macvlan: add "source" mode
michael-dev@fami-braun.de [Sun, 25 Sep 2016 19:08:55 +0000 (21:08 +0200)]
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
8 years agoman pages: add man page for skbmod action
Lucas Bates [Tue, 11 Oct 2016 11:00:48 +0000 (07:00 -0400)]
man pages: add man page for skbmod action

Signed-off-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agotc_filter: style cleanup
Stephen Hemminger [Wed, 12 Oct 2016 22:21:13 +0000 (15:21 -0700)]
tc_filter: style cleanup

Break long lines and whtespace changes.

8 years agotc filters: add support to get individual filters by handle
Jamal Hadi Salim [Mon, 10 Oct 2016 16:45:14 +0000 (12:45 -0400)]
tc filters: add support to get individual filters by handle

sudo $TC filter add dev $ETH parent ffff: prio 2 protocol ip \
u32 match u32 0 0 flowid 1:1 \
action ok
sudo $TC filter add dev $ETH parent ffff: prio 1 protocol ip \
u32 match ip protocol 1 0xff flowid 1:10 \
action ok

now dump to see all rules..
$TC -s filter ls dev $ETH parent ffff: protocol ip
 ....
filter pref 1 u32
filter pref 1 u32 fh 801: ht divisor 1
filter pref 1 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:10  (rule hit 0 success 0)
  match 00010000/00ff0000 at 8 (success 0 )
        action order 1: gact action drop
         random type none pass val 0
         index 6 ref 1 bind 1 installed 4 sec used 4 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

filter pref 2 u32
filter pref 2 u32 fh 800: ht divisor 1
filter pref 2 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1  (rule hit 336 success 336)
  match 00000000/00000000 at 0 (success 336 )
        action order 1: gact action pass
         random type none pass val 0
         index 5 ref 1 bind 1 installed 38 sec used 4 sec
        Action statistics:
        Sent 24864 bytes 336 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0
 ....

..get filter 801::800
$TC -s filter get dev $ETH parent ffff: protocol ip \
handle 801:0:800 prio 2  u32

 ....
filter parent ffff: protocol ip pref 1 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:10  (rule hit 260 success 130)
  match 00010000/00ff0000 at 8 (success 130 )
        action order 1: gact action drop
         random type none pass val 0
         index 6 ref 1 bind 1 installed 348 sec used 0 sec
        Action statistics:
        Sent 11440 bytes 130 pkt (dropped 130, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0
 ....

..get other one
$TC -s filter get dev $ETH parent ffff: protocol ip \
handle 800:0:800 prio 2  u32

....
filter parent ffff: protocol ip pref 2 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1  (rule hit 514 success 514)
  match 00000000/00000000 at 0 (success 514 )
        action order 1: gact action pass
         random type none pass val 0
         index 5 ref 1 bind 1 installed 506 sec used 4 sec
        Action statistics:
        Sent 35544 bytes 514 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0
....

..try something that doesnt exist
$TC -s filter get dev $ETH parent ffff: protocol ip  handle 800:0:803 prio 2  u32

.....
RTNETLINK answers: No such file or directory
We have an error talking to the kernel
.....

Note, added NLM_F_ECHO is for backward compatibility. old kernels never
before Eric's patch will not respond without it and newer kernels (after Erics patch)
will ignore it.
In old kernels there is a side effect:
In addition to a response to the GET you will receive an event (if you do tc mon).
But this is still better than what it was before (not working at all).

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agotc: skbmod style cleanup
Stephen Hemminger [Wed, 12 Oct 2016 22:12:51 +0000 (15:12 -0700)]
tc: skbmod style cleanup

break long lines

8 years agoman pages: Add tc-ife to Makefile
Jamal Hadi Salim [Tue, 11 Oct 2016 11:00:47 +0000 (07:00 -0400)]
man pages: Add tc-ife to Makefile

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoman pages: update ife action to include tcindex
Lucas Bates [Tue, 11 Oct 2016 11:00:46 +0000 (07:00 -0400)]
man pages: update ife action to include tcindex

Signed-off-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoactions: add skbmod action
Jamal Hadi Salim [Tue, 11 Oct 2016 11:00:45 +0000 (07:00 -0400)]
actions: add skbmod action

This action is intended to be an upgrade from a usability perspective
from pedit (as well as operational debugability).
Compare this:

sudo tc filter add dev $ETH parent 1: protocol ip prio 10 \
u32 match ip protocol 1 0xff flowid 1:2 \
action pedit munge offset -14 u8 set 0x02 \
    munge offset -13 u8 set 0x15 \
    munge offset -12 u8 set 0x15 \
    munge offset -11 u8 set 0x15 \
    munge offset -10 u16 set 0x1515 \
    pipe

to:

sudo tc filter add dev $ETH parent 1: protocol ip prio 10 \
u32 match ip protocol 1 0xff flowid 1:2 \
action skbmod dmac 02:15:15:15:15:15

Or worse, try to debug a policy with destination mac, source mac and
etherype. Then make that a hundred rules and you'll get my point.

The most important ethernet use case at the moment is when redirecting or
mirroring packets to a remote machine. The dst mac address needs a re-write
so that it doesn't get dropped or confuse an interconnecting (learning) switch
or dropped by a target machine (which looks at the dst mac).

In the future common use cases on pedit can be migrated to this action
(as an example different fields in ip v4/6, transports like tcp/udp/sctp
etc). For this first cut, this allows modifying basic ethernet header.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoaction gact: list pipe as a valid action
Craig Dillabaugh [Tue, 11 Oct 2016 11:00:44 +0000 (07:00 -0400)]
action gact: list pipe as a valid action

Signed-off-by: Craig Dillabaugh <cdillaba@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoactions ife: Introduce encoding and decoding of tcindex metadata
Jamal Hadi Salim [Tue, 11 Oct 2016 11:00:43 +0000 (07:00 -0400)]
actions ife: Introduce encoding and decoding of tcindex metadata

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoife: improve help text
Roman Mashak [Tue, 11 Oct 2016 11:00:42 +0000 (07:00 -0400)]
ife: improve help text

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoife: print prio, mark and hash as unsigned
Roman Mashak [Tue, 11 Oct 2016 11:00:41 +0000 (07:00 -0400)]
ife: print prio, mark and hash as unsigned

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoife action: allow specifying index in hex
Roman Mashak [Tue, 11 Oct 2016 11:00:40 +0000 (07:00 -0400)]
ife action: allow specifying index in hex

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoip: iprule style cleanup
Stephen Hemminger [Mon, 10 Oct 2016 02:29:24 +0000 (19:29 -0700)]
ip: iprule style cleanup

Trivial whitespace cleanup to iprule

8 years agoip rule: add selector support
Hangbin Liu [Fri, 23 Sep 2016 03:25:55 +0000 (11:25 +0800)]
ip rule: add selector support

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agoip rule: merge ip rule flush and list, save together
Hangbin Liu [Fri, 23 Sep 2016 03:25:54 +0000 (11:25 +0800)]
ip rule: merge ip rule flush and list, save together

iprule_flush() and iprule_list_or_save() both call function
rtnl_wilddump_request() and rtnl_dump_filter(). So merge them
together just like other files do.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agoiplink: cleanup style errors
Stephen Hemminger [Mon, 10 Oct 2016 02:24:38 +0000 (19:24 -0700)]
iplink: cleanup style errors

Fix long strings causing checkpatch warnings

8 years agoip link: Add support to configure SR-IOV VF to vlan protocol 802.1ad (VST QinQ)
Moshe Shemesh [Wed, 28 Sep 2016 07:58:59 +0000 (10:58 +0300)]
ip link: Add support to configure SR-IOV VF to vlan protocol 802.1ad (VST QinQ)

Introduce a new API that exposes a list of vlans per VF (IFLA_VF_VLAN_LIST),
giving the ability for user-space application to specify it for the VF as
an option to support 802.1ad (VST QinQ).

We introduce struct vf_vlan_info, which extends struct vf_vlan and adds
an optional VF VLAN proto parameter.
Default VLAN-protocol is 802.1Q.

Add IFLA_VF_VLAN_LIST in addition to IFLA_VF_VLAN to keep backward
compatibility with older kernel versions.

Suitable ip link tool command examples:
 - Set vf vlan protocol 802.1ad (S-TAG)
ip link set eth0 vf 1 vlan 100 proto 802.1ad
 - Set vf vlan S-TAG and vlan C-TAG (VST QinQ)
ip link set eth0 vf 1 vlan 100 proto 802.1ad vlan 30 proto 802.1Q
 - Set vf to VST (802.1Q) mode
ip link set eth0 vf 1 vlan 100 proto 802.1Q
 - Or by omitting the new parameter (backward compatible)
ip link set eth0 vf 1 vlan 100

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
8 years agotc: fq: display unthrottle latency
Eric Dumazet [Wed, 28 Sep 2016 13:23:15 +0000 (06:23 -0700)]
tc: fq: display unthrottle latency

In linux-4.9 fq packet scheduler got a new stat :

unthrottle_latency in nano second units.

Gives a good indication of system load or timer implementation
latencies.

Signed-off-by: Eric Dumazet <edumazet@google.com>
8 years agotc: m_vlan: Add vlan modify action
Shmulik Ladkani [Thu, 22 Sep 2016 18:01:05 +0000 (21:01 +0300)]
tc: m_vlan: Add vlan modify action

The 'vlan modify' action allows to replace an existing 802.1q tag
according to user provided settings.
It accepts same arguments as the 'vlan push' action.

For example, this replaces vid 6 with vid 5:

 # tc filter add dev veth0 parent ffff: pref 1 protocol 802.1q \
      basic match 'meta(vlan mask 0xfff eq 6)' \
      action vlan modify id 5 continue

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
8 years agoipmroute: add support for age dumping
Nikolay Aleksandrov [Wed, 21 Sep 2016 09:45:58 +0000 (11:45 +0200)]
ipmroute: add support for age dumping

Add support to dump the mroute cache entry age if the show_stats (-s)
switch is provided.
Example:
$ ip -s mroute
(0.0.0.0, 239.10.10.10)          Iif: eth0       Oifs: eth0
  0 packets, 0 bytes, Age  245.44

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
8 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 10 Oct 2016 02:04:50 +0000 (19:04 -0700)]
Merge branch 'master' into net-next

8 years agov4.8.0
Stephen Hemminger [Mon, 10 Oct 2016 02:00:11 +0000 (19:00 -0700)]
v4.8.0

8 years agoiproute2: build nsid-name cache only for commands that need it
Anton Aksola [Tue, 20 Sep 2016 06:01:27 +0000 (06:01 +0000)]
iproute2: build nsid-name cache only for commands that need it

The calling of netns_map_init() before command parsing introduced
a performance issue with large number of namespaces.

As commands such as add, del and exec do not need to iterate through
/var/run/netns it would be good not no build the cache before executing
these commands.

Example:
unpatched:
time seq 1 1000 | xargs -n 1 ip netns add

real    0m16.832s
user    0m1.350s
sys    0m15.029s

patched:
time seq 1 1000 | xargs -n 1 ip netns add

real    0m3.859s
user    0m0.132s
sys    0m3.205s

Signed-off-by: Anton Aksola <aakso@iki.fi>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
8 years agoupdate headers from pre 4.9 (net-next)
Stephen Hemminger [Mon, 10 Oct 2016 01:55:58 +0000 (18:55 -0700)]
update headers from pre 4.9 (net-next)

8 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 10 Oct 2016 01:53:52 +0000 (18:53 -0700)]
Merge branch 'master' into net-next

8 years agotc: f_u32: Fill in 'linkid' provided by user
Sushma Sitaram [Wed, 28 Sep 2016 18:30:16 +0000 (11:30 -0700)]
tc: f_u32: Fill in 'linkid' provided by user

Currently, 'linkid' input by the user is parsed but 'handle' is appended to the netlink message.

# tc filter add dev enp1s0f1 protocol ip parent ffff: prio 99 u32 ht 800: \
order 1 link 1: offset at 0 mask 0f00 shift 6 plus 0 eat match ip \
protocol 6 ff

resulted in:
filter protocol ip pref 99 u32 fh 800::1 order 1 key ht 800 bkt 0
  match 00060000/00ff0000 at 8
    offset 0f00>>6 at 0  eat

This patch results in:
filter protocol ip pref 99 u32 fh 800::1 order 1 key ht 800 bkt 0 link 1:
  match 00060000/00ff0000 at 8
    offset 0f00>>6 at 0  eat

Signed-off-by Sushma Sitaram: Sushma Sitaram <sushma.sitaram@intel.com>

8 years agobridge: Fix garbled json output seen if a vlan filter is specified
anuradhak [Fri, 7 Oct 2016 16:40:18 +0000 (09:40 -0700)]
bridge: Fix garbled json output seen if a vlan filter is specified

json objects were started but not completed if the fdb vlan did not
match the specified filter vlan.

Sample output:
$ bridge -j fdb show vlan 111
[{
        "mac": "44:38:39:00:69:88",
        "dev": "br0",
        "vlan": 111,
        "master": "br0",
        "state": "permanent"
    }
]
$ bridge -j fdb show vlan 100
[]
$

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
8 years agofix netlink message length checks
Igor Ryzhov [Tue, 4 Oct 2016 10:16:55 +0000 (13:16 +0300)]
fix netlink message length checks

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
8 years agoip: Use specific slave id
Hangbin Liu [Tue, 20 Sep 2016 10:02:12 +0000 (18:02 +0800)]
ip: Use specific slave id

The original bond/bridge/vrf and slaves use same id, which make people
confused. Use bond/bridge/vrf_slave as id name will make code more clear.

Acked-by: Phil Sutter <psutter@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>