]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
7 years agotc: add support for TRAP action
Jiri Pirko [Mon, 5 Jun 2017 14:39:45 +0000 (16:39 +0200)]
tc: add support for TRAP action

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agotc: gact: fix control action parsing
Jiri Pirko [Mon, 5 Jun 2017 14:22:03 +0000 (16:22 +0200)]
tc: gact: fix control action parsing

parse_action_control helper does advancing of the arg inside. So don't
do it outside.

Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agotc: flower: add support for matching on ip tos and ttl
Or Gerlitz [Wed, 7 Jun 2017 12:17:54 +0000 (15:17 +0300)]
tc: flower: add support for matching on ip tos and ttl

Allow users to set flower classifier filter rules which
include matches for ip tos and ttl.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
7 years agoupdate headers from net-next (bpf and tc)
Stephen Hemminger [Thu, 8 Jun 2017 17:56:14 +0000 (10:56 -0700)]
update headers from net-next (bpf and tc)

More BPF and tc_action values.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoip: Add IFLA_EVENT output to ip monitor
Vlad Yasevich [Thu, 1 Jun 2017 15:01:16 +0000 (11:01 -0400)]
ip: Add IFLA_EVENT output to ip monitor

Add IFLA_EVENT output so that event types can be viewed with
'monitor' command.  This gives a little more information for why
a given message was received.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
7 years agoip: extend route get to return matching fib route
Roopa Prabhu [Fri, 2 Jun 2017 04:53:28 +0000 (21:53 -0700)]
ip: extend route get to return matching fib route

Uses newly introduced RTM_GETROUTE flag RTM_F_FIB_MATCH
to return a matching fib route. Introduces 'fibmatch'
keyword to ip route get.

ipv4:
----
$ip route show
default via 192.168.0.2 dev eth0
10.0.14.0/24
        nexthop via 172.16.0.3  dev dummy0 weight 1
        nexthop via 172.16.1.3  dev dummy1 weight 1

$ip route get 10.0.14.2
10.0.14.2 via 172.16.1.3 dev dummy1  src 172.16.1.1
    cache

$ip route get fibmatch 10.0.14.2
10.0.14.0/24
        nexthop via 172.16.0.3  dev dummy0 weight 1
        nexthop via 172.16.1.3  dev dummy1 weight 1

ipv6:
----
$ip -6 route show
2001:db9:100::/120  metric 1024
        nexthop via 2001:db8:2::2  dev dummy0 weight 1
        nexthop via 2001:db8:12::2  dev dummy1 weight 1

$ip -6 route get 2001:db9:100::1
2001:db9:100::1 from :: via 2001:db8:12::2 dev dummy1  \
                src 2001:db8:12::1  metric 1024  pref medium

$ip -6 route get fibmatch 2001:db9:100::1
2001:db9:100::/120  metric 1024
        nexthop via 2001:db8:12::2  dev dummy1 weight 1
        nexthop via 2001:db8:2::2  dev dummy0 weight 1

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: David Ahern <dsahern@gmail.com>
7 years agoupdated headers from net-next
Stephen Hemminger [Mon, 5 Jun 2017 19:31:52 +0000 (12:31 -0700)]
updated headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 5 Jun 2017 19:31:19 +0000 (12:31 -0700)]
Merge branch 'master' into net-next

7 years agoiplink: Update usage in help message
Eli Cohen [Sun, 4 Jun 2017 12:36:48 +0000 (15:36 +0300)]
iplink: Update usage in help message

Add to usage message a description of how to configure Infiniband node
and port GUIDs. Also modify the man page to emphasize the GUIDs are
configured for Infiniband VFs.

Fixes: d91fb3f4c7e4 ("Add support for configuring Infiniband GUIDs")
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
7 years agoip: link add vxcan support
Oliver Hartkopp [Fri, 2 Jun 2017 17:04:47 +0000 (19:04 +0200)]
ip: link add vxcan support

Since commit a8f820a380a2a06 ('can: add Virtual CAN Tunnel driver (vxcan)')
for Linux 4.12 a virtual CAN tunnel driver analogue to veth is available in
Linux.

This patch adds the ability to create vxcan device pairs.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 31 May 2017 00:55:17 +0000 (17:55 -0700)]
Merge branch 'master' into net-next

7 years agoip vrf: Add show command
David Ahern [Sat, 27 May 2017 23:34:50 +0000 (17:34 -0600)]
ip vrf: Add show command

Add show command to list all configured VRF and their table ids.

Signed-off-by: David Ahern <dsahern@gmail.com>
7 years agoip address: Change print_linkinfo_brief to take filter as an input
David Ahern [Sat, 27 May 2017 23:34:49 +0000 (17:34 -0600)]
ip address: Change print_linkinfo_brief to take filter as an input

Change print_linkinfo_brief to take the filter as an input arg.
If the arg is NULL, use the global filter in ipaddress.c.

Signed-off-by: David Ahern <dsahern@gmail.com>
7 years agoip address: Move filter struct to ip_common.h
David Ahern [Sat, 27 May 2017 23:34:48 +0000 (17:34 -0600)]
ip address: Move filter struct to ip_common.h

Move filter struct to ip_common.h as struct link_filter.

Signed-off-by: David Ahern <dsahern@gmail.com>
7 years agoip address: Export ip_linkaddr_list
David Ahern [Sat, 27 May 2017 23:34:47 +0000 (17:34 -0600)]
ip address: Export ip_linkaddr_list

ipaddr_list_flush_or_save generates a list of nlmsg's for links and
optionally for addresses. Move the code into ip_linkaddr_list and
export it along with the supporting infrastructure.

API to use this function is:
        struct nlmsg_chain linfo = { NULL, NULL};
        struct nlmsg_chain ainfo = { NULL, NULL};

        ip_linkaddr_list(family, filter_req, &linfo, &ainfo);

        ... error checking and code looping over linfo/ainfo ...

        free_nlmsg_chain(&linfo);
        free_nlmsg_chain(&ainfo);

Signed-off-by: David Ahern <dsahern@gmail.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 31 May 2017 00:50:47 +0000 (17:50 -0700)]
Merge branch 'master' into net-next

7 years agobpf: dump error to the user when retrieving pinned prog fails
Daniel Borkmann [Sat, 13 May 2017 00:32:35 +0000 (02:32 +0200)]
bpf: dump error to the user when retrieving pinned prog fails

I noticed we currently don't dump an error message when a pinned
program couldn't be retrieved, thus add a hint to the user.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agobpf: update printing of generic xdp mode
Daniel Borkmann [Sat, 13 May 2017 00:32:34 +0000 (02:32 +0200)]
bpf: update printing of generic xdp mode

Follow-up to d67b9cd28c1d ("xdp: refine xdp api with regards to
generic xdp") in order to update the XDP dumping part.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agotc: flower: add support for tcp flags
Jiri Pirko [Tue, 23 May 2017 21:51:39 +0000 (23:51 +0200)]
tc: flower: add support for tcp flags

Allow user to insert a flower classifier filter rule which includes
match for tcp flags.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 31 May 2017 00:40:57 +0000 (17:40 -0700)]
Merge branch 'master' into net-next

7 years agoip: add handling for new CAN netlink interface
Remigiusz Kołłątaj [Fri, 19 May 2017 12:54:49 +0000 (14:54 +0200)]
ip: add handling for new CAN netlink interface

This patch adds handling for new CAN netlink interface introduced in
4.11 kernel:
- IFLA_CAN_TERMINATION,
- IFLA_CAN_TERMINATION_CONST,
- IFLA_CAN_BITRATE_CONST,
- IFLA_CAN_DATA_BITRATE_CONST

Output example:
$ip -d link show can0
6: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state STOPPED (berr-counter tx 0 rx 0) restart-ms 0
          bitrate 80000
             [   20000,    33333,    50000,    80000,    83333,   100000,
                125000,   150000,   175000,   200000,   225000,   250000,
                275000,   300000,   500000,   625000,   800000,  1000000 ]
          termination 0 [ 0, 120 ]
          clock 0numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Signed-off-by: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>
7 years agotc: m_xt: Prevent a segfault in libipt
Phil Sutter [Tue, 23 May 2017 13:40:57 +0000 (15:40 +0200)]
tc: m_xt: Prevent a segfault in libipt

This happens with NAT targets, such as SNAT, DNAT and MASQUERADE. These
are still not usable with this patch, but at least tc doesn't crash
anymore when one tries to use them.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agodevlink: Add option to set and show eswitch encapsulation support
Roi Dayan [Sun, 21 May 2017 05:37:27 +0000 (08:37 +0300)]
devlink: Add option to set and show eswitch encapsulation support

This is an e-switch global knob to enable HW support for applying
encapsulation/decapsulation to VF traffic as part of SRIOV e-switch offloading.

The actual encap/decap is carried out (along with the matching and other
actions) per offloaded e-switch rules, e.g as done when offloading the TC tunnel
key action.

Possible values are enable/disable.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
7 years agonetlink: Change rtnl_dump_done to always show error
David Ahern [Tue, 16 May 2017 21:22:46 +0000 (14:22 -0700)]
netlink: Change rtnl_dump_done to always show error

The original code which became rtnl_dump_done only shows netlink errors
if the protocol is NETLINK_SOCK_DIAG, but netlink dumps always appends
the length which contains any error encountered during the dump. Update
rtnl_dump_done to always show the error if there is one.

As an *example* without this patch, dumping a route object that exceeds
the internal buffer size terminates with no message to the user -- the
dump just ends because the NLMSG_DONE attribute was received. With this
patch the user at least gets a message that the dump was aborted.

$ ip ro ls
default via 10.0.2.2 dev eth0
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
10.10.0.0/16 dev veth1 proto kernel scope link src 10.10.0.1
172.16.1.0/24 dev br0.11 proto kernel scope link src 172.16.1.1
Error: Buffer too small for object
Dump terminated

The point of this patch is to notify the user of a failure versus
silently exiting on a partial dump. Because the NLMSG_DONE attribute
was received, the entire dump needs to be restarted to use a larger
buffer for EMSGSIZE errors. That could be done automatically but it
has other user impacts (e.g., duplicate output if the dump is
restarted) and should be the subject of a different patch.

Signed-off-by: David Ahern <dsahern@gmail.com>
7 years agoip: include libc headers first
Baruch Siach [Mon, 22 May 2017 13:27:53 +0000 (16:27 +0300)]
ip: include libc headers first

Including libc headers first helps as a workaround to redefinition of struct
ethhdr with a suitably patched musl libc that suppresses the kernel
if_ether.h.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
7 years agoupdate headers to get IFLA_EVENT
Stephen Hemminger [Tue, 30 May 2017 17:13:46 +0000 (10:13 -0700)]
update headers to get IFLA_EVENT

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate headers to get changes for TCA_FLOWER
Stephen Hemminger [Sat, 27 May 2017 00:12:25 +0000 (17:12 -0700)]
update headers to get changes for TCA_FLOWER

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoupdate to current net-next headers
Stephen Hemminger [Sat, 27 May 2017 00:11:02 +0000 (17:11 -0700)]
update to current net-next headers

7 years agotc: fix Makefile to build skbmod
Roman Mashak [Fri, 19 May 2017 17:05:43 +0000 (13:05 -0400)]
tc: fix Makefile to build skbmod

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
7 years agotc/actions: introduce support for goto chain action
Jiri Pirko [Tue, 16 May 2017 17:29:37 +0000 (19:29 +0200)]
tc/actions: introduce support for goto chain action

Allow user to set control action "goto" with filter chain index as
a parameter.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agotc: actions: add helpers to parse and print control actions
Jiri Pirko [Tue, 16 May 2017 17:29:36 +0000 (19:29 +0200)]
tc: actions: add helpers to parse and print control actions

Each tc action is terminated by a control action. Each action parses and
prints then intividually. Introduce set of helpers and allow to share
this code.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agotc_filter: add support for chain index
Jiri Pirko [Tue, 16 May 2017 17:29:35 +0000 (19:29 +0200)]
tc_filter: add support for chain index

Allow user to put filter to a specific chain identified by index.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agoinclude: remove no longer used iptables_common.h
Stephen Hemminger [Mon, 22 May 2017 20:22:22 +0000 (13:22 -0700)]
include: remove no longer used iptables_common.h

Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agotc: include stdint.h explicitly for UINT16_MAX
Khem Raj [Sat, 20 May 2017 21:28:46 +0000 (14:28 -0700)]
tc: include stdint.h explicitly for UINT16_MAX

Fixes
| tc_core.c:190:29: error: 'UINT16_MAX' undeclared (first use in this function); did you mean '__INT16_MAX__'?
|    if ((sz >> s->size_log) > UINT16_MAX) {
|                              ^~~~~~~~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
7 years agoupdate headers from 4.12-rc2
Stephen Hemminger [Mon, 22 May 2017 18:06:29 +0000 (11:06 -0700)]
update headers from 4.12-rc2

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agoip: add support for more MPLS labels
David Ahern [Sun, 14 May 2017 01:27:02 +0000 (19:27 -0600)]
ip: add support for more MPLS labels

Kernel now supports up to 30 labels but not defined as part of the uapi.
iproute2 handles up to 8 labels but in a non-consistent way. Update ip
to handle more labels, but in a more programmatic way.

For the MPLS address family, the data field in inet_prefix is used for
labels.  Increase that field to 64 u32's -- 64 as nothing more than a
convenient power of 2 number.

Update mpls_pton to take the length of the address field, convert that
length to number of labels and add better error handling to the parsing
of the user supplied string.

Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agopedit: Introduce ipv6 support
Amir Vadai [Sun, 14 May 2017 08:17:46 +0000 (11:17 +0300)]
pedit: Introduce ipv6 support

Add support for modifying IPv6 headers using pedit.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agopedit: Check for extended capability in protocol parser
Amir Vadai [Sun, 14 May 2017 08:17:45 +0000 (11:17 +0300)]
pedit: Check for extended capability in protocol parser

Do not allow using eth and udp header types if non-extended pedit kABI
is being used. Other protocol parsers already have this check.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agopedit: Do not allow using retain for too big fields
Amir Vadai [Sun, 14 May 2017 08:17:44 +0000 (11:17 +0300)]
pedit: Do not allow using retain for too big fields

Using retain for fields longer than 32 bits is not supported.
Do not allow user to do it.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agopedit: Fix a typo in warning
Amir Vadai [Sun, 14 May 2017 08:17:43 +0000 (11:17 +0300)]
pedit: Fix a typo in warning

'ex' attribute should be placed after 'action pedit' and not after
'munge'.

Signed-off-by: Amir Vadai <amir@vadai.me>
7 years agovxlan: Add support for modifying vxlan device attributes
Girish Moodalbail [Sat, 6 May 2017 18:37:43 +0000 (11:37 -0700)]
vxlan: Add support for modifying vxlan device attributes

Ability to change vxlan device attributes was added to kernel through
commit 8bcdc4f3a20b ("vxlan: add changelink support"), however one
cannot do the same through ip(8) command.  Changing the allowed vxlan
device attributes using 'ip link set dev <vxlan_name> type vxlan
<allowed_attributes>' currently fails with 'operation not supported'
error.  This failure is due to the incorrect rtnetlink message
construction for the 'ip link set' operation.

The vxlan_parse_opt() callback function is called for parsing options
for both 'ip link add' and 'ip link set'. For the 'add' case, we pass
down default values for those attributes that were not provided as CLI
options. However, for the 'set' case we should be only passing down the
explicitly provided attributes and not any other (default) attributes.

Signed-off-by: Girish Moodalbail <girish.moodalbail@oracle.com>
7 years agoip: mpls: fix printing of mpls labels
David Ahern [Tue, 9 May 2017 06:04:13 +0000 (23:04 -0700)]
ip: mpls: fix printing of mpls labels

If the kernel returns more labels than iproute2 expects, none of
the labels are printed and (null) is shown instead:
    $ ip -f mpls ro ls
    101 as to (null) via inet 172.16.2.2 dev virt12
    201 as to 202/203 via inet6 2001:db8:2::2 dev virt12

Remove the use of MPLS_MAX_LABELS and rely on buffer length that is
passed to mpls_ntop. With this change ip can print the label stack
returned by the kernel up to 255 characters (limit is due to size of
buf passed in) which amounts to 31 labels with a separator.

With this change the above is:
    $ ip/ip -f mpls ro ls
    101 as to 102/103/104/105/106/107/108/109/110 via inet 172.16.2.2 dev virt12

Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agotc: bpf: add ppc64 and sparc64 to list of archs with eBPF support
Alexander Alemayhu [Sat, 6 May 2017 20:30:10 +0000 (22:30 +0200)]
tc: bpf: add ppc64 and sparc64 to list of archs with eBPF support

sparc64 support was added in 7a12b5031c6b (sparc64: Add eBPF JIT., 2017-04-17)[0]
and ppc64 in 156d0e290e96 (powerpc/ebpf/jit: Implement JIT compiler for extended BPF, 2016-06-22)[1].

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=7a12b5031c6b
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=156d0e290e96
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
7 years agotc: Reflect HW offload status
Or Gerlitz [Thu, 4 May 2017 13:15:15 +0000 (16:15 +0300)]
tc: Reflect HW offload status

Currently there is no way of querying whether a filter is
offloaded to HW or not when using "both" policy (where none
of skip_sw or skip_hw flags are set by user-space).

Add two new flags, "in hw" and "not in hw" such that user
space can determine if a filter is actually offloaded to
hw or not. The "in hw" UAPI semantics was chosen so it's
similar to the "skip hw" flag logic.

If none of these two flags are set, this signals running
over older kernel.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
7 years agoupdate kernel headers during 4.12 merge window
Stephen Hemminger [Fri, 5 May 2017 16:48:33 +0000 (09:48 -0700)]
update kernel headers during 4.12 merge window

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agodevlink: Add support for pipeline debug (dpipe)
Arkadi Sharshevsky [Wed, 3 May 2017 11:25:23 +0000 (13:25 +0200)]
devlink: Add support for pipeline debug (dpipe)

Add support for pipeline debug (dpipe). The headers are used both the
gain visibillity into the headers supported by the hardware, and to
build the headers/field database which is used by other commands.

Examples:

First we can see the headers supported by the hardware:

$devlink dpipe header show pci/0000:03:00.0

pci/0000:03:00.0:
  name mlxsw_meta
  field:
    name erif_port bitwidth 32 mapping_type ifindex
    name l3_forward bitwidth 1
    name l3_drop bitwidth 1

Note that mapping_type is presented only if relevant. Also the header/
field id's are reported by the kernel they are not shown by default.
They can be observed by using the -v option. Also the headers scope
(global/local) is specified.

$devlink -v dpipe header show pci/0000:03:00.0

pci/0000:03:00.0:
  name mlxsw_meta id 0 global false
  field:
    name erif_port id 0 bitwidth 32 mapping_type ifindex
    name l3_forward id 1 bitwidth 1
    name l3_drop id 2 bitwidth 1

Second we can examine the tables supported by the hardware. In order
to dump all the tables no table name should be provided:
$devlink dpipe table show pci/0000:03:00.0

In order to examine specific table its name have to be specified:
$devlink dpipe table show pci/0000:03:00.0 name erif

pci/0000:03:00.0:
  name mlxsw_erif size 800 counters_enabled true
  match:
    type field_exact header mlxsw_meta field erif_port mapping ifindex
  action:
    type field_modify header mlxsw_meta field l3_forward
    type field_modify header mlxsw_meta field l3_drop

To enable/disable counters on the table:
$devlink dpipe table set pci/0000:03:00.0 name erif counters enable
$devlink dpipe table set pci/0000:03:00.0 name erif counters disable

In order to see the current entries in the hardware for specific table:
$devlink dpipe table dump pci/0000:03:00.0 name erif

pci/0000:03:00.0:
  index 0 counter 0
  match_value:
    type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 383 value 0
  action_value:
    type field_modify header mlxsw_meta field l3_forward value 1

  index 1 counter 0
  match_value:
    type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 381 value 1
  action_value:
    type field_modify header mlxsw_meta field l3_forward value 1

In the above example the table contains two entries which does match
on erif port and forwards the packet or drop it (currently only the
forward count is implemented). The counter values are provided for
example. In case the counting is not enabled on the table the counters
will not be available.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
7 years agodevlink: Change netlink attribute validation
Arkadi Sharshevsky [Wed, 3 May 2017 11:25:22 +0000 (13:25 +0200)]
devlink: Change netlink attribute validation

Currently the netlink attribute resolving is done by a sequence of
if's. Change the attribute resolving to table lookup.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
7 years agoman: ip.8: Document -brief flag
Phil Sutter [Wed, 3 May 2017 09:07:58 +0000 (11:07 +0200)]
man: ip.8: Document -brief flag

Brief output is especially useful for new users, so at least mention
it's existence in ip man page.

Signed-off-by: Phil Sutter <phil@nwl.cc>
7 years agoMerge branch 'net-next'
Stephen Hemminger [Wed, 3 May 2017 16:28:10 +0000 (09:28 -0700)]
Merge branch 'net-next'

7 years agov4.11.0
Stephen Hemminger [Mon, 1 May 2017 16:32:25 +0000 (09:32 -0700)]
v4.11.0

7 years agoip xfrm: Add xfrm state crypto offload
Boris Pismenny [Sun, 30 Apr 2017 14:16:02 +0000 (17:16 +0300)]
ip xfrm: Add xfrm state crypto offload

syntax:
ip xfrm state .... offload dev <if-name> dir <in or out>

Example to add inbound offload:
  ip xfrm state .... offload dev mlx0 dir in
Example to add outbound offload:
  ip xfrm state .... offload dev mlx0 dir out

Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
7 years agobpf: add support for generic xdp
Daniel Borkmann [Fri, 28 Apr 2017 13:44:29 +0000 (15:44 +0200)]
bpf: add support for generic xdp

Follow-up to commit c7272ca72009 ("bpf: add initial support for
attaching xdp progs") to also support generic XDP. This adds an
indicator for loaded generic XDP programs when programs are loaded
as shown in c7272ca72009, but the driver still lacks native XDP
support.

  # ip link
  [...]
  3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdpgeneric qdisc [...]
      link/ether 0c:c4:7a:03:f9:25 brd ff:ff:ff:ff:ff:ff
  [...]

In case the driver does support native XDP, but the user wants
to load the program as generic XDP (e.g. for testing purposes),
then this can be done with the same semantics as in c7272ca72009,
but with 'xdpgeneric' instead of 'xdp' command for loading:

  # ip -force link set dev eno1 xdpgeneric obj xdp.o

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: David S. Miller <davem@davemloft.net>
7 years agoupdate headers to 4.11 net-next
Stephen Hemminger [Mon, 1 May 2017 16:27:33 +0000 (09:27 -0700)]
update headers to 4.11 net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
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>