]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 1 May 2017 16:26:51 +0000 (09:26 -0700)]
Merge branch 'master' into net-next

7 years agopedit: fix whitespace
Stephen Hemminger [Mon, 1 May 2017 16:25:22 +0000 (09:25 -0700)]
pedit: fix whitespace

Add newlines to break long lines.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agotc/pedit: p_udp: introduce pedit udp support
Or Gerlitz [Sun, 23 Apr 2017 12:53:56 +0000 (15:53 +0300)]
tc/pedit: p_udp: introduce pedit udp support

For example, forward udp traffic destined to port 999 to veth0 and set
tcp port to 888:
$ tc filter add dev enp0s9 protocol ip parent ffff: \
    flower \
      ip_proto udp \
      dst_port 999 \
    action pedit ex munge \
      udp dport set 888 \
    action mirred egress \
      redirect dev veth0

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: p_tcp: introduce pedit tcp support
Amir Vadai [Sun, 23 Apr 2017 12:53:55 +0000 (15:53 +0300)]
tc/pedit: p_tcp: introduce pedit tcp support

For example, forward tcp traffic destined to port 80 to veth0 and set
tcp port to 8080:
$ tc filter add dev enp0s9 protocol ip parent ffff: \
    flower \
      ip_proto tcp \
      dst_port 80 \
    action pedit ex munge \
      tcp dport set 8080 \
    action mirred egress \
      redirect dev veth0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: p_eth: ETH header editor
Amir Vadai [Sun, 23 Apr 2017 12:53:54 +0000 (15:53 +0300)]
tc/pedit: p_eth: ETH header editor

For example, forward tcp traffic to veth0 and set
destination mac address to 11:22:33:44:55:66 :
$ tc filter add dev enp0s9 protocol ip parent ffff: \
    flower \
      ip_proto tcp \
    action pedit ex munge \
      eth dst set 11:22:33:44:55:66 \
    action mirred egress \
      redirect dev veth0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: Support fields bigger than 32 bits
Amir Vadai [Sun, 23 Apr 2017 12:53:53 +0000 (15:53 +0300)]
tc/pedit: Support fields bigger than 32 bits

Make parse_val() accept fields up to 128 bits long, this should be
enough for current use cases and involves a minimal change to code.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: p_ip: introduce editing ttl header
Amir Vadai [Sun, 23 Apr 2017 12:53:52 +0000 (15:53 +0300)]
tc/pedit: p_ip: introduce editing ttl header

Enable user to edit IP header ttl field.

For example, to forward any TCP packet and decrease its TTL by one:
$ tc filter add dev enp0s9 protocol ip parent ffff: \
    flower \
      ip_proto tcp \
    action pedit ex munge \
      ip ttl add 0xff pipe \
    action mirred egress \
      redirect dev veth0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: Introduce 'add' operation
Amir Vadai [Sun, 23 Apr 2017 12:53:51 +0000 (15:53 +0300)]
tc/pedit: Introduce 'add' operation

This command could be useful to increase/decrease fields value.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: Extend pedit to specify offset relative to mac/transport headers
Amir Vadai [Sun, 23 Apr 2017 12:53:50 +0000 (15:53 +0300)]
tc/pedit: Extend pedit to specify offset relative to mac/transport headers

Utilize the extended pedit netlink to set an offset relative to a
specific header type. Old netlink only enabled the user to set
approximated  offset relative to the IPv4 header.

To use this extended functionality need to use the 'ex' keyword after
'pedit' and before any 'munge'.
e.g:
$ tc filter add dev ens9 protocol ip parent ffff: \
    flower \
      ip_proto udp \
      dst_port 80 \
    action pedit ex munge \
      ip dst set 1.1.1.1 \
      pipe \
    action mirred egress redirect dev veth0

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agotc/pedit: Fix a typo in pedit usage message
Amir Vadai [Sun, 23 Apr 2017 12:53:49 +0000 (15:53 +0300)]
tc/pedit: Fix a typo in pedit usage message

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agoiplink: whitespace cleanup
Stephen Hemminger [Mon, 1 May 2017 16:12:27 +0000 (09:12 -0700)]
iplink: whitespace cleanup

Break lines to conform to 80 col guideline.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoiplink: add support for IFLA_CARRIER attribute
Zhang Shengju [Wed, 26 Apr 2017 07:08:39 +0000 (15:08 +0800)]
iplink: add support for IFLA_CARRIER attribute

Add support to set IFLA_CARRIER attribute.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
7 years agoroutel: fix infinite loop in line parser
Michal Kubeček [Thu, 27 Apr 2017 09:43:47 +0000 (11:43 +0200)]
routel: fix infinite loop in line parser

As noticed by one of the few users of routel script, it ends up in an
infinite loop when they pull out the cable from the NIC used for some
route. This is caused by its parser expecting the line of "ip route show"
output consists of "key value" pairs (except for the initial target range),
together with an old trap of Bourne style shells that "shift 2" does
nothing if there is only one argument left. Some keywords, e.g. "linkdown",
are not followed by a value.

Improve the parser to

  (1) only set variables for keywords we care about
  (2) recognize (currently) known keywords without value

This is still far from perfect (and certainly not future proof) but to
fully fix the script, one would probably have to rewrite the logic
completely (and I'm not sure it's worth the effort).

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
7 years agoman: ip-rule.8: Further clarify how to interpret priority value
Phil Sutter [Mon, 24 Apr 2017 15:35:37 +0000 (17:35 +0200)]
man: ip-rule.8: Further clarify how to interpret priority value

Despite the past changes, users seemed to get confused by the seemingly
contradictory relation of priority value and actual rule priority.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoiplink: Expose IFLA_*_FWMARK attributes for supported link types
Craig Gallek [Fri, 21 Apr 2017 18:14:53 +0000 (14:14 -0400)]
iplink: Expose IFLA_*_FWMARK attributes for supported link types

This attribute allows the administrator to adjust the packet marking
attribute of tunnels that support policy based routing.

Signed-off-by: Craig Gallek <kraig@google.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sun, 23 Apr 2017 16:14:35 +0000 (09:14 -0700)]
Merge branch 'master' into net-next

7 years agogre6: fix copy/paste bugs in GREv6 attribute manipulation
Craig Gallek [Fri, 21 Apr 2017 18:14:25 +0000 (14:14 -0400)]
gre6: fix copy/paste bugs in GREv6 attribute manipulation

Fixes: af89576d7a8c("iproute2: GRE over IPv6 tunnel support.")
Signed-off-by: Craig Gallek <kraig@google.com>
7 years agoactions: Add support for user cookies
Jamal Hadi Salim [Sat, 22 Apr 2017 12:36:23 +0000 (08:36 -0400)]
actions: Add support for user cookies

Make use of 128b user cookies

Introduce optional 128-bit action cookie.
Like all other cookie schemes in the networking world (eg in protocols
like http or existing kernel fib protocol field, etc) the idea is to
save user state that when retrieved serves as a correlator. The kernel
_should not_ intepret it. The user can store whatever they wish in the
128 bits.

Sample exercise(showing variable length use of cookie)

.. create an accept action with cookie a1b2c3d4
sudo $TC actions add action ok index 1 cookie a1b2c3d4

.. dump all gact actions..
sudo $TC -s actions ls action gact

    action order 0: gact action pass
     random type none pass val 0
     index 1 ref 1 bind 0 installed 5 sec used 5 sec
    Action statistics:
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 0b 0p requeues 0
    cookie a1b2c3d4

.. bind the accept action to a filter..
sudo $TC filter add dev lo parent ffff: protocol ip prio 1 \
u32 match ip dst 127.0.0.1/32 flowid 1:1 action gact index 1

... send some traffic..
$ ping 127.0.0.1 -c 3
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
7 years agoremove unused header file sysctl.h
Stephen Hemminger [Sat, 22 Apr 2017 00:47:30 +0000 (17:47 -0700)]
remove unused header file sysctl.h

Not referred to in current source tree.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate kernel headers from net-next
Stephen Hemminger [Sat, 22 Apr 2017 00:41:33 +0000 (17:41 -0700)]
update kernel headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoman: add documentation for IPv6 SR commands
David Lebrun [Sat, 15 Apr 2017 10:17:17 +0000 (12:17 +0200)]
man: add documentation for IPv6 SR commands

This patch adds information about seg6 encapsulation in the ip-route
manual, as well as the ip-sr manual page.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
7 years agoiproute: add support for SR-IPv6 lwtunnel encapsulation
David Lebrun [Sat, 15 Apr 2017 10:17:16 +0000 (12:17 +0200)]
iproute: add support for SR-IPv6 lwtunnel encapsulation

This patch adds support for SEG6 encapsulation type
("ip route add ... encap seg6 ...").

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
7 years agoip: add ip sr command to control SR-IPv6 internal structures
David Lebrun [Sat, 15 Apr 2017 10:17:15 +0000 (12:17 +0200)]
ip: add ip sr command to control SR-IPv6 internal structures

This patch adds commands to support the tunnel source properties
("ip sr tunsrc") and the HMAC key -> secret, algorithm binding
("ip sr hmac").

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
7 years agoadd seg6.h kernel headers
Stephen Hemminger [Sun, 16 Apr 2017 17:18:53 +0000 (10:18 -0700)]
add seg6.h kernel headers

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoUpdate kernel headers from 4.11 net-next
Stephen Hemminger [Sun, 16 Apr 2017 17:18:10 +0000 (10:18 -0700)]
Update kernel headers from 4.11 net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoip vrf: Add command name next to pid
David Ahern [Fri, 14 Apr 2017 23:09:56 +0000 (16:09 -0700)]
ip vrf: Add command name next to pid

'ip vrf pids' is used to list processes bound to a vrf, but it only
shows the pid leaving a lot of work for the user. Add the command
name to the output. With this patch you get the more user friendly:

    $ ip vrf pids mgmt
     1121  ntpd
     1418  gdm-session-wor
     1488  gnome-session
     1491  dbus-launch
     1492  dbus-daemon
     1565  sshd
     ...

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip vrf: Add command name next to pid
David Ahern [Fri, 14 Apr 2017 23:09:56 +0000 (16:09 -0700)]
ip vrf: Add command name next to pid

'ip vrf pids' is used to list processes bound to a vrf, but it only
shows the pid leaving a lot of work for the user. Add the command
name to the output. With this patch you get the more user friendly:

    $ ip vrf pids mgmt
     1121  ntpd
     1418  gdm-session-wor
     1488  gnome-session
     1491  dbus-launch
     1492  dbus-daemon
     1565  sshd
     ...

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip netconf: show all families on dev request
David Ahern [Fri, 24 Mar 2017 02:51:22 +0000 (19:51 -0700)]
ip netconf: show all families on dev request

Currently specifying a device to ip netconf and it dumps only values
for IPv4. Change this to dump data for all families unless a specific
family is given.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip netconf: Show all address families by default in dumps
David Ahern [Fri, 24 Mar 2017 02:51:21 +0000 (19:51 -0700)]
ip netconf: Show all address families by default in dumps

Currently, 'ip netconf' only shows ipv4 and ipv6 netconf settings. If IPv6
is not enabled, the dump ends with
    RTNETLINK answers: Operation not supported

when IPv6 request is attempted. Further, if the mpls_router module is also
loaded a separate request is needed to get MPLS settings.

To make this better going forward, use the new PF_UNSPEC dump all option
if the kernel supports it. If the kernel does not, it sets NLMSG_ERROR and
returns EOPNOTSUPP which is trapped and we fall back to the existing output
to maintain compatibility with existing kernels.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agonetlink: Add flag to suppress print of nlmsg error
David Ahern [Fri, 24 Mar 2017 02:51:20 +0000 (19:51 -0700)]
netlink: Add flag to suppress print of nlmsg error

Allow callers of the dump API to handle nlmsg errors (e.g., an
unsupported feature). Setting RTNL_HANDLE_F_SUPPRESS_NLERR in the
rtnl_handle avoids unnecessary messages to the users in some case.
For example,

  RTNETLINK answers: Operation not supported

when probing for support of a new feature.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 14 Apr 2017 22:59:12 +0000 (15:59 -0700)]
Merge branch 'master' into net-next

7 years agonetem: fix out of bounds access in maketable
Stephen Hemminger [Wed, 12 Apr 2017 17:10:44 +0000 (10:10 -0700)]
netem: fix out of bounds access in maketable

The maketable program used to generate one of the configuration
files at build time for netem would access past the end of the array
for one input value. This is a bug inherited from original NISTnet.
Just fold the value, like other code there.

This is not a runtime error security problem.
It only impacts the build process if the build machine
had extra hardening enabled.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoiproute: Add support for MPLS LWT ttl attribute
Robert Shearman [Tue, 11 Apr 2017 08:37:21 +0000 (09:37 +0100)]
iproute: Add support for MPLS LWT ttl attribute

Add support for setting and displaying the ttl attribute
for MPLS IP lighweight tunnels.

Signed-off-by: Robert Shearman <rshearma@brocade.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoiproute: Add support for ttl-propagation attribute
Robert Shearman [Tue, 11 Apr 2017 08:37:20 +0000 (09:37 +0100)]
iproute: Add support for ttl-propagation attribute

Add support for setting and displaying the ttl-propagation attribute
initially used by MPLS to control propagation of MPLS TTL to IPv4/IPv6
TTL/hop-limit on popping final label on a per-route basis.

Signed-off-by: Robert Shearman <rshearma@brocade.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 12 Apr 2017 17:02:07 +0000 (10:02 -0700)]
Merge branch 'master' into net-next

7 years agoip-route: Prevent some other double spaces in output
Timothy Redaelli [Wed, 5 Apr 2017 17:10:26 +0000 (19:10 +0200)]
ip-route: Prevent some other double spaces in output

Print spaces only after text.

CC: Phil Sutter <phil@nwl.cc>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
7 years agoupdate kernel headers from net-next
Stephen Hemminger [Tue, 4 Apr 2017 21:57:29 +0000 (14:57 -0700)]
update kernel headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 4 Apr 2017 21:56:41 +0000 (14:56 -0700)]
Merge branch 'master' into net-next

7 years agoman: ip-link: Specify min/max values for bridge slave priority and cost
Phil Sutter [Tue, 4 Apr 2017 15:08:43 +0000 (17:08 +0200)]
man: ip-link: Specify min/max values for bridge slave priority and cost

The values are parsed as u16/u32, but kernel limits allowed values.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoip: link: Add missing link type help texts
Phil Sutter [Tue, 28 Mar 2017 21:19:39 +0000 (23:19 +0200)]
ip: link: Add missing link type help texts

These are basically stubs: The types which lacked their own help text
simply don't accept any options (yet). Still it might be a bit confusing
to users if they are presented with the generic 'ip link' help text
instead of something saying there are no type specific options.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoip: link: Unify link type help functions a bit
Phil Sutter [Tue, 28 Mar 2017 21:19:38 +0000 (23:19 +0200)]
ip: link: Unify link type help functions a bit

Take help function in iplink_bridge.c as an example and make other link
types' help functions similar:

* Use a single fprintf() call (if possible).
* Don't state a full command line, just "... type OPTIONS".
* Put every option in it's own line, align options by column.
* List mandatory options first.

link_veth.c is intentionally left untouched because it's 'peer' option
eats all kinds of generic link options and the help text points this out
without duplicating all the options there again.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoip: link: macvlan: Add newline to help output
Phil Sutter [Tue, 28 Mar 2017 21:19:37 +0000 (23:19 +0200)]
ip: link: macvlan: Add newline to help output

A newline between synopsis and variable definition looks nice and is
consistent with others.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoip: link: bond: Fix whitespace in help text
Phil Sutter [Tue, 28 Mar 2017 21:19:36 +0000 (23:19 +0200)]
ip: link: bond: Fix whitespace in help text

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoman: ip-link.8: document bridge options
Sabrina Dubroca [Tue, 28 Mar 2017 15:56:48 +0000 (17:56 +0200)]
man: ip-link.8: document bridge options

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agotc: print skbedit action when dumping actions.
Roman Mashak [Wed, 22 Mar 2017 18:00:31 +0000 (14:00 -0400)]
tc: print skbedit action when dumping actions.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
7 years agoman: fix man page warnings
Alexander Alemayhu [Sun, 26 Mar 2017 19:11:14 +0000 (21:11 +0200)]
man: fix man page warnings

While generating PDFs from the man pages, I saw the warning below from
several files. Compared the tc-matchall.8 with bridge.8 and used .RI
instead of .R. It should have no effect on the man page rendering.

    `R' is a string (producing the registered sign), not a macro.

Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
7 years agoupdate headers from net-next (post 4.11-rc3)
Stephen Hemminger [Mon, 20 Mar 2017 17:18:50 +0000 (10:18 -0700)]
update headers from net-next (post 4.11-rc3)

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 20 Mar 2017 17:18:17 +0000 (10:18 -0700)]
Merge branch 'master' into net-next

7 years agoupdate headers from 4.11-rc3
Stephen Hemminger [Mon, 20 Mar 2017 17:16:46 +0000 (10:16 -0700)]
update headers from 4.11-rc3

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agovxlan: use preferred address family when neither group or remote is specified
Vincent Bernat [Thu, 9 Mar 2017 20:05:42 +0000 (21:05 +0100)]
vxlan: use preferred address family when neither group or remote is specified

When neither group or remote is specified (or if they are specified with
the any address), nothing is sent to the kernel. In this case, the
kernel defaults to IPv4. This makes impossible to use IPv6 with
unspecified unicast remote ("bridge fdb add" will return
EAFNOTSUPPORT).

If the user specifies a preferred address family (eg, "ip -6 link add"),
then send either IFLA_VXLAN_GROUP or IFLA_VXLAN_GROUP6 to enforce the
use of the appropriate family.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
7 years agoip route: Add missing space between nexthop and via for mpls multipath routes
David Ahern [Fri, 17 Mar 2017 23:39:14 +0000 (16:39 -0700)]
ip route: Add missing space between nexthop and via for mpls multipath routes

MPLS multipath routes are missing a space between 'nexthop' and 'via':

$ ip -net ns1 -f mpls ro ls
100
nexthopvia inet 172.16.2.2  dev virt12
nexthopvia inet 172.16.3.2  dev br0

Add it.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 14 Mar 2017 23:42:59 +0000 (16:42 -0700)]
Merge branch 'master' into net-next

7 years agoman: add examples to ip.8
Alexander Alemayhu [Sun, 12 Mar 2017 20:41:16 +0000 (21:41 +0100)]
man: add examples to ip.8

Having some examples in the top level man page might make it a little bit easier
for new users to get started. Reused some words / sentences from the existing
man pages.

Suggested-by: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
7 years agoiproute2: add support for invisible qdisc dumping
Jiri Kosina [Wed, 8 Mar 2017 12:04:42 +0000 (13:04 +0100)]
iproute2: add support for invisible qdisc dumping

Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking
kernel to perform 'full qdisc dump', as for historical reasons some of the
default qdiscs are being hidden by the kernel.

The command syntax is being extended by voluntary 'invisible' argument to
'tc qdisc show'.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
7 years agoupdate headers from net-next
Stephen Hemminger [Tue, 14 Mar 2017 23:36:15 +0000 (16:36 -0700)]
update headers from net-next

Get TCA_DUMP_INVISIBLE and SCTP changes.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate kernel headers from net-next
Stephen Hemminger [Mon, 13 Mar 2017 15:31:58 +0000 (08:31 -0700)]
update kernel headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate headers from 4.11-rc2
Stephen Hemminger [Mon, 13 Mar 2017 15:30:39 +0000 (08:30 -0700)]
update headers from 4.11-rc2

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoman: Fix formatting of vrf parameter of ip-link show command
Robert Shearman [Thu, 9 Mar 2017 12:56:14 +0000 (12:56 +0000)]
man: Fix formatting of vrf parameter of ip-link show command

Add missing opening " [" for the vrf parameter.

Signed-off-by: Robert Shearman <rshearma@brocade.com>
7 years agopie: remove always false condition
Stephen Hemminger [Fri, 10 Mar 2017 16:56:51 +0000 (08:56 -0800)]
pie: remove always false condition

When built with GCC warnings enabled:
q_pie.c: In function ‘pie_parse_opt’:
q_pie.c:78:38: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (alpha > ALPHA_MAX) || (alpha < ALPHA_MIN)) {
                                      ^
q_pie.c:85:35: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (beta > BETA_MAX) || (beta < BETA_MIN)) {
                                   ^

This is because MIN is 0 and unsigned number can never be less than 0.
Therefore just remove the _MIN values.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoiplink: add support for afstats subcommand
Robert Shearman [Thu, 9 Mar 2017 12:43:36 +0000 (12:43 +0000)]
iplink: add support for afstats subcommand

Add support for new afstats subcommand. This uses the new
IFLA_STATS_AF_SPEC attribute of RTM_GETSTATS messages to show
per-device, AF-specific stats. At the moment the kernel only supports
MPLS AF stats, so that is all that's implemented here.

The print_num function is exposed from ipaddress.c to be used for
printing the new stats so that the human-readable option, if set, can
be respected.

Example of use:

    $ ./ip/ip -f mpls link afstats dev eth1
    3: eth1
        mpls:
            RX: bytes  packets  errors  dropped  noroute
            9016       98       0       0        0
            TX: bytes  packets  errors  dropped
            7232       113      0       0

Signed-off-by: Robert Shearman <rshearma@brocade.com>
7 years agoman: ss.8: Add missing protocols to description of -A
Phil Sutter [Thu, 9 Mar 2017 16:07:33 +0000 (17:07 +0100)]
man: ss.8: Add missing protocols to description of -A

The list was missing dccp and sctp protocols.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agodevlink: Add json and pretty options to help and man
Roi Dayan [Mon, 6 Mar 2017 09:06:18 +0000 (11:06 +0200)]
devlink: Add json and pretty options to help and man

While at it also fixed missing double dash for long opts.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
7 years agobpf: test for valid type in bpf_get_work_dir
Daniel Borkmann [Mon, 6 Mar 2017 12:06:00 +0000 (13:06 +0100)]
bpf: test for valid type in bpf_get_work_dir

Jan-Erik reported an assertion in bpf_prog_to_subdir() failed where
type was BPF_PROG_TYPE_UNSPEC, which is only used in bpf_init_env()
to auto-mount and cache the bpf fs mount point.

Therefore, make sure when bpf_init_env() is called multiple times
(f.e. eBPF classifier with eBPF action attached) and bpf_mnt_cached
is set already that the type is also valid. In bpf_init_env(), we're
only interested in the mount point and not a type-specific subdir.

Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib")
Reported-by: Jan-Erik Rediger <janerik@rediger.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agocolor: use "light" colors for dark background
Petr Vorel [Wed, 1 Mar 2017 20:52:33 +0000 (21:52 +0100)]
color: use "light" colors for dark background

COLORFGBG environment variable is used to detect dark background.

Idea and a bit of code is borrowed from Vim, thanks.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agobpf: remove unnecessary cast
Stephen Hemminger [Fri, 24 Feb 2017 23:24:42 +0000 (15:24 -0800)]
bpf: remove unnecessary cast

No need to cast RTA_DATA

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agotc: use rta_getattr_u32
Stephen Hemminger [Fri, 24 Feb 2017 23:24:05 +0000 (15:24 -0800)]
tc: use rta_getattr_u32

Don't cast RTA_DATA use newish accessors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoxfrm: remove unnecessary casts
Stephen Hemminger [Fri, 24 Feb 2017 23:22:42 +0000 (15:22 -0800)]
xfrm: remove unnecessary casts

Since RTA_DATA() returns void * no need to cast it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoiproute2: tc: introduce build dependency on libnetlink
Jiri Kosina [Fri, 24 Feb 2017 17:28:54 +0000 (18:28 +0100)]
iproute2: tc: introduce build dependency on libnetlink

Rebuilding libnetlink doesn't trigger rebuild of tc, which is wrong
(especially so for builds where libnetlink.a gets statically linked into
tc). Fix that by introducing an explicit dependency.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
7 years agonetlink route attribute cleanup
Stephen Hemminger [Fri, 24 Feb 2017 16:56:38 +0000 (08:56 -0800)]
netlink route attribute cleanup

Use the new helper functions rta_getattr_u* instead of direct
cast of RTA_DATA().  Where RTA_DATA() is a structure, then remove
the unnecessary cast since RTA_DATA() is void *

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years ago{f,m}_bpf: dump tag over insns
Daniel Borkmann [Thu, 23 Feb 2017 12:07:14 +0000 (13:07 +0100)]
{f,m}_bpf: dump tag over insns

We already export TCA_BPF_TAG resp. TCA_ACT_BPF_TAG from kernel commit
f1f7714ea51c ("bpf: rework prog_digest into prog_tag"), thus also dump
it when filter/actions are shown.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agotc: flower: Fix parsing ip address
Roi Dayan [Wed, 22 Feb 2017 14:05:01 +0000 (16:05 +0200)]
tc: flower: Fix parsing ip address

Fix order of arguments when passed to __flower_parse_ip_addr.

Fixes: ("f888f4e20534 tc: flower: Support matching ARP")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agoip: Add support for MPLS netconf
David Ahern [Tue, 21 Feb 2017 17:23:31 +0000 (09:23 -0800)]
ip: Add support for MPLS netconf

Add support for MPLS netconf to ip monitor and ip netconf commands.
Changes to header files not included as those are typically pulled
in my a header sync with the kernel.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoUpdate headers based on 4.11 merge window
Stephen Hemminger [Thu, 23 Feb 2017 16:58:11 +0000 (08:58 -0800)]
Update headers based on 4.11 merge window

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate headers from net-next
Stephen Hemminger [Mon, 20 Feb 2017 16:53:50 +0000 (08:53 -0800)]
update headers from net-next

updated sctp.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoadd missing iplink_xstats.c
Stephen Hemminger [Mon, 20 Feb 2017 16:53:25 +0000 (08:53 -0800)]
add missing iplink_xstats.c

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 20 Feb 2017 16:51:22 +0000 (08:51 -0800)]
Merge branch 'master' into net-next

7 years agov4.10.0
Stephen Hemminger [Mon, 20 Feb 2017 16:47:52 +0000 (08:47 -0800)]
v4.10.0

7 years agodevlink: use DEVLINK_CMD_ESWITCH_* instead of DEVLINK_CMD_ESWITCH_MODE_*
Jiri Pirko [Sun, 19 Feb 2017 14:37:06 +0000 (15:37 +0100)]
devlink: use DEVLINK_CMD_ESWITCH_* instead of DEVLINK_CMD_ESWITCH_MODE_*

Sync with kernel and don't use the obsolete enum values.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agoiplink: bridge_slave: add support for displaying xstats
Nikolay Aleksandrov [Wed, 15 Feb 2017 14:23:13 +0000 (15:23 +0100)]
iplink: bridge_slave: add support for displaying xstats

This patch adds support to the bridge_slave link type for displaying
xstats by reusing the previously added bridge xstats callbacks.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
7 years agoiplink: bridge: add support for displaying xstats
Nikolay Aleksandrov [Wed, 15 Feb 2017 14:23:12 +0000 (15:23 +0100)]
iplink: bridge: add support for displaying xstats

Add support for the new parse/print_ifla_xstats callbacks and use them to
print the per-bridge multicast stats.
Example:
$ ip link xstats type bridge
br0
                    IGMP queries:
                      RX: v1 0 v2 0 v3 0
                      TX: v1 0 v2 0 v3 0
                    IGMP reports:
                      RX: v1 0 v2 0 v3 0
                      TX: v1 0 v2 0 v3 0
                    IGMP leaves: RX: 0 TX: 0
                    IGMP parse errors: 0
                    MLD queries:
                      RX: v1 0 v2 0
                      TX: v1 0 v2 0
                    MLD reports:
                      RX: v1 0 v2 0
                      TX: v1 0 v2 0
                    MLD leaves: RX: 0 TX: 0
                    MLD parse errors: 0

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
7 years agoiplink: add support for xstats subcommand
Nikolay Aleksandrov [Sun, 19 Feb 2017 00:35:32 +0000 (16:35 -0800)]
iplink: add support for xstats subcommand

This patch adds support for a new xstats link subcommand which uses the
specified link type's new parse/print_ifla_xstats callbacks to display
extended statistics.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sun, 19 Feb 2017 00:32:16 +0000 (16:32 -0800)]
Merge branch 'master' into net-next

7 years agodevlink: Call dl_free in early exit case
Leon Romanovsky [Tue, 14 Feb 2017 05:29:38 +0000 (07:29 +0200)]
devlink: Call dl_free in early exit case

Prior to parsing command options, the devlink tool allocates memory
to store results. In case of early exit (wrong parameters or version
check), this memory wasn't freed.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
7 years agoman page: add page for skbmod action
Lucas Bates [Fri, 10 Feb 2017 23:28:54 +0000 (18:28 -0500)]
man page: add page for skbmod action

Signed-off-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sun, 19 Feb 2017 00:21:20 +0000 (16:21 -0800)]
Merge branch 'master' into net-next

7 years agoutils: hex2mem get rid of unnecessary goto
Stephen Hemminger [Sun, 19 Feb 2017 00:17:43 +0000 (16:17 -0800)]
utils: hex2mem get rid of unnecessary goto

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sun, 19 Feb 2017 00:07:32 +0000 (16:07 -0800)]
Merge branch 'master' into net-next

7 years agoupdate headers from 4.10-rc8
Stephen Hemminger [Sun, 19 Feb 2017 00:05:37 +0000 (16:05 -0800)]
update headers from 4.10-rc8

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'merge-4.10' of /tmp/iproute2
Stephen Hemminger [Sun, 19 Feb 2017 00:04:25 +0000 (16:04 -0800)]
Merge branch 'merge-4.10' of /tmp/iproute2

7 years agoMerge branch 'merge-4.10' into next-merge
Stephen Hemminger [Fri, 17 Feb 2017 23:34:24 +0000 (15:34 -0800)]
Merge branch 'merge-4.10' into next-merge

7 years agoip vrf: Detect invalid vrf name in pids command
David Ahern [Thu, 16 Feb 2017 16:58:58 +0000 (08:58 -0800)]
ip vrf: Detect invalid vrf name in pids command

Verify VRF name is valid before attempting to read cgroups files.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip vrf: Handle VRF nesting in namespace
David Ahern [Thu, 16 Feb 2017 16:58:57 +0000 (08:58 -0800)]
ip vrf: Handle VRF nesting in namespace

Since cgroups are not namespace aware, the directory heirarchy used by
ip vrf should account for network namespaces. In this case, change the
path from CGRP/BASE/vrf/NAME to CGRP/BASE/NETNS/vrf/NAME where CGRP is
the cgroup2 mount path, BASE in any base heirarchy inherited before VRF
is applied and NAME is the VRF name.

The intent is as follows: a user logs into the box into some namespace
with a name known to iproute2. Some other policy may have put the
process into a BASE heirarchy. From there the user executes a task in
a VRF and in doing so the task heirarchy becomes CGRP/BASE/NETNS/vrf/NAME.
The namespace level is omitted for the default namespace.

Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip netns: refactor netns_identify
David Ahern [Thu, 16 Feb 2017 16:58:56 +0000 (08:58 -0800)]
ip netns: refactor netns_identify

Move guts of netns_identify into a standalone function that returns
the netns name in a given buffer.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoip vrf: Handle vrf in a cgroup hierarchy
David Ahern [Thu, 16 Feb 2017 16:58:55 +0000 (08:58 -0800)]
ip vrf: Handle vrf in a cgroup hierarchy

Add support for VRF in a pre-existing hierarchy. For example, if the
current process is running in CGRP/foo/bar, the 'ip vrf exec NAME CMD'
should run CMD in the cgroup CGRP/foo/bar/vrf/NAME.

When listing process ids in a VRF, search for the directory vrf/NAME
regardless of base path (foo/bar/vrf/NAME and vrf/NAME) are still
running against the same vrf NAME.

Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
7 years agoMerge branch 'merge-4.10' into next-merge
Stephen Hemminger [Fri, 17 Feb 2017 23:32:28 +0000 (15:32 -0800)]
Merge branch 'merge-4.10' into next-merge

7 years agotc: flower: support masked ICMP code and type match
Simon Horman [Thu, 9 Feb 2017 13:49:01 +0000 (14:49 +0100)]
tc: flower: support masked ICMP code and type match

Extend ICMP code and type match to support masks.

Also add missing documentation to synopsis in manpage.

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

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: provide generic masked u8 print helper
Simon Horman [Thu, 9 Feb 2017 13:49:00 +0000 (14:49 +0100)]
tc: flower: provide generic masked u8 print helper

Provide generic masked u8 print helper and use it to print arp operations.

Also:
* Make name parameter of arp op print helper const.
* Consistently use __u8 rather than uint8_t, in keeping with the
  pervasive style in the file.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: flower: provide generic masked u8 parser helper
Simon Horman [Thu, 9 Feb 2017 13:48:59 +0000 (14:48 +0100)]
tc: flower: provide generic masked u8 parser helper

Provide generic masked u8 paser helper and use it to parse arp operations.

Also consistently use __u8 rather than uint8_t, in keeping with the
pervasive style in the file.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agoupdate headers from net-next
Stephen Hemminger [Fri, 17 Feb 2017 23:30:50 +0000 (15:30 -0800)]
update headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into next-merge
Stephen Hemminger [Fri, 17 Feb 2017 23:29:24 +0000 (15:29 -0800)]
Merge branch 'master' into next-merge