]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
6 years agoip route: replace exits with returns
Élie Bouttier [Sat, 22 Jul 2017 22:42:02 +0000 (00:42 +0200)]
ip route: replace exits with returns

This patch replaces exits with returns in ip route
commands.

Allows to continue when invoked with ip -batch.

Signed-off-by: Élie Bouttier <elie@bouttier.eu>
6 years agoiproute2: add support for GRE ignore-df knob
Philip Prindeville [Thu, 20 Jul 2017 19:06:10 +0000 (13:06 -0600)]
iproute2: add support for GRE ignore-df knob

In the presence of firewalls which improperly block ICMP Unreachable
(including Fragmentation Required) messages, Path MTU Discovery is
prevented from working.

The workaround is to handle IPv4 payloads opaquely, ignoring the DF
bit.

Kernel commit 22a59be8b7693eb2d0897a9638f5991f2f8e4ddd ("net: ipv4:
Add ability to have GRE ignore DF bit in IPv4 payloads") is
complemented by this user-space changeset which exposes control of
this setting.

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
6 years agonetns: avoid directory traversal
Matteo Croce [Wed, 19 Jul 2017 22:36:32 +0000 (00:36 +0200)]
netns: avoid directory traversal

ip netns keeps track of created namespaces with bind mounts named
/var/run/netns/<namespace>. No input sanitization is done, allowing creation and
deletion of files relatives to /var/run/netns or, if the path is non existent or
invalid, allows to create "untracked" namespaces (invisible to the tool).

This commit denies creation or deletion of namespaces with names contaning
"/" or matching exactly "." or "..".

Signed-off-by: Matteo Croce <mcroce@redhat.com>
6 years agotc: fix typo in manpage
Matteo Croce [Fri, 7 Jul 2017 13:08:33 +0000 (15:08 +0200)]
tc: fix typo in manpage

Fix a typo in the 'tc' manpage and reword some sentences.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
6 years agobpf: dump id/jited info for cls/act programs
Daniel Borkmann [Mon, 17 Jul 2017 15:18:52 +0000 (17:18 +0200)]
bpf: dump id/jited info for cls/act programs

Make use of TCA_BPF_ID/TCA_ACT_BPF_ID that we exposed and print the ID
of the programs loaded and use the new BPF_OBJ_GET_INFO_BY_FD command
for dumping further information about the program, currently whether
the attached program is jited.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: support loading map in map from obj
Daniel Borkmann [Mon, 17 Jul 2017 15:18:51 +0000 (17:18 +0200)]
bpf: support loading map in map from obj

Add support for map in map in the loader and add a small example program.
The outer map uses inner_id to reference a bpf_elf_map with a given ID
as the inner type. Loading maps is done in three passes, i) all non-map
in map maps are loaded, ii) all map in map maps are loaded based on the
inner_id map spec of a non-map in map with corresponding id, and iii)
related inner maps are attached to the map in map with given inner_idx
key. Pinned objetcs are assumed to be managed externally, so they are
only retrieved from BPF fs.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: remove obsolete samples
Daniel Borkmann [Mon, 17 Jul 2017 15:18:50 +0000 (17:18 +0200)]
bpf: remove obsolete samples

Remove old samples that have been added in pre BPF fs days which were
using file descriptor passing. It's long obsolete and not encouraged
to use this method given BPF fs is the default way like in the other
samples.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoiproute: extend route get for mpls routes
Roopa Prabhu [Fri, 7 Jul 2017 22:08:11 +0000 (15:08 -0700)]
iproute: extend route get for mpls routes

This patch extends route get to support mpls specific
route attributes like RTA_NEWDST.

Input:
RTA_DST - input label
RTA_NEWDST - labels in packet for multipath selection

By default the getroute handler returns matched
nexthop label, via and oif

With fibmatch keyword (RTM_F_FIB_MATCH flag), full matched
route is returned.

example:
$ip -f mpls route show
101
        nexthop as to 102/103 via inet 172.16.2.2 dev virt1-2
        nexthop as to 302/303 via inet 172.16.12.2 dev virt1-12
201
        nexthop as to 202/203 via inet6 2001:db8:2::2 dev virt1-2
        nexthop as to 402/403 via inet6 2001:db8:12::2 dev virt1-12

$ip -f mpls route get 103
RTNETLINK answers: Network is unreachable

$ip -f mpls route get 101
101 as to 102/103 via inet 172.16.2.2 dev virt1-2

$ip -f mpls route get as to 302/303 101
101 as to 302/303 via inet 172.16.12.2 dev virt1-12

$ip -f mpls route get fibmatch 103
RTNETLINK answers: Network is unreachable

$ip -f mpls route get fibmatch 101
101
        nexthop as to 102/103 via inet 172.16.2.2 dev virt1-2
        nexthop as to 302/303 via inet 172.16.12.2 dev virt1-12

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
6 years agoremove duplicated #include's
Stephen Hemminger [Wed, 12 Jul 2017 15:27:09 +0000 (08:27 -0700)]
remove duplicated #include's

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoupdate headers to 4.13-rc1
Stephen Hemminger [Wed, 19 Jul 2017 00:16:56 +0000 (17:16 -0700)]
update headers to 4.13-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 5 Jul 2017 16:12:16 +0000 (09:12 -0700)]
Merge branch 'master' into net-next

6 years agov4.12.0
Stephen Hemminger [Wed, 5 Jul 2017 16:07:31 +0000 (09:07 -0700)]
v4.12.0

6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 5 Jul 2017 16:07:30 +0000 (09:07 -0700)]
Merge branch 'master' into net-next

6 years agoiptunnel: add support for mpls/ip to ipip tunnels
Krister Johansen [Sat, 10 Jun 2017 01:31:32 +0000 (18:31 -0700)]
iptunnel: add support for mpls/ip to ipip tunnels

Original-Author: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
6 years agoiptunnel: add support for mpls/ip to sit tunnels
Krister Johansen [Sat, 10 Jun 2017 01:31:31 +0000 (18:31 -0700)]
iptunnel: add support for mpls/ip to sit tunnels

Original-Author: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
6 years agoiptunnel: document mode parameter for sit tunnels
Krister Johansen [Sat, 10 Jun 2017 01:31:30 +0000 (18:31 -0700)]
iptunnel: document mode parameter for sit tunnels

Original-Author: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
6 years agoAdd new man page for tc actions.
Lucas Bates [Tue, 4 Jul 2017 21:40:35 +0000 (17:40 -0400)]
Add new man page for tc actions.

This page is to highlight all operations and options that are
applicable to all tc actions.

Signed-off-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
6 years agotc: updated ife man page.
Roman Mashak [Wed, 28 Jun 2017 17:05:04 +0000 (13:05 -0400)]
tc: updated ife man page.

Explain when skbmark encoding may fail.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
6 years agobpf: allow requesting XDP HW offload
Jakub Kicinski [Tue, 27 Jun 2017 00:23:53 +0000 (17:23 -0700)]
bpf: allow requesting XDP HW offload

Let XDP link set command request that the program be offloaded.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: add xdpdrv for requesting XDP driver mode
Jakub Kicinski [Tue, 27 Jun 2017 00:23:52 +0000 (17:23 -0700)]
bpf: add xdpdrv for requesting XDP driver mode

Allow user to select XDP DRV_MODE flag by using xdpdrv keyword
instead of xdp or xdpgeneric.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: print xdp offloaded mode
Jakub Kicinski [Tue, 27 Jun 2017 00:23:51 +0000 (17:23 -0700)]
bpf: print xdp offloaded mode

Add interpretation of XDP_ATTACHED_HW mode on dump.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: Add support for IFLA_XDP_PROG_ID
Martin KaFai Lau [Wed, 21 Jun 2017 21:29:42 +0000 (14:29 -0700)]
bpf: Add support for IFLA_XDP_PROG_ID

This patch adds support to the newly added IFLA_XDP_PROG_ID.

./ip link show dev eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdpgeneric/id:2 qdisc [...]

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoupdate kernel headers from net-next
Stephen Hemminger [Tue, 27 Jun 2017 23:11:12 +0000 (16:11 -0700)]
update kernel headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 27 Jun 2017 23:10:55 +0000 (16:10 -0700)]
Merge branch 'master' into net-next

6 years agobpf: indicate lderr when bpf_apply_relo_data fails
Daniel Borkmann [Tue, 27 Jun 2017 00:48:36 +0000 (02:48 +0200)]
bpf: indicate lderr when bpf_apply_relo_data fails

When LLVM wrongly generates a rodata relo entry (llvm BZ #33599),
then just bail out instead of probing for prog w/o reloc, which
will fail in this case anyway.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoman: ip-route.8: Mention that lower metric means higher priority
Lukas Braun [Wed, 21 Jun 2017 19:59:45 +0000 (21:59 +0200)]
man: ip-route.8: Mention that lower metric means higher priority

This is quite counter-intuitive when using the 'preference' keyword.

Signed-off-by: Lukas Braun <koomi@moshbit.net>
6 years agoman: Collect names of man pages automatically
Phil Sutter [Tue, 27 Jun 2017 19:00:25 +0000 (21:00 +0200)]
man: Collect names of man pages automatically

As it turned out, forgetting to add a man page to the respective
Makefile when introducing it is a common mistake. Overcome this once and
for all by using $(wildcard) function in Makefiles.

Fixes: 7124942942e53 ("genl: add manpage")
Fixes: 958cd210942c8 ("ifcfg: add manpage")
Fixes: e1b7f883e50de ("man: add documentation for IPv6 SR commands")
Fixes: 1949f82cdf62c ("Introduce ip vrf command")
Fixes: 535194a172d23 ("tipc: add peer remove functionality")
Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agotc: updated tc-u32 man page to reflect skip_sw and skip_hw parameters.
Roman Mashak [Wed, 21 Jun 2017 15:14:22 +0000 (11:14 -0400)]
tc: updated tc-u32 man page to reflect skip_sw and skip_hw parameters.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
6 years agotc: fixed typo in usage text.
Roman Mashak [Mon, 19 Jun 2017 19:52:25 +0000 (15:52 -0400)]
tc: fixed typo in usage text.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
6 years agotc: m_tunnel_key: add csum/nocsum option
Jiri Benc [Wed, 14 Jun 2017 19:30:18 +0000 (21:30 +0200)]
tc: m_tunnel_key: add csum/nocsum option

Allows control of UDP zero checksum.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
6 years agotc: m_tunnel_key: reformat the usage text
Jiri Benc [Wed, 14 Jun 2017 19:29:49 +0000 (21:29 +0200)]
tc: m_tunnel_key: reformat the usage text

Adding new tunnel key fields would cause the usage line overflow 80 chars.
Make the usage text similar to other commands.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
6 years agotc: don't print error message on miss when parsing action with default
Jiri Pirko [Thu, 15 Jun 2017 12:10:51 +0000 (14:10 +0200)]
tc: don't print error message on miss when parsing action with default

In case default control action parsing takes place, it is ok to miss.
So don't print error message.

Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
Reported-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Jiri Benc <jbenc@redhat.com>
6 years agoupdate headers to get TCA_TUNNEL_CSUM
Stephen Hemminger [Fri, 16 Jun 2017 16:06:25 +0000 (09:06 -0700)]
update headers to get TCA_TUNNEL_CSUM

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 16 Jun 2017 16:05:53 +0000 (09:05 -0700)]
Merge branch 'master' into net-next

6 years agoiproute: fix compilation issue with older glibc
David Lebrun [Fri, 16 Jun 2017 13:54:28 +0000 (15:54 +0200)]
iproute: fix compilation issue with older glibc

If a header that includes linux/in6.h is included before
iproute's utils.h, then iproute2 fails to compile on older
glibc versions.

Fixes: e8493916a8ede9970732e33ea52d30b83071f401 ("iproute: add support for SR-IPv6 lwtunnel encapsulation")
Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
6 years agoip neigh: allow flush FAILED neighbour entry
Hangbin Liu [Fri, 16 Jun 2017 03:31:52 +0000 (11:31 +0800)]
ip neigh: allow flush FAILED neighbour entry

After upstream commit 5071034e4af7 ('neigh: Really delete an arp/neigh entry
on "ip neigh delete" or "arp -d"'), we could delete a single FAILED neighbour
entry now. But `ip neigh flush` still skip the FAILED entry.

Move the filter after first round flush so we can flush FAILED entry on fixed
kernel and also do not keep retrying on old kernel.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Thu, 15 Jun 2017 15:32:53 +0000 (08:32 -0700)]
Merge branch 'master' into net-next

6 years agoip: mroute: Add table output to show command
Donald Sharp [Wed, 14 Jun 2017 12:08:12 +0000 (08:08 -0400)]
ip: mroute: Add table output to show command

When the user specifies `table all` or `table 0` to
the `ip mroute show` command we dump the entirety of
the known mroute tables.  Without some sort of
divisor to tell us what table we are looking at
the command is useless.

Add `Table: <vrf name>` to the output of 'ip mroute show table 0'

Follow the convention established by 'ip route show table 0'
for when to display

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
6 years agolink_gre6: really support encaplimit option
Nicolas Dichtel [Wed, 14 Jun 2017 16:45:42 +0000 (18:45 +0200)]
link_gre6: really support encaplimit option

This option is documented in gre6 help, but was not supported.

Fixes: af89576d7a8c ("iproute2: GRE over IPv6 tunnel support.")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
6 years agoxfrm: get #define's from linux includes
Stephen Hemminger [Wed, 14 Jun 2017 17:10:05 +0000 (10:10 -0700)]
xfrm: get #define's from linux includes

Use linux/ipsec.h and linux/in.h to get the definition of IP related
protocols.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoiproute: Remove useless check for nexthop keyword when setting RTA_OIF
Jakub Sitnicki [Wed, 7 Jun 2017 13:23:13 +0000 (15:23 +0200)]
iproute: Remove useless check for nexthop keyword when setting RTA_OIF

When modifying a route we set the RTA_OIF attribute only if a device was
specified with "dev" or "oif" keyword. But for some unknown reason we
earlier alternatively check also for the presence of "nexthop" keyword,
even though it has no effect. So remove the pointless check.

Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
6 years agomore bpf header updates
Stephen Hemminger [Wed, 14 Jun 2017 16:52:44 +0000 (09:52 -0700)]
more bpf header updates

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agobridge: Distinguish between externally learned vs offloaded FDBs
Arkadi Sharshevsky [Mon, 5 Jun 2017 10:07:05 +0000 (12:07 +0200)]
bridge: Distinguish between externally learned vs offloaded FDBs

Distinguish between externally learned vs offloaded FDBs. This is done
in order to indicate that FDBs added by software was successfully
offloaded.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
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>