]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 7 Aug 2017 19:29:19 +0000 (12:29 -0700)]
Merge branch 'master' into net-next

6 years agolib: fix extended ack with and without libmnl
Stephen Hemminger [Mon, 7 Aug 2017 18:43:21 +0000 (11:43 -0700)]
lib: fix extended ack with and without libmnl

The code was always building without libmnl support, so it was
doing nothing.

Fixes: b6432e68ac2f ("iproute: Add support for extended ack to rtnl_talk")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoactions: update the man page to describe the "since" time filter
Jamal Hadi Salim [Wed, 2 Aug 2017 11:46:27 +0000 (07:46 -0400)]
actions: update the man page to describe the "since" time filter

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
6 years agotc actions: Improved batching and time filtered dumping
Jamal Hadi Salim [Wed, 2 Aug 2017 11:46:26 +0000 (07:46 -0400)]
tc actions: Improved batching and time filtered dumping

dump more than TCA_ACT_MAX_PRIO actions per batch when the kernel
supports it.

Introduced keyword "since" for time based filtering of actions.
Some example (we have 400 actions bound to 400 filters); at
installation time. Using updated when tc setting the time of
interest to 120 seconds earlier (we see 400 actions):
prompt$ hackedtc actions ls action gact since 120000| grep index | wc -l
400

go get some coffee and wait for > 120 seconds and try again:

prompt$ hackedtc actions ls action gact since 120000 | grep index | wc -l
0

Lets see a filter bound to one of these actions:
....
filter pref 10 u32
filter pref 10 u32 fh 800: ht divisor 1
filter pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10  (rule hit 2 success 1)
  match 7f000002/ffffffff at 12 (success 1 )
    action order 1: gact action pass
     random type none pass val 0
     index 23 ref 2 bind 1 installed 1145 sec used 802 sec
    Action statistics:
    Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 0b 0p requeues 0
...

that coffee took long, no? It was good.

Now lets ping -c 1 127.0.0.2, then run the actions again:
prompt$ hackedtc actions ls action gact since 120 | grep index | wc -l
1

More details please:
prompt$ hackedtc -s actions ls action gact since 120000

    action order 0: gact action pass
     random type none pass val 0
     index 23 ref 2 bind 1 installed 1270 sec used 30 sec
    Action statistics:
    Sent 168 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 0b 0p requeues 0

And the filter?
filter pref 10 u32
filter pref 10 u32 fh 800: ht divisor 1
filter pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10  (rule hit 4 success 2)
  match 7f000002/ffffffff at 12 (success 2 )
    action order 1: gact action pass
     random type none pass val 0
     index 23 ref 2 bind 1 installed 1324 sec used 84 sec
    Action statistics:
    Sent 168 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 0b 0p requeues 0

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 4 Aug 2017 20:16:47 +0000 (13:16 -0700)]
Merge branch 'master' into net-next

6 years agonetns: make /var/run/netns bind-mount recursive
Casey Callendrello [Tue, 1 Aug 2017 15:46:09 +0000 (17:46 +0200)]
netns: make /var/run/netns bind-mount recursive

When ip netns {add|delete} is first run, it bind-mounts /var/run/netns
on top of itself, then marks it as shared. However, if there are already
bind-mounts in the directory from other tools, these would not be
propagated. Fix this by recursively bind-mounting.

Signed-off-by: Casey Callendrello <casey.callendrello@coreos.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 4 Aug 2017 19:05:31 +0000 (12:05 -0700)]
Merge branch 'master' into net-next

6 years agoss: enclose IPv6 address in brackets
Stephen Hemminger [Fri, 4 Aug 2017 19:02:41 +0000 (12:02 -0700)]
ss: enclose IPv6 address in brackets

Based on patch by Lehner Florian <dev@der-flo.net>

Adds support for RFC2732 IPv6 address format with brackets.

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

6 years agoiproute: Add support for extended ack to rtnl_talk
Stephen Hemminger [Fri, 4 Aug 2017 16:52:15 +0000 (09:52 -0700)]
iproute: Add support for extended ack to rtnl_talk

Add support for extended ack error reporting via libmnl.
Add a new function rtnl_talk_extack that takes a callback as an input
arg. If a netlink response contains extack attributes, the callback is
is invoked with the the err string, offset in the message and a pointer
to the message returned by the kernel.

If iproute2 is built without libmnl, it will still work but
extended error reports from kernel will not be available.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoiproute: Display offload indication per-nexthop
Ido Schimmel [Thu, 3 Aug 2017 06:13:55 +0000 (09:13 +0300)]
iproute: Display offload indication per-nexthop

Since kernel commit 475abbf1ef67 ("ipv4: fib: Set offload indication
according to nexthop flags") offload indication is reported on a
per-nexthop basis.

Adjust iproute2 to display it.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
6 years agoupdate headers from 4.13 net-next
Stephen Hemminger [Thu, 3 Aug 2017 23:12:19 +0000 (16:12 -0700)]
update headers from 4.13 net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Thu, 3 Aug 2017 23:11:22 +0000 (16:11 -0700)]
Merge branch 'master' into net-next

6 years agotc: fix m_simple usage
Stephen Hemminger [Thu, 3 Aug 2017 23:10:18 +0000 (16:10 -0700)]
tc: fix m_simple usage

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agotc-simple: Fix documentation
Phil Sutter [Thu, 3 Aug 2017 15:00:51 +0000 (17:00 +0200)]
tc-simple: Fix documentation

- CONTROL has to come last, otherwise 'index' applies to gact and not
  simple itself.
- Man page wasn't updated to reflect syntax changes.

Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agoReally fix get_addr() and get_prefix() error messages
Phil Sutter [Tue, 1 Aug 2017 16:36:11 +0000 (18:36 +0200)]
Really fix get_addr() and get_prefix() error messages

Both functions take the desired address family as a parameter. So using
that to notify the user what address family was expected is correct,
unlike using dst->family which will tell the user only what address
family was specified.

The situation which commit 334af76143368 tried to fix was when 'ip'
would accept addresses from multiple families. In that case, the family
parameter is set to AF_UNSPEC so that get_addr_1() may accept any valid
address.

This patch introduces a wrapper around family_name() which returns the
string "any valid" for AF_UNSPEC instead of the three question marks
unsuitable for use in error messages.

Tests for AF_UNSPEC:

| # ip a a 256.10.166.1/24 dev d0
| Error: any valid prefix is expected rather than "256.10.166.1/24".

| # ip neighbor add proxy 2001:db8::g dev d0
| Error: any valid address is expected rather than "2001:db8::g".

Tests for explicit address family:

| # ip -6 addrlabel add prefix 1.1.1.1/24 label 123
| Error: inet6 prefix is expected rather than "1.1.1.1/24".

| # ip -4 addrlabel add prefix dead:beef::1/24 label 123
| Error: inet prefix is expected rather than "dead:beef::1/24".

Reported-by: Jaroslav Aster <jaster@redhat.com>
Fixes: 334af76143368 ("fix get_addr() and get_prefix() error messages")
Signed-off-by: Phil Sutter <phil@nwl.cc>
6 years agoupdate headers from 4.13-rc4
Stephen Hemminger [Thu, 3 Aug 2017 22:57:26 +0000 (15:57 -0700)]
update headers from 4.13-rc4

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agobpf: Make bytecode-file reading a little more robust
Phil Sutter [Wed, 2 Aug 2017 12:57:56 +0000 (14:57 +0200)]
bpf: Make bytecode-file reading a little more robust

bpf_parse_string() will now correctly handle:

- Extraneous whitespace,
- OPs on multiple lines and
- overlong file names.

The added feature of allowing to have OPs on multiple lines (like e.g.
tcpdump prints them) is rather a side effect of fixing detection of
malformed bytecode files having random content on a second line, like
e.g.:

| 4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0
| foobar

Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agoip: change flag names to an array
Stephen Hemminger [Fri, 7 Jul 2017 15:37:19 +0000 (08:37 -0700)]
ip: change flag names to an array

For the most of the address flags, use a table of values rather
than open coding every value.  This allows for easier inevitable
expansion of flags.

This also fixes the missing stable-privacy flag.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoUpdate headers from net-next
Stephen Hemminger [Tue, 1 Aug 2017 03:55:14 +0000 (20:55 -0700)]
Update headers from net-next

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 1 Aug 2017 00:05:09 +0000 (17:05 -0700)]
Merge branch 'master' into net-next

6 years agoutils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR
Hangbin Liu [Thu, 27 Jul 2017 09:44:15 +0000 (17:44 +0800)]
utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR

When we get a multicast route, the rtm_type is RTN_MULTICAST, but the
rtm_family may be AF_INET. If we only check the type with RTNL_FAMILY_IPMR,
we will get malformed address. e.g.

+ ip -4 route add multicast 172.111.1.1 dev em1 table main

Before fix:
+ ip route list type multicast table main
multicast ac6f:101:800:400:400:0:3c00:0 dev em1 scope link

After fix:
+ ip route list type multicast table main
multicast 172.111.1.1 dev em1 scope link

Fixes: 56e3eb4c3400 ("ip: route: fix multicast route dumps")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
6 years agonetns: more input validation
Matteo Croce [Tue, 25 Jul 2017 13:30:31 +0000 (15:30 +0200)]
netns: more input validation

ip netns accepts invalid input as namespace name like an empty string or a
string longer than the maximum file name length.
Check that the netns name is not empty and less than or equal to NAME_MAX.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
6 years agogeneve: support for modifying geneve device
Girish Moodalbail [Wed, 26 Jul 2017 02:11:43 +0000 (19:11 -0700)]
geneve: support for modifying geneve device

Ability to change geneve device attributes was added to kernel through
commit 5b861f6baa3a ("geneve: add rtnl changelink support"), however one
cannot do the same through ip-link(8) command.  Changing the allowed
geneve device attributes using 'ip link set <geneve_name> type geneve id
<geneve_id> <allowed_attributes>' currently fails with 'operation not
supported' error.  This patch adds support for it.

Signed-off-by: Girish Moodalbail <girish.moodalbail@oracle.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 25 Jul 2017 18:59:13 +0000 (11:59 -0700)]
Merge branch 'master' into net-next

6 years agobpf: fix mnt path when from env
Daniel Borkmann [Sat, 22 Jul 2017 23:22:19 +0000 (01:22 +0200)]
bpf: fix mnt path when from env

When bpf fs mount path is from env, behavior is currently broken as
we continue to search in default paths, thus fix this up.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
6 years agobpf: improve error reporting around tail calls
Daniel Borkmann [Sat, 22 Jul 2017 23:22:18 +0000 (01:22 +0200)]
bpf: improve error reporting around tail calls

Currently, it's still quite hard to figure out if a prog passed the
verifier, but later gets rejected due to different tail call ownership.
Figure out whether that is the case and provide appropriate error
messages to the user.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
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 agobridge: this patch adds json support for bridge mdb show
Nikhil Gajendrakumar [Fri, 7 Jul 2017 22:24:16 +0000 (15:24 -0700)]
bridge: this patch adds json support for bridge mdb show

This patch adds json output to bridge mdb show

Normal Output:
$ bridge -d -s mdb show
dev br0 port swp3 grp 239.0.0.1 temp  vid 128 172.26
dev br0 port swp3 grp 239.0.0.1 temp  vid 64 172.26
dev br0 port swp2 grp 239.0.0.2 temp  vid 1024 172.26
dev br0 port swp2 grp 239.0.0.2 temp  vid 256 172.26
dev br0 port swp2 grp 239.0.0.2 temp  vid 1 172.26
dev br0 port swp3 grp 239.0.0.1 temp  vid 1 172.26
router ports on br0: swp4    0.00 permanent
router ports on br0: swp5    0.00 permanent

Json Output:
$ bridge -d -s -j mdb show
{
    "mdb": [{
            "dev": "br0",
            "port": "swp3",
            "grp": "239.0.0.1",
            "state": "temp",
            "vid": 128,
            "timer": " 166.74"
        },{
            "dev": "br0",
            "port": "swp3",
            "grp": "239.0.0.1",
            "state": "temp",
            "vid": 64,
            "timer": " 166.74"
        },{
            "dev": "br0",
            "port": "swp2",
            "grp": "239.0.0.2",
            "state": "temp",
            "vid": 1024,
            "timer": " 166.74"
        },{
            "dev": "br0",
            "port": "swp2",
            "grp": "239.0.0.2",
            "state": "temp",
            "vid": 256,
            "timer": " 166.74"
        },{
            "dev": "br0",
            "port": "swp2",
            "grp": "239.0.0.2",
            "state": "temp",
            "vid": 1,
            "timer": " 166.74"
        },{
            "dev": "br0",
            "port": "swp3",
            "grp": "239.0.0.1",
            "state": "temp",
            "vid": 1,
            "timer": " 166.74"
        }
    ],
    "router": {
        "br0": [{
                "port": "swp4",
                "timer": "   0.00",
                "type": "permanent"
            },{
                "port": "swp5",
                "timer": "   0.00",
                "type": "permanent"
            }
        ]
    }
}

Signed-off-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
6 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 19 Jul 2017 00:31:09 +0000 (17:31 -0700)]
Merge branch 'master' into net-next

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 agoupdate kernel headers from net-next
Stephen Hemminger [Tue, 18 Jul 2017 01:32:03 +0000 (18:32 -0700)]
update kernel headers from net-next

Just as net-next merge window opens.

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

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

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

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