]> git.ipfire.org Git - thirdparty/iproute2.git/log
thirdparty/iproute2.git
9 years agolibnetlink: Double the dump buffer size
Phil Sutter [Fri, 4 Mar 2016 18:57:28 +0000 (19:57 +0100)] 
libnetlink: Double the dump buffer size

There have been reports about 'ip addr' printing "Message truncated" on
systems with large numbers of VFs. Although I haven't been able to get
my hands on hardware suitable to reproduce this, increasing the dump
buffer has been reported to resolve the issue. For want of a better
idea, just double the buffer size to 32k.

Feels like this opportunistic buffer size selection is rather
workarounding a design flaw in libnetlink or maybe even the netlink
protocol itself.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoifstat, nstat: fix daemon mode
Phil Sutter [Wed, 2 Mar 2016 15:56:27 +0000 (16:56 +0100)] 
ifstat, nstat: fix daemon mode

Since the relevant code (and it's bugs) is identical in both files, fix
them in one go. This patch fixes multiple issues:

* Using 'int' for the 'tdiff' variable does not suffice on 64bit
  systems, the assigned initial time difference makes it wrap and
  contain a negative value afterwards. Instead use the more appropriate
  'time_t' type.

* As far as I understood the code, poll() is supposed to time out just
  at the right time to trigger update_db() in the configured interval.
  Therefore it's timeout must be set to the desired interval *minus* the
  time that has already passed since then.

* With the last change to the algorithm in place, it does not make sense
  to call update_db() before returning data to the connected client.
  Actually, it never does otherwise we could skip the periodic updates
  in the first place.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agodoc: Add my article about tc, filters and actions
Phil Sutter [Fri, 4 Mar 2016 12:11:47 +0000 (13:11 +0100)] 
doc: Add my article about tc, filters and actions

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipneigh: List all nud states in help output
Phil Sutter [Fri, 4 Mar 2016 19:07:21 +0000 (20:07 +0100)] 
ipneigh: List all nud states in help output

To not make the output overly confusing, list them in a definition of
the STATE placeholder which is already used in the show/flush syntax but
wasn't explained before.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-neighbour.8: Document all known nud states
Phil Sutter [Fri, 4 Mar 2016 19:07:20 +0000 (20:07 +0100)] 
man: ip-neighbour.8: Document all known nud states

Not sure how useful they are in practice, but as 'ip neigh' supports
setting them all, they deserve to be described as well.

While at it, also add a missing layer of indentation to the subordinate
nud state list.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agodoc, man: ip-rule: Remove incorrect statement about rule 0
Phil Sutter [Fri, 4 Mar 2016 11:52:41 +0000 (12:52 +0100)] 
doc, man: ip-rule: Remove incorrect statement about rule 0

The documentation is wrong here: it is indeed possible to remove policy
rule 0 and recreate it afterwards. Therefore remove these statements.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-route: Make synopsis consistent with description
Phil Sutter [Fri, 4 Mar 2016 11:52:40 +0000 (12:52 +0100)] 
man: ip-route: Make synopsis consistent with description

While the synopsis section contains 'ip route list', it is later
described as 'ip route show'. Make this consistent by replacing 'list'
with 'show' in synopsis.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agotc: pedit: document branch control in help output
Phil Sutter [Fri, 4 Mar 2016 11:52:37 +0000 (12:52 +0100)] 
tc: pedit: document branch control in help output

This seems to have been a hidden feature, though it's very useful and
necessary at least when combining multiple pedit actions.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-link: Beef up VXLAN csum options a bit
Phil Sutter [Fri, 4 Mar 2016 11:52:38 +0000 (12:52 +0100)] 
man: ip-link: Beef up VXLAN csum options a bit

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: tc-u32: Minor syntax fix
Phil Sutter [Fri, 4 Mar 2016 11:52:39 +0000 (12:52 +0100)] 
man: tc-u32: Minor syntax fix

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ship action man pages
Phil Sutter [Fri, 4 Mar 2016 12:11:46 +0000 (13:11 +0100)] 
man: ship action man pages

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the xt action
Phil Sutter [Fri, 4 Mar 2016 12:11:45 +0000 (13:11 +0100)] 
man: Add a man page for the xt action

Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the vlan action
Phil Sutter [Fri, 4 Mar 2016 12:11:44 +0000 (13:11 +0100)] 
man: Add a man page for the vlan action

Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the skbedit action
Phil Sutter [Fri, 4 Mar 2016 12:11:43 +0000 (13:11 +0100)] 
man: Add a man page for the skbedit action

Cc: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the simple action
Phil Sutter [Fri, 4 Mar 2016 12:11:42 +0000 (13:11 +0100)] 
man: Add a man page for the simple action

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the police action
Phil Sutter [Fri, 4 Mar 2016 12:11:41 +0000 (13:11 +0100)] 
man: Add a man page for the police action

Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the pedit action
Phil Sutter [Fri, 4 Mar 2016 12:11:40 +0000 (13:11 +0100)] 
man: Add a man page for the pedit action

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the nat action
Phil Sutter [Fri, 4 Mar 2016 12:11:39 +0000 (13:11 +0100)] 
man: Add a man page for the nat action

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the mirred action
Phil Sutter [Fri, 4 Mar 2016 12:11:38 +0000 (13:11 +0100)] 
man: Add a man page for the mirred action

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the csum action.
Phil Sutter [Fri, 4 Mar 2016 12:11:37 +0000 (13:11 +0100)] 
man: Add a man page for the csum action.

Cc: Gregoire Baron <baronchon@n7mm.org>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: Add a man page for the connmark action
Phil Sutter [Fri, 4 Mar 2016 12:11:36 +0000 (13:11 +0100)] 
man: Add a man page for the connmark action

Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-*.8: drop any reference to generic ip options
Phil Sutter [Wed, 2 Mar 2016 18:20:08 +0000 (19:20 +0100)] 
man: ip-*.8: drop any reference to generic ip options

Listing generic 'ip' options in subcommand man pages is redundant and
error-prone, as they won't be kept in sync anyway. Since many other man
pages don't list them either, drop references to them in the remaining
ones.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-l2tp.8: Fix BNF syntax
Phil Sutter [Wed, 2 Mar 2016 18:20:07 +0000 (19:20 +0100)] 
man: ip-l2tp.8: Fix BNF syntax

The 'ADDR' part of 'local' and 'remote' parameters is not optional, but
may also consist of the word 'any'. While at it, add missing whitespace
and fix fonts.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip.8: Add missing flags and token subcommand description
Phil Sutter [Wed, 2 Mar 2016 18:20:06 +0000 (19:20 +0100)] 
man: ip.8: Add missing flags and token subcommand description

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-xfrm.8: Document missing parameters
Phil Sutter [Wed, 2 Mar 2016 18:20:05 +0000 (19:20 +0100)] 
man: ip-xfrm.8: Document missing parameters

Namely, 'extra-flag' of 'ip xfrm state' and 'flag' of 'ip xfrm policy'.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-tunnel.8: Document missing 6rd action
Phil Sutter [Wed, 2 Mar 2016 18:20:04 +0000 (19:20 +0100)] 
man: ip-tunnel.8: Document missing 6rd action

Also drop the non-terminal 'TIME' description as it is not referenced
anywhere.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-token.8: Review synopsis section
Phil Sutter [Wed, 2 Mar 2016 18:20:03 +0000 (19:20 +0100)] 
man: ip-token.8: Review synopsis section

Drop unnecessary curly braces around single action keywords, point out
that 'dev' parameter to 'ip token get' is optional and clarify that 'ip
token' defaults to 'list' action.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-rule.8: Review synopsis section
Phil Sutter [Wed, 2 Mar 2016 18:20:02 +0000 (19:20 +0100)] 
man: ip-rule.8: Review synopsis section

Clarify that 'ip rule' defaults to action 'list', that 'flush' and
'save' actions don't accept additional parameters, add missing 'not' and
'goto' keywords and finally fix fonts used in 'fwmark' and 'realms'
parameters.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-ntable.8: Review synopsis section
Phil Sutter [Wed, 2 Mar 2016 18:20:01 +0000 (19:20 +0100)] 
man: ip-ntable.8: Review synopsis section

The first line contained a c'n'p error, incorrectly listing 'ip address'
syntax. Since PARAMS is used just once and there are not many other
parameters to 'ip ntable change', state them inline and in addition to
that clarify the possibility to pass multiple parameters at once.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-netns.8: Clarify synopsis a bit
Phil Sutter [Wed, 2 Mar 2016 18:20:00 +0000 (19:20 +0100)] 
man: ip-netns.8: Clarify synopsis a bit

Use brackets to show that 'ip netns' defaults to action 'list', drop
superfluous curly braces around 'set' action keyword.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-neighbour: Fix for missing NUD_STATE description
Phil Sutter [Wed, 2 Mar 2016 18:19:59 +0000 (19:19 +0100)] 
man: ip-neighbour: Fix for missing NUD_STATE description

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-link.8: Fix and improve synopsis
Phil Sutter [Wed, 2 Mar 2016 18:19:58 +0000 (19:19 +0100)] 
man: ip-link.8: Fix and improve synopsis

Reflect that it is possible to pass multiple parameters at the same
time, also use the same trick the help text uses to emphasize vf
specific parameters.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-link.8: minor font fix
Phil Sutter [Wed, 2 Mar 2016 18:19:57 +0000 (19:19 +0100)] 
man: ip-link.8: minor font fix

We commonly use bold font for terminals and italic for non-terminals.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-address.8: Minor syntax fixes
Phil Sutter [Wed, 2 Mar 2016 18:19:56 +0000 (19:19 +0100)] 
man: ip-address.8: Minor syntax fixes

Clarify that the optional '-' prefix of the 'tentative', 'deprecated'
and 'dadfailed' keywords has to be put right in front of them, no
whitespace is allowed in between.

In addition to that, clarify that it is valid to pass both 'valid_lft'
and 'preferred_lft' at the same time to 'ip address'.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiprule: add missing nat keyword to help text
Phil Sutter [Wed, 2 Mar 2016 18:19:55 +0000 (19:19 +0100)] 
iprule: add missing nat keyword to help text

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiproute: TYPE keyword is not optional, fix help text accordingly
Phil Sutter [Wed, 2 Mar 2016 18:19:54 +0000 (19:19 +0100)] 
iproute: TYPE keyword is not optional, fix help text accordingly

This is a bit pedantic, but brackets ([]) show optional values and since
TYPE must not become empty, they're not suited to surround the type
keyword choices. Use curly braces instead.

Also add some missing whitespace to the parameter list above.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipntable: Fix typo in help text
Phil Sutter [Wed, 2 Mar 2016 18:19:53 +0000 (19:19 +0100)] 
ipntable: Fix typo in help text

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipneigh: add missing proxy keyword to help text
Phil Sutter [Wed, 2 Mar 2016 18:19:52 +0000 (19:19 +0100)] 
ipneigh: add missing proxy keyword to help text

And while we're at it, add whitespace around braces and pipe symbol.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: fix help text syntax
Phil Sutter [Wed, 2 Mar 2016 18:19:51 +0000 (19:19 +0100)] 
iplink: fix help text syntax

Get rid of extraneous closing brackets and while here, merge the double
netns parameter.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipaddrlabel: Improve help text precision
Phil Sutter [Wed, 2 Mar 2016 18:19:50 +0000 (19:19 +0100)] 
ipaddrlabel: Improve help text precision

Neither 'list' nor 'flush' actions accept parameters, and with given
prefix the action keyword is not optional anymore.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip: align help text with manpage
Phil Sutter [Wed, 2 Mar 2016 18:19:49 +0000 (19:19 +0100)] 
ip: align help text with manpage

Although the ip command accepts both "neighbor" and "neighbour" as
subcommand, I assume it's sufficient to list it in help text as just
"neigh" like ip.8 does.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipl2tp: Print help even on systems without l2tp support
Phil Sutter [Wed, 24 Feb 2016 08:12:47 +0000 (09:12 +0100)] 
ipl2tp: Print help even on systems without l2tp support

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiprule: Align help text with man page synopsis
Phil Sutter [Thu, 25 Feb 2016 12:07:35 +0000 (13:07 +0100)] 
iprule: Align help text with man page synopsis

The help text was misleading: One could think it is possible to list
rules by selector, which would be nice but isn't. This change also
clarifies that 'ip rule' defaults to 'list' if no further arguments are
given.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: Support VF Trust
Hiroshi Shimamoto [Fri, 26 Feb 2016 02:40:18 +0000 (02:40 +0000)] 
iplink: Support VF Trust

Add IFLA_VF_TRUST message to trust the VF.
PF can accept some privileged operation from the trusted VF.
For example, ixgbe PF doesn't allow to enable VF promiscuous mode until
the VF is trusted because it may hurt performance.

To trust VF.
 # ip link set dev eth0 vf 1 trust on

To untrust VF.
 # ip link set dev eth0 vf 1 trust off

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
9 years agoiplink: bridge: remove unnecessary returns
Nikolay Aleksandrov [Thu, 18 Feb 2016 19:54:34 +0000 (20:54 +0100)] 
iplink: bridge: remove unnecessary returns

invarg exits so no need to return, remove this c&p error from my recent
patches

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agobridge: add support for dynamic fdb entries
Roopa Prabhu [Sat, 20 Feb 2016 05:34:52 +0000 (21:34 -0800)] 
bridge: add support for dynamic fdb entries

This patch is a follow up to the recently added
'static' fdb option.

It introduces a new option 'dynamic' which adds
dynamic fdb entries with NUD_REACHABLE.

$bridge fdb add 00:01:02:03:04:06 dev eth0 master dynamic

$bridge fdb show
00:01:02:03:04:06 dev eth0

This patch also documents all fdb types. Removes 'temp'
from usage message since it is now replaced by 'static'.
'temp' still works and is synonymous with static.

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agohtb: rename b4 buffer to b3 to make its name more consistent
Dmitrii Shcherbakov [Sat, 19 Dec 2015 15:26:03 +0000 (18:26 +0300)] 
htb: rename b4 buffer to b3 to make its name more consistent

b3 buffer has been deleted previously so b2 is followed by b4
which is not consistent.

Signed-off-by: Dmitrii Shcherbakov <fw.dmitrii@yandex.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
9 years agohtb: remove printing of a deprecated overhead value
Dmitrii Shcherbakov [Sat, 19 Dec 2015 15:25:52 +0000 (18:25 +0300)] 
htb: remove printing of a deprecated overhead value

Remove printing according to the previously used encoding of mpu and
overhead values within the tc_ratespec's mpu field. This encoding is
no longer being used as a separate 'overhead' field in the ratespec
structure has been introduced.

Signed-off-by: Dmitrii Shcherbakov <fw.dmitrii@yandex.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE
Nikolay Aleksandrov [Tue, 16 Feb 2016 15:08:55 +0000 (16:08 +0100)] 
iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE

Add support to be able to view and change IFLA_BRPORT_FAST_LEAVE
port attribute.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER
Nikolay Aleksandrov [Tue, 16 Feb 2016 15:08:54 +0000 (16:08 +0100)] 
iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER

Add support to be able to view and change IFLA_BRPORT_MULTICAST_ROUTER port
attribute.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI
Nikolay Aleksandrov [Tue, 16 Feb 2016 15:08:53 +0000 (16:08 +0100)] 
iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI

Add support to be able to view and change IFLA_BRPORT_PROXYARP_WIFI port
attribute.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP
Nikolay Aleksandrov [Tue, 16 Feb 2016 15:08:52 +0000 (16:08 +0100)] 
iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP

Add support to be able to view and change IFLA_BRPORT_PROXYARP port
attribute.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge_slave: export read-only values
Nikolay Aleksandrov [Tue, 16 Feb 2016 15:08:51 +0000 (16:08 +0100)] 
iplink: bridge_slave: export read-only values

Export all the read-only values that get returned about a bridge port
such as the timers, the ids, designated_port and cost,
topology_change_ack and config_pending. For the bridge ids the
br_dump_bridge_id function is exported from iplink_bridge.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agonetns: Fix an off-by-one strcpy() in netns_map_add().
Nicolas Cavallari [Fri, 12 Feb 2016 13:47:39 +0000 (14:47 +0100)] 
netns: Fix an off-by-one strcpy() in netns_map_add().

netns_map_add() does a malloc of (sizeof (struct nsid_cache) +
strlen(name)) and then proceed with strcpy() of name into the
zero-length member at the end of the nsid_cache structure.  The
nul-terminator is written outside of the allocated memory and may
overwrite the allocator's internal structure.

This can trigger a segmentation fault on i386 uclibc with names of size 8:
after the corruption occurs, the call to closedir() on netns_map_init()
crashes while freeing the DIR structure.

Here is the relevant valgrind output:

==1251== Memcheck, a memory error detector
==1251== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==1251== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
info
==1251== Command: ./ip netns
==1251==
==1251== Invalid write of size 1
==1251==    at 0x4011975: strcpy (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==1251==    by 0x8058B00: netns_map_add (ipnetns.c:181)
==1251==    by 0x8058E2A: netns_map_init (ipnetns.c:226)
==1251==    by 0x8058E79: do_netns (ipnetns.c:776)
==1251==    by 0x804D9FF: do_cmd (ip.c:110)
==1251==    by 0x804D814: main (ip.c:300)

9 years agoRevert "tipc: add peer remove functionality"
Stephen Hemminger [Tue, 9 Feb 2016 18:51:32 +0000 (10:51 -0800)] 
Revert "tipc: add peer remove functionality"

This reverts commit f9dec657e4578d50a2432e5842d97c857faa6c2c.

Since this code is not in upstream kernel, it shouldn't be in iproute2

9 years agoip route: add mpls multipath support
Roopa Prabhu [Mon, 8 Feb 2016 00:28:16 +0000 (16:28 -0800)] 
ip route: add mpls multipath support

This patch adds support to add mpls multipath
routes.

example:
ip -f mpls route add 100 \
nexthop as 200 via inet 10.1.1.2 dev swp1 \
nexthop as 700 via inet 10.1.1.6 dev swp2

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agoiplink: bond_slave: fix ad_actor/partner_oper_port_state output
Nikolay Aleksandrov [Mon, 8 Feb 2016 16:13:58 +0000 (17:13 +0100)] 
iplink: bond_slave: fix ad_actor/partner_oper_port_state output

It seems that I've made a mistake when I exported these, instead of a
space in the end I've put a newline character which is wrong and breaks
the single line output.

Fixes: 7d6bc3b87abad ("bonding: export 3ad actor and partner port state")
Reported-by: Sam Tannous <stannous@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for netfilter call attributes
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:39 +0000 (00:14 +0100)] 
iplink: bridge: add support for netfilter call attributes

This patch implements support for the IFLA_BR_NF_CALL_(IP|IP6|ARP)TABLES
attributes in iproute2 so it can change their values.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:38 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_INTVL

This patch implements support for the IFLA_BR_MCAST_STARTUP_QUERY_INTVL
attribute in iproute2 so it can change the startup query interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:37 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_QUERY_RESPONSE_INTVL

This patch implements support for the IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
attribute in iproute2 so it can change the query response interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_QUERY_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:36 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_QUERY_INTVL

This patch implements support for the IFLA_BR_MCAST_QUERY_INTVL attribute
in iproute2 so it can change the query interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_QUERIER_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:35 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_QUERIER_INTVL

This patch implements support for the IFLA_BR_MCAST_QUERIER_INTVL
attribute in iproute2 so it can change the querier interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_MEMBERSHIP_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:34 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_MEMBERSHIP_INTVL

This patch implements support for the IFLA_BR_MCAST_MEMBERSHIP_INTVL
attribute in iproute2 so it can change the membership interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_INTVL
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:33 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_INTVL

This patch implements support for the IFLA_BR_MCAST_LAST_MEMBER_INTVL
attribute in iproute2 so it can change the last member interval.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_CNT
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:32 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_CNT

This patch implements support for the IFLA_BR_MCAST_STARTUP_QUERY_CNT
attribute in iproute2 so it can change the startup query count.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_CNT
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:31 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_CNT

This patch implements support for the IFLA_BR_MCAST_LAST_MEMBER_CNT
attribute in iproute2 so it can change the last member count value.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_HASH_MAX
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:30 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_HASH_MAX

This patch implements support for the IFLA_BR_MCAST_HASH_MAX attribute
in iproute2 so it can change the maximum hashed entries.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_HASH_ELASTICITY
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:29 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_HASH_ELASTICITY

This patch implements support for the IFLA_BR_MCAST_HASH_ELASTICTITY
attribute in iproute2 so it can change the hash elasticity value.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_QUERIER
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:28 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_QUERIER

This patch implements support for the IFLA_BR_MCAST_QUERIER attribute
in iproute2 so it can toggle the mcast querier value.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_QUERY_USE_IFADDR
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:27 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_QUERY_USE_IFADDR

This patch implements support for the IFLA_BR_MCAST_QUERY_USE_IFADDR
attribute in iproute2 so it can toggle the multicast_query_use_ifaddr val.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_SNOOPING
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:26 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_SNOOPING

This patch implements support for the IFLA_BR_MCAST_SNOOPING attribute
in iproute2 so it can change the multicast snooping value.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_MCAST_ROUTER
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:25 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_MCAST_ROUTER

This patch implements support for the IFLA_BR_MCAST_ROUTER attribute
in iproute2 so it can change the multicast router value.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_VLAN_DEFAULT_PVID
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:24 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_VLAN_DEFAULT_PVID

This patch implements support for the IFLA_BR_VLAN_DEFAULT_PVID
attribute in iproute2 so it can change the default pvid.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_GROUP_ADDR
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:23 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_GROUP_ADDR

This patch implements support for the IFLA_BR_GROUP_ADDR attribute
in iproute2 so it can change the group address.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: add support for IFLA_BR_GROUP_FWD_MASK
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:22 +0000 (00:14 +0100)] 
iplink: bridge: add support for IFLA_BR_GROUP_FWD_MASK

This patch implements support for the IFLA_BR_GROUP_FWD_MASK attribute
in iproute2 so it can change the group forwarding mask.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: export read-only timers
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:21 +0000 (00:14 +0100)] 
iplink: bridge: export read-only timers

Netlink already provides hello_timer, tcn_timer, topology_change_timer
and gc_timer, so let's make them visible.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: export root_(port|path_cost), topology_change and change_detected
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:20 +0000 (00:14 +0100)] 
iplink: bridge: export root_(port|path_cost), topology_change and change_detected

Netlink already export these values, we just need to make them visible.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoiplink: bridge: export bridge_id and designated_root
Nikolay Aleksandrov [Mon, 8 Feb 2016 23:14:19 +0000 (00:14 +0100)] 
iplink: bridge: export bridge_id and designated_root

Netlink returns the bridge_id and designated_root, we just need to
make them visible.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agobridge: support for static fdb entries
Roopa Prabhu [Wed, 27 Jan 2016 17:09:37 +0000 (09:09 -0800)] 
bridge: support for static fdb entries

There is no intuitive option to add static fdb entries today.
'temp' seems to have a side effect of adding
'static' fdb entries. But the name and intent
of 'temp' does not say anything about it being static.

example:
bridge fdb add operates as follows:

$bridge fdb add 00:01:02:03:04:05 dev eth0 master
$bridge fdb add 00:01:02:03:04:06 dev eth0 master temp
$bridge fdb add 00:01:02:03:04:07 dev eth0 master local

$bridge fdb show
00:01:02:03:04:05 dev eth0 permanent
00:01:02:03:04:06 dev eth0 static
00:01:02:03:04:07 dev eth0 permanent
00:01:02:03:04:08 dev eth0 <<== dynamic, ageable learned mac

This patch adds a new bridge fdb type 'static' which
makes sure NUD_NOARP and NUD_REACHABLE is set for static
entries. This effectively is nothing but what 'temp'
does today. But the name 'temp' is misleading.

After the patch:
$bridge fdb add 00:01:02:03:04:06 dev eth0 master static

$bridge fdb show
00:01:02:03:04:06 dev eth0 static

'temp' could ideally be a dynamic mac that can age (ie just
NUD_REACHABLE). But, 'temp' sets 'NUD_NOARP' and 'NUD_REACHABLE'.
Too late to change 'temp' now. But, we are thinking of introduing a
'dynamic' keyword after this patch that only sets NUD_REACHABLE.

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agotc, bpf: use bind/type macros from gelf
Daniel Borkmann [Sun, 7 Feb 2016 01:11:53 +0000 (02:11 +0100)] 
tc, bpf: use bind/type macros from gelf

Don't reimplement them and rather use the macros from the gelf header,
that is, GELF_ST_BIND()/GELF_ST_TYPE().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agotc, bpf: give some more hints wrt false relos
Daniel Borkmann [Sun, 7 Feb 2016 01:11:52 +0000 (02:11 +0100)] 
tc, bpf: give some more hints wrt false relos

Provide some more hints to the user/developer when relos have been found
that don't point to ld64 imm instruction. Ran couple of times into relos
generated by clang [1], where the compiler tried to uninline inlined
functions with eBPF and emitted BPF_JMP | BPF_CALL opcodes. If this seems
the case, give a hint that the user should do a work-around to use
always_inline annotation.

  [1] https://llvm.org/bugs/show_bug.cgi?id=26243#c3

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agotc, bpf: improve verifier logging
Daniel Borkmann [Sun, 7 Feb 2016 01:11:51 +0000 (02:11 +0100)] 
tc, bpf: improve verifier logging

With a bit larger, branchy eBPF programs f.e. already ~BPF_MAXINSNS/7 in
size, it happens rather quickly that bpf(2) rejects also valid programs
when only the verifier log buffer size we have in tc is too small.

Change that, so by default we don't do any logging, and only in error
case we retry with logging enabled. If we should fail providing a
reasonable dump of the verifier analysis, retry few times with a larger
log buffer so that we can at least give the user a chance to debug the
program.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
9 years agotc, bpf, examples: further bpf_api improvements
Daniel Borkmann [Sun, 7 Feb 2016 01:11:50 +0000 (02:11 +0100)] 
tc, bpf, examples: further bpf_api improvements

Add a couple of improvements to tc's BPF api, that facilitate program
development.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agogeneve: add support for lwt tunnel creation and dst port selection
Paolo Abeni [Thu, 28 Jan 2016 13:48:55 +0000 (14:48 +0100)] 
geneve: add support for lwt tunnel creation and dst port selection

This change add the ability to create lwt/flow based/externally
controlled geneve device and to select the udp destination port used
by a full geneve tunnel.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
9 years agotc: fix compilation with old gcc (< 4.6) (bis)
Nicolas Dichtel [Wed, 3 Feb 2016 08:25:00 +0000 (09:25 +0100)] 
tc: fix compilation with old gcc (< 4.6) (bis)

Commit 8f80d450c3cb ("tc: fix compilation with old gcc (< 4.6)") was reverted
to ease the merge of the net-next branch.

Here is the new version.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agoipmonitor: match user option 'all' before 'all-nsid'
Roopa Prabhu [Wed, 3 Feb 2016 00:53:40 +0000 (16:53 -0800)] 
ipmonitor: match user option 'all' before 'all-nsid'

'ip monitor all' is broken on older kernels.
This patch fixes 'ip monitor all' to match
'all' and not 'all-nsid'.

It moves parsing arg 'all-nsid' to after parsing
'all'.

Before:
$ip monitor all
NETLINK_LISTEN_ALL_NSID: Protocol not available

After:
$ip monitor all
[NEIGH]Deleted 10.0.0.1 dev eth1 lladdr c4:54:44:4f:b2:dd STALE

Fixes: 449b824ad196 ("ipmonitor: allows to monitor in several netns")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agotc, bpf: make sure relo is in relation with map section
Daniel Borkmann [Thu, 21 Jan 2016 23:46:28 +0000 (00:46 +0100)] 
tc, bpf: make sure relo is in relation with map section

Add a test that symbol from relocation entry is actually related
to map section and bail out with an error message if it's not the
case; in relation to [1].

  [1] https://llvm.org/bugs/show_bug.cgi?id=26243

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
9 years agoiproute2: fix building with musl
Gustavo Zacarias [Thu, 21 Jan 2016 18:19:48 +0000 (15:19 -0300)] 
iproute2: fix building with musl

We need limits.h for PATH_MAX, fixes:

rt_names.c:364:13: error: ‘PATH_MAX’ undeclared (first use in this
function)

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
9 years agoip-link: remove warning message
Zhang Shengju [Thu, 21 Jan 2016 02:23:49 +0000 (02:23 +0000)] 
ip-link: remove warning message

the warning was:
iproute.c:301:12: warning: 'val' may be used uninitialized in this
function [-Wmaybe-uninitialized]
   features &= ~RTAX_FEATURE_ECN;
            ^
iproute.c:575:10: note: 'val' was declared here
   __u32 val;
  ^

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/shemminger...
Stephen Hemminger [Tue, 2 Feb 2016 04:57:23 +0000 (15:57 +1100)] 
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2

9 years agoss: support closing inet sockets via SOCK_DESTROY.
Lorenzo Colitti [Fri, 8 Jan 2016 08:32:37 +0000 (17:32 +0900)] 
ss: support closing inet sockets via SOCK_DESTROY.

This patch adds a -K / --kill option to ss that attempts to
forcibly close matching sockets using SOCK_DESTROY.

Because ss typically prints sockets instead of acting on them,
and because the kernel only supports forcibly closing some types
of sockets, the output of -K is as follows:

- If closing the socket succeeds, the socket is printed.
- If the kernel does not support forcibly closing this type of
  socket (e.g., if it's a UDP socket, or a TIME_WAIT socket),
  the socket is silently skipped.
- If an error occurs (e.g., permission denied), the error is
  reported and ss exits.

Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
9 years agolibnetlink: don't print NETLINK_SOCK_DIAG errors in rtnl_talk
Lorenzo Colitti [Fri, 8 Jan 2016 08:32:36 +0000 (17:32 +0900)] 
libnetlink: don't print NETLINK_SOCK_DIAG errors in rtnl_talk

This change is a no-op, as currently no code uses rtnl_talk on
NETLINK_SOCK_DIAG_BY_FAMILY sockets. It is needed to suppress
spurious errors when using SOCK_DESTROY via rtnl_talk.

Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
9 years agoip-link: fix man page warnings
Thomas Faivre [Thu, 14 Jan 2016 17:10:20 +0000 (18:10 +0100)] 
ip-link: fix man page warnings

grff wrapper returns warnings when parsing the ip-link.8.in file.

How to reproduce:
$ man --warnings ip-link > /dev/null
`R' is a string (producing the registered sign), not a macro.
[...]

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agovxlan: fix help and man text
Thomas Faivre [Thu, 14 Jan 2016 17:10:19 +0000 (18:10 +0100)] 
vxlan: fix help and man text

Options 'group' and 'remote' cannot take 'any' as value but 'local' can.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agotc, bpf: more header checks on loading elf
Daniel Borkmann [Tue, 12 Jan 2016 01:03:08 +0000 (02:03 +0100)] 
tc, bpf: more header checks on loading elf

eBPF llvm backend can support different BPF formats, make sure the object
we're trying to load matches with regards to endiannes and while at it, also
check for other attributes related to BPF ELFs.

  # llc --version
  LLVM (http://llvm.org/):
    LLVM version 3.8.0svn
    Optimized build.
    Built Jan  9 2016 (02:08:10).
    Default target: x86_64-unknown-linux-gnu
    Host CPU: ivybridge

    Registered Targets:
      bpf    - BPF (host endian)
      bpfeb  - BPF (big endian)
      bpfel  - BPF (little endian)
      [...]

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
9 years agotc, bpf: check section names and type everywhere
Daniel Borkmann [Tue, 12 Jan 2016 01:03:07 +0000 (02:03 +0100)] 
tc, bpf: check section names and type everywhere

When extracting sections, we better check for name and type. Noticed
that some llvm versions emit .strtab and .shstrtab (e.g. saw it on pre
3.7), while more recent ones only seem to emit .strtab. Thus, make sure
we get the right sections.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
9 years agotc, clsact: add clsact frontend
Daniel Borkmann [Tue, 12 Jan 2016 00:42:20 +0000 (01:42 +0100)] 
tc, clsact: add clsact frontend

Add the tc part for the kernel commit 1f211a1b929c ("net, sched: add
clsact qdisc"). Quoting example usage from that commit description:

  Example, adding qdisc:

  # tc qdisc add dev foo clsact
  # tc qdisc show dev foo
  qdisc mq 0: root
  qdisc pfifo_fast 0: parent :1 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
  qdisc pfifo_fast 0: parent :2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
  qdisc pfifo_fast 0: parent :3 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
  qdisc pfifo_fast 0: parent :4 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
  qdisc clsact ffff: parent ffff:fff1

  Adding filters (deleting, etc works analogous by specifying ingress/egress):

  # tc filter add dev foo ingress bpf da obj bar.o sec ingress
  # tc filter add dev foo egress  bpf da obj bar.o sec egress
  # tc filter show dev foo ingress
  filter protocol all pref 49152 bpf
  filter protocol all pref 49152 bpf handle 0x1 bar.o:[ingress] direct-action
  # tc filter show dev foo egress
  filter protocol all pref 49152 bpf
  filter protocol all pref 49152 bpf handle 0x1 bar.o:[egress] direct-action

The ingress parent alias can also be used with ingress qdisc.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agotc, ingress: clean up ingress handling a bit
Daniel Borkmann [Tue, 12 Jan 2016 00:42:19 +0000 (01:42 +0100)] 
tc, ingress: clean up ingress handling a bit

Clean it up a bit, we can also get rid of some ugly ifdefs as in our case
TC_H_INGRESS is always defined.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agoupdate headers (post 4.4 merge window)
Stephen Hemminger [Mon, 18 Jan 2016 17:40:13 +0000 (09:40 -0800)] 
update headers (post 4.4 merge window)

9 years agoMerge branch 'net-next'
Stephen Hemminger [Mon, 18 Jan 2016 17:37:45 +0000 (09:37 -0800)] 
Merge branch 'net-next'