]> git.ipfire.org Git - thirdparty/iproute2.git/log
thirdparty/iproute2.git
8 years agobridge: Fix garbled json output seen if a vlan filter is specified
anuradhak [Fri, 7 Oct 2016 16:40:18 +0000 (09:40 -0700)] 
bridge: Fix garbled json output seen if a vlan filter is specified

json objects were started but not completed if the fdb vlan did not
match the specified filter vlan.

Sample output:
$ bridge -j fdb show vlan 111
[{
        "mac": "44:38:39:00:69:88",
        "dev": "br0",
        "vlan": 111,
        "master": "br0",
        "state": "permanent"
    }
]
$ bridge -j fdb show vlan 100
[]
$

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
8 years agofix netlink message length checks
Igor Ryzhov [Tue, 4 Oct 2016 10:16:55 +0000 (13:16 +0300)] 
fix netlink message length checks

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
8 years agoip: Use specific slave id
Hangbin Liu [Tue, 20 Sep 2016 10:02:12 +0000 (18:02 +0800)] 
ip: Use specific slave id

The original bond/bridge/vrf and slaves use same id, which make people
confused. Use bond/bridge/vrf_slave as id name will make code more clear.

Acked-by: Phil Sutter <psutter@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agomisc/ss: tcp cwnd should be unsigned
Hangbin Liu [Thu, 22 Sep 2016 08:40:28 +0000 (16:40 +0800)] 
misc/ss: tcp cwnd should be unsigned

tcp->snd_cwd is a u32, but ss treats it like a signed int. This may
results in negative bandwidth calculations.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
8 years agotunnels: use macros for IPv6 address comparison
Jiri Benc [Mon, 5 Sep 2016 09:35:27 +0000 (11:35 +0200)] 
tunnels: use macros for IPv6 address comparison

Replace open coded comparison of IPv6 addresses with appropriate macros.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
8 years agoipmonitor: fix ip monitor can't work when NET_NS is not enabled
Liping Zhang [Tue, 20 Sep 2016 09:09:02 +0000 (02:09 -0700)] 
ipmonitor: fix ip monitor can't work when NET_NS is not enabled

In ip monitor, netns_map_init will check getnsid is supported or not.
But when /proc/self/ns/net does not exist, we just print out error
messages and exit. So user cannot use ip monitor anymore when
CONFIG_NET_NS is disabled:
  # ip monitor
  open("/proc/self/ns/net"): No such file or directory

If open "/proc/self/ns/net" failed, set have_rtnl_getnsid to false.

Fixes: d652ccbf8195 ("netns: allow to dump and monitor nsid")
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
8 years agoip route: check ftell, fseek return value
Hangbin Liu [Thu, 8 Sep 2016 02:26:57 +0000 (10:26 +0800)] 
ip route: check ftell, fseek return value

ftell() may return -1 in error case, which is not handled and
therefore pass a negative offset to fseek(). The return code of
fseek() is also not checked.

Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agomacsec: fix input range of 'icvlen' parameter
Davide Caratti [Fri, 9 Sep 2016 14:02:22 +0000 (16:02 +0200)] 
macsec: fix input range of 'icvlen' parameter

the maximum possible ICV length in a MACsec frame is 16 octects, not 32:
fix get_icvlen() accordingly, so that a proper error message is displayed
in case input 'icvlen' is greater than 16.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
8 years agovxlan: group address requires net device
Jiri Benc [Mon, 5 Sep 2016 09:35:28 +0000 (11:35 +0200)] 
vxlan: group address requires net device

This is now enforced in the kernel, check also in iproute to get a better
error message.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
8 years agotc: don't accept qdisc 'handle' greater than ffff
Davide Caratti [Fri, 16 Sep 2016 08:30:00 +0000 (10:30 +0200)] 
tc: don't accept qdisc 'handle' greater than ffff

since get_qdisc_handle() truncates the input value to 16 bit, return an
error and prompt "invalid qdisc ID" in case input 'handle' parameter needs
more than 16 bit to be stored.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
8 years agoiproute: fix documentation for ip rule scan order
Phil Sutter [Thu, 8 Sep 2016 10:33:03 +0000 (12:33 +0200)] 
iproute: fix documentation for ip rule scan order

Looks like the real issue is missing definition of priority.

8 years agotuntap: Add name attribute to usage text
Thomas Graf [Thu, 8 Sep 2016 12:56:34 +0000 (14:56 +0200)] 
tuntap: Add name attribute to usage text

Signed-off-by: Thomas Graf <tgraf@suug.ch>
8 years agogitignore: Ignore 'tags' file generated by ctags
Hangbin Liu [Tue, 6 Sep 2016 06:42:52 +0000 (14:42 +0800)] 
gitignore: Ignore 'tags' file generated by ctags

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agonstat: add sctp snmp support
Hangbin Liu [Mon, 5 Sep 2016 03:35:02 +0000 (11:35 +0800)] 
nstat: add sctp snmp support

SCTP module was not load by default. But this should be OK since we will not
load table if fdopen() failed, also opening the proc file won't load SCTP
kernel module.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
8 years agoupdate kernel headers from 4.8-rc4
Stephen Hemminger [Thu, 1 Sep 2016 16:10:43 +0000 (09:10 -0700)] 
update kernel headers from 4.8-rc4

8 years agomacsec: fix byte ordering on input/display of 'sci'
Davide Caratti [Tue, 30 Aug 2016 11:23:14 +0000 (13:23 +0200)] 
macsec: fix byte ordering on input/display of 'sci'

use get_be64() in place of get_u64() when parsing input 'sci' parameter,
so that 'sci' can be entered using network byte order regardless the
endianness of target system; use ntohll() when printing out 'sci'. While
at it, improve documentation of 'sci' in ip-link.8.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
8 years agoman: ip.8: add missing 'macsec' item to OBJECT list
Davide Caratti [Tue, 30 Aug 2016 11:23:13 +0000 (13:23 +0200)] 
man: ip.8: add missing 'macsec' item to OBJECT list

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
8 years agomacsec: fix input of 'port', improve documentation of 'address'
Davide Caratti [Tue, 30 Aug 2016 11:23:12 +0000 (13:23 +0200)] 
macsec: fix input of 'port', improve documentation of 'address'

remove hardcoded base 10 parsing of 'port' parameter, update man page
and fix usage() functions as well. Fix misleading line in man page that
theoretically allowed specifying 'port' keyword right after 'sci' keyword.
Provide documentation of 'address' parameter in man pages and in usage()
functions as well.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
8 years agoip: iptuntap cleanup
Stephen Hemminger [Thu, 1 Sep 2016 16:03:40 +0000 (09:03 -0700)] 
ip: iptuntap cleanup

Minor whitespace changes

8 years agoremove useless return statement
Stephen Hemminger [Thu, 1 Sep 2016 15:44:20 +0000 (08:44 -0700)] 
remove useless return statement

Get rid of:
void foo() {
...
return;
}

8 years agoiproute: fix documentation for ip rule scan order
Iskren Chernev [Wed, 31 Aug 2016 00:08:54 +0000 (17:08 -0700)] 
iproute: fix documentation for ip rule scan order

8 years agoiproute: disallow ip rule del without parameters
Andrey Jr. Melnikov [Wed, 24 Aug 2016 20:43:00 +0000 (23:43 +0300)] 
iproute: disallow ip rule del without parameters

Disallow run `ip rule del` without any parameter to avoid delete any first
rule from table.

Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
8 years agoiptuntap: show processes using tuntap interface
Hannes Frederic Sowa [Wed, 24 Aug 2016 18:08:25 +0000 (20:08 +0200)] 
iptuntap: show processes using tuntap interface

Show which processes are using which tun/tap devices, e.g.:

$ ip -d tuntap
tun0: tun
Attached to processes: vpnc(9531)
vnet0: tap vnet_hdr
Attached to processes: qemu-system-x86(10442)
virbr0-nic: tap UNKNOWN_FLAGS:800
Attached to processes:

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
8 years agoip: route: fix multicast route dumps
Nikolay Aleksandrov [Sat, 20 Aug 2016 12:53:10 +0000 (14:53 +0200)] 
ip: route: fix multicast route dumps

If we have multicast routes and do ip route show table all we'll get the
following output:
 ...
 multicast ???/32 from ???/32  table default  proto static  iif eth0
The "???" are because the rtm_family is set to RTNL_FAMILY_IPMR instead
(or RTNL_FAMILY_IP6MR for ipv6). Add a simple workaround that returns the
real family based on the rtm_type (always RTN_MULTICAST for ipmr routes)
and the rtm_family. Similar workaround is already used in ipmroute, and
we can use this helper there as well.

After the patch the output is:
multicast 239.10.10.10/32 from 0.0.0.0/32  table default  proto static  iif eth0

Also fix a minor whitespace error and switch to tabs.

Reported-by: Satish Ashok <sashok@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
8 years agotc: man: Add man entry for the matchall classifier.
Yotam Gigi [Wed, 31 Aug 2016 07:28:27 +0000 (09:28 +0200)] 
tc: man: Add man entry for the matchall classifier.

In addition to providing information about the mathcall filter and its
configurations, the man entry contains examples for creating port
mirorring entries.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
8 years agotc: Add support for the matchall traffic classifier.
Yotam Gigi [Wed, 31 Aug 2016 07:28:26 +0000 (09:28 +0200)] 
tc: Add support for the matchall traffic classifier.

The matchall classifier matches every packet and allows the user to apply
actions on it. In addition, it supports the skip_sw and skip_hw (as can
be found on u32 and flower filter) that direct the kernel to skip the
software/hardware processing of the actions.

This filter is very useful in usecases where every packet should be
matched. For example, packet mirroring (SPAN) can be setup very easily
using that filter.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
8 years agodevlink: whitespace cleanup
Stephen Hemminger [Mon, 29 Aug 2016 18:17:38 +0000 (11:17 -0700)] 
devlink: whitespace cleanup

Break long lines

8 years agodevlink: Add e-switch support
Or Gerlitz [Sun, 28 Aug 2016 13:35:21 +0000 (16:35 +0300)] 
devlink: Add e-switch support

Implement kernel devlink e-switch interface. Currently we allow
to get and set the device e-switch mode.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
8 years agopolice: bug fix man page
Roman Mashak [Sun, 28 Aug 2016 12:52:42 +0000 (08:52 -0400)] 
police: bug fix man page

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agopolice: improve usage message
Roman Mashak [Sun, 28 Aug 2016 12:52:41 +0000 (08:52 -0400)] 
police: improve usage message

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agopolice: add extra space to improve police result printing
Roman Mashak [Sun, 28 Aug 2016 12:52:40 +0000 (08:52 -0400)] 
police: add extra space to improve police result printing

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoip-route: Prevent some double spaces in output
Phil Sutter [Tue, 23 Aug 2016 09:52:45 +0000 (11:52 +0200)] 
ip-route: Prevent some double spaces in output

The code is a bit messy, as it starts with space after text and at some
point switches to space before text. But either way, printing space
before *and* after text almost certainly leads to printing more
whitespace than necessary.

Signed-off-by: Phil Sutter <phil@nwl.cc>
8 years agoupdate BPF headers
Stephen Hemminger [Thu, 25 Aug 2016 15:46:25 +0000 (08:46 -0700)] 
update BPF headers

8 years agotc classifiers: Modernize tcindex classifier
Jamal Hadi Salim [Mon, 22 Aug 2016 11:17:33 +0000 (07:17 -0400)] 
tc classifiers: Modernize tcindex classifier

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
8 years agoip: report IFLA_GSO_MAX_SIZE and IFLA_GSO_MAX_SEGS
Eric Dumazet [Wed, 17 Aug 2016 21:39:21 +0000 (14:39 -0700)] 
ip: report IFLA_GSO_MAX_SIZE and IFLA_GSO_MAX_SEGS

kernel support for these attributes was added in linux-4.6

Signed-off-by: Eric Dumazet <edumazet@google.com>
8 years agoss: fix build with musl libc
Gustavo Zacarias [Sat, 20 Aug 2016 03:11:10 +0000 (00:11 -0300)] 
ss: fix build with musl libc

UINT_MAX usage requires limits.h, so include it.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
8 years agoip route: restore_handler should check tb[RTA_PREFSRC] for local networks
Xin Long [Sun, 7 Aug 2016 09:12:30 +0000 (17:12 +0800)] 
ip route: restore_handler should check tb[RTA_PREFSRC] for local networks

Prior to this patch, If one route entry's RTA_PREFSRC and RTA_GATEWAY
both were NULL, it was supposed to be restored ONLY as a local address.

But as it didn't check tb[RTA_PREFSRC] when restoring local networks,
rtattr_cmp would return a success if it was NULL, this route entry would
be restored again as a local network.

This patch is to add tb[RTA_PREFSRC] check when restoring local networks.

Fixes: 74af8dd9620e ("ip route: restore route entries in correct order")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Tested-by: Phil Sutter <phil@nwl.cc>
8 years agoila: show usage even if the module is not available
Sabrina Dubroca [Tue, 16 Aug 2016 14:26:58 +0000 (16:26 +0200)] 
ila: show usage even if the module is not available

Currently, the `ip ila` command tries to initialize a genl context
even when we just want to see the help for the command, which doesn't
require to talk to the kernel at all.

Delay genl initialization, which can fail if the module isn't loaded,
until the point where we will actually need it.

Fixes: ec71cae0bb7b ("ila: Support for configuring ila to use netfilter hook")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
8 years agofou: show usage even if the module is not available
Sabrina Dubroca [Tue, 16 Aug 2016 14:26:57 +0000 (16:26 +0200)] 
fou: show usage even if the module is not available

Currently, the `ip fou` command tries to initialize a genl context even
when we just want to see the help for the command, which doesn't require
to talk to the kernel at all.

Delay genl initialization, which can fail if the module isn't loaded,
until the point where we will actually need it.

Fixes: 6928747b6e79 ("ip fou: Support to configure foo-over-udp RX")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
8 years agomacsec: show usage even if the module is not available
Sabrina Dubroca [Tue, 16 Aug 2016 14:26:56 +0000 (16:26 +0200)] 
macsec: show usage even if the module is not available

Currently, the `ip macsec` command tries to initialize a genl context
even when we just want to see the help for the command, which doesn't
require to talk to the kernel at all.

Delay genl initialization, which can fail if the module isn't loaded,
until the point where we will actually need it.

Fixes: b26fc590ce62 ("ip: add MACsec support")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
8 years agolibgenl: introduce genl_init_handle
Sabrina Dubroca [Tue, 16 Aug 2016 14:26:55 +0000 (16:26 +0200)] 
libgenl: introduce genl_init_handle

All users of genl have the same code to open a genl socket and resolve
the family for their specific protocol.  Introduce a helper to initialize
the handle, and use it in all the genl code.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
8 years agoip-link: add missing {min,max}_tx_rate to help text
Phil Sutter [Tue, 16 Aug 2016 14:08:38 +0000 (16:08 +0200)] 
ip-link: add missing {min,max}_tx_rate to help text

These vf options are described in man page already, they're just missing
in help output.

Signed-off-by: Phil Sutter <phil@nwl.cc>
8 years agotipc: refactor bearer identification
Richard Alpe [Mon, 15 Aug 2016 08:24:32 +0000 (10:24 +0200)] 
tipc: refactor bearer identification

Introduce a generic function (nl_add_bearer_name()) that identifies a
bearer and adds it to an existing netlink message. This reduces code
complexity and makes the code a little bit easier to maintain.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
8 years agotipc: fix UDP bearer synopsis
Richard Alpe [Mon, 15 Aug 2016 08:24:31 +0000 (10:24 +0200)] 
tipc: fix UDP bearer synopsis

Local ip is not required to identify a UDP bearer and shouldn't be
passed to bearer disable, set or get. In this patch we remove the
localip entry from the synopsis of these functions.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
8 years agoipila: Fixed unitialized variables
Tom Herbert [Mon, 15 Aug 2016 23:30:22 +0000 (16:30 -0700)] 
ipila: Fixed unitialized variables

Initialize locator and locator_match to zero and only do
addattr if they have been set.

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agoman: ip-link.8: Document missing geneve options
Phil Sutter [Thu, 11 Aug 2016 23:17:12 +0000 (01:17 +0200)] 
man: ip-link.8: Document missing geneve options

This adds missing documentation of geneve type options:

- dstport
- external
- udpcsum
- udp6zerocsumtx
- udp6zerocsumrx

The bits for the last three was just copy and pasted from vxlan section.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agofou: Allowing configuring IPv6 listener
Tom Herbert [Thu, 4 Aug 2016 20:34:57 +0000 (13:34 -0700)] 
fou: Allowing configuring IPv6 listener

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agogre6: Support for fou encapsulation
Tom Herbert [Thu, 4 Aug 2016 20:34:56 +0000 (13:34 -0700)] 
gre6: Support for fou encapsulation

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agoip6tnl: Support for fou encapsulation
Tom Herbert [Thu, 4 Aug 2016 20:34:55 +0000 (13:34 -0700)] 
ip6tnl: Support for fou encapsulation

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agoila: Support for configuring ila to use netfilter hook
Tom Herbert [Thu, 4 Aug 2016 20:34:54 +0000 (13:34 -0700)] 
ila: Support for configuring ila to use netfilter hook

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agoila: Support for checksum neutral translation
Tom Herbert [Thu, 4 Aug 2016 20:34:53 +0000 (13:34 -0700)] 
ila: Support for checksum neutral translation

Add configuration of ila LWT tunnels for checksum mode including
checksum neutral translation.

Signed-off-by: Tom Herbert <tom@herbertland.com>
9 years agotc: fix a misleading failure
WANG Cong [Mon, 8 Aug 2016 23:24:45 +0000 (16:24 -0700)] 
tc: fix a misleading failure

Before this patch:

 # ./tc/tc actions add action drop index 11
 RTNETLINK answers: File exists
 We have an error talking to the kernel
 Command "(null)" is unknown, try "tc actions help".

After this patch:

 # ./tc/tc actions add action drop index 11
 RTNETLINK answers: File exists
 We have an error talking to the kernel

Cc: Stephen Hemminger <shemming@brocade.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
9 years agoMerge branch 'net-next'
Stephen Hemminger [Tue, 9 Aug 2016 18:14:47 +0000 (11:14 -0700)] 
Merge branch 'net-next'

9 years agobridge: print_vlan: add missing check for json instance
Roopa Prabhu [Wed, 3 Aug 2016 06:07:05 +0000 (23:07 -0700)] 
bridge: print_vlan: add missing check for json instance

Also initialize vlan_flags

Fixes: d82a49ce85f0 ("bridge: add json support for bridge vlan show")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 8 Aug 2016 16:27:28 +0000 (09:27 -0700)] 
Merge branch 'master' into net-next

9 years agov4.7.0 v4.7.0
Stephen Hemminger [Mon, 8 Aug 2016 15:58:39 +0000 (08:58 -0700)] 
v4.7.0

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 8 Aug 2016 15:57:22 +0000 (08:57 -0700)] 
Merge branch 'master' into net-next

9 years agotc/m_gact: Fix action_a2n() return code check
Phil Sutter [Sun, 7 Aug 2016 11:19:01 +0000 (13:19 +0200)] 
tc/m_gact: Fix action_a2n() return code check

The function returns zero on success.

Reported-by: Mark Bloch <markb@mellanox.com>
Fixes: 69f5aff63c770b ("tc: use action_a2n() everywhere")
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoupdate kernel headers
Stephen Hemminger [Mon, 8 Aug 2016 15:51:22 +0000 (08:51 -0700)] 
update kernel headers

9 years agobridge: print_vlan: add missing check for json instance
Roopa Prabhu [Wed, 3 Aug 2016 06:07:05 +0000 (23:07 -0700)] 
bridge: print_vlan: add missing check for json instance

Also initialize vlan_flags

Fixes: d82a49ce85f0 ("bridge: add json support for bridge vlan show")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 8 Aug 2016 15:44:07 +0000 (08:44 -0700)] 
Merge branch 'master' into net-next

9 years agobridge: vlan json: skip ports with empty vlans
Roopa Prabhu [Sun, 7 Aug 2016 19:37:03 +0000 (12:37 -0700)] 
bridge: vlan json: skip ports with empty vlans

The non-json output prints 'None' for such vlans.
And this can garble json output.

Fixes: d82a49ce85f0 ("bridge: add json support for bridge vlan show")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agotc: Fix for missing estimator initialization
Phil Sutter [Wed, 3 Aug 2016 09:43:45 +0000 (11:43 +0200)] 
tc: Fix for missing estimator initialization

When switching to C99 initializers, I forgot to add this one. This means
that when trying to set an estimator value, tc would complain about
spurious duplicate estimator parameter. But much worse, the random
variable content is sent to the kernel regardless of whether an
estimator was given or not.

Fixes: d17b136f7d7dd ("Use C99 style initializers everywhere")
Reported-by: Stas Nichiporovich <stasn77@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agodevlink: add option to generate JSON output
Jiri Pirko [Fri, 22 Jul 2016 16:34:30 +0000 (18:34 +0200)] 
devlink: add option to generate JSON output

For parsing by another app it is convenient to produce output in JSON
format.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
9 years agodevlink: write usage help messages to stderr
Jiri Pirko [Fri, 22 Jul 2016 16:34:29 +0000 (18:34 +0200)] 
devlink: write usage help messages to stderr

In order to not confuse reader, write help messages into stderr.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
9 years agomacsec: cipher and icvlen can be set separately
Davide Caratti [Tue, 26 Jul 2016 09:03:20 +0000 (11:03 +0200)] 
macsec: cipher and icvlen can be set separately

since kernel driver has valid default values for 'cipher' and 'icvlen',
there is no need for requiring users to specify both of them when a new
link is added. Also, prompt an error message and exit with appropriate
exit status in case of unsupported cipher suite.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
9 years agoip {link,address}: add 'macsec' item to TYPE list
Davide Caratti [Tue, 26 Jul 2016 09:03:19 +0000 (11:03 +0200)] 
ip {link,address}: add 'macsec' item to TYPE list

fix output of "ip address help" and "ip link help". Update TYPE list in man
pages ip-address.8 and ip-link.8 as well.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
9 years agoman: macsec: fix macsec related typos
Davide Caratti [Tue, 26 Jul 2016 09:03:18 +0000 (11:03 +0200)] 
man: macsec: fix macsec related typos

- ip-macsec.8: fix wrong 'device' keyword in 'ip link add device eth0';
add missing description of 'validate' keyword; remove spurious bracket
near 'encrypt' keyword; add missing reference to configuration of 'port'
and 'sci'
- ip-link.8 fix wrong 'es' and 'encoding' keywords in MACsec section

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 25 Jul 2016 15:21:00 +0000 (08:21 -0700)] 
Merge branch 'master' into net-next

9 years agoman/man8/tc-flow.8: minor corrections
Michal Soltys [Sun, 24 Jul 2016 00:00:29 +0000 (02:00 +0200)] 
man/man8/tc-flow.8: minor corrections

- baseclass: major handle must match that of class's, Y defaults to 1
- flow map example: maps to 1-256, not 1-257

Signed-off-by: Michal Soltys <soltys@ziu.info>
9 years agotc: util: No need for action_n2a() to be reentrant
Phil Sutter [Sat, 23 Jul 2016 11:28:10 +0000 (13:28 +0200)] 
tc: util: No need for action_n2a() to be reentrant

This allows to remove some buffers here and there. While at it, make it
return a const value.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agotc: use action_a2n() everywhere
Phil Sutter [Sat, 23 Jul 2016 11:28:09 +0000 (13:28 +0200)] 
tc: use action_a2n() everywhere

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agotc: util: bore up action_a2n()
Phil Sutter [Sat, 23 Jul 2016 11:28:08 +0000 (13:28 +0200)] 
tc: util: bore up action_a2n()

It's a pitty this function is used nowhere, so let's polish it for use:

* Loop over branch names, makes it clear that every former conditional
  was exactly identical.
* Support 'pipe' branch name, too.
* Make number parsing optional.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agotc: Reformat tc_util.h
Phil Sutter [Sat, 23 Jul 2016 11:28:07 +0000 (13:28 +0200)] 
tc: Reformat tc_util.h

* Drop 'extern' keyword before function declarations.
* Add parameter names where they were missing for matters of
  consistency.
* Drop fancy indenting (e.g. tab between type and name).
* Break long lines to not exceed 80 columns.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agol2tp: add udp checksum control flags
Shanker Wang [Thu, 21 Jul 2016 10:59:10 +0000 (18:59 +0800)] 
l2tp: add udp checksum control flags

Three options are added for the user to control
whether the checksum is enabled

Signed-off-by: Miao Wang <miao.wang@tuna.tsinghua.edu.cn>
9 years agoinclude: update net-next XDP headers
Stephen Hemminger [Wed, 20 Jul 2016 19:24:59 +0000 (12:24 -0700)] 
include: update net-next XDP headers

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 20 Jul 2016 19:21:42 +0000 (12:21 -0700)] 
Merge branch 'master' into net-next

9 years agoip-address.8: Document autojoin flag
Phil Sutter [Tue, 12 Jul 2016 07:56:16 +0000 (09:56 +0200)] 
ip-address.8: Document autojoin flag

Description copied from related kernel support commit message with a
little tailoring to fit.

While at it, fix font of non-terminal CONFFLAG-LIST in synopsis.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agotc: ematch: Ignore all-zero mask value when printing filters
Phil Sutter [Thu, 14 Jul 2016 21:10:53 +0000 (23:10 +0200)] 
tc: ematch: Ignore all-zero mask value when printing filters

The optional mask which may be added to int values is considered by the
kernel only if it is non-zero, therefore tc should only then also print
it.

Without this, not passing a mask value like so:

| # tc filter add dev d0 parent 8001: \
|  basic match meta\(vlan eq 1\) \
|  classid 8001:1

Would lead to tc printing an all-zero mask later:

| # tc filter show dev d0
| filter parent 8001: protocol all pref 49151 basic
| filter parent 8001: protocol all pref 49151 basic handle 0x1 flowid 8001:1
|   meta(vlan mask 0x00000000 eq 1)

This is obviously confusing as an all-zero mask strictly means to
eliminate all bits from the value, but the opposite is the case.

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoMakefile: Allow to override CC
Phil Sutter [Mon, 18 Jul 2016 14:48:45 +0000 (16:48 +0200)] 
Makefile: Allow to override CC

This makes it easier to build iproute2 with a custom compiler.

While at it, make HOSTCC default to the value of CC if not explicitly
set elsewhere.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoNo need to initialize rtattr fields before parsing
Phil Sutter [Mon, 18 Jul 2016 14:48:44 +0000 (16:48 +0200)] 
No need to initialize rtattr fields before parsing

Since parse_rtattr_flags() calls memset already, there is no need for
callers to do so themselves.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoReplace malloc && memset by calloc
Phil Sutter [Mon, 18 Jul 2016 14:48:43 +0000 (16:48 +0200)] 
Replace malloc && memset by calloc

This only replaces occurrences where the newly allocated memory is
cleared completely afterwards, as in other cases it is a theoretical
performance hit although code would be cleaner this way.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoUse C99 style initializers everywhere
Phil Sutter [Mon, 18 Jul 2016 14:48:42 +0000 (16:48 +0200)] 
Use C99 style initializers everywhere

This big patch was compiled by vimgrepping for memset calls and changing
to C99 initializer if applicable. One notable exception is the
initialization of union bpf_attr in tc/tc_bpf.c: changing it would break
for older gcc versions (at least <=3.4.6).

Calls to memset for struct rtattr pointer fields for parse_rtattr*()
were just dropped since they are not needed.

The changes here allowed the compiler to discover some unused variables,
so get rid of them, too.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
9 years agotc: m_action: Improve conversion to C99 style initializers
Phil Sutter [Mon, 18 Jul 2016 14:48:41 +0000 (16:48 +0200)] 
tc: m_action: Improve conversion to C99 style initializers

This improves my initial change in the following points:

- Flatten embedded struct's initializers.
- No need to initialize variables to zero as the key feature of C99
  initializers is to do this implicitly.
- By relocating the declaration of struct rtattr *tail, it can be
  initialized at the same time.

Fixes: a0a73b298a579 ("tc: m_action: Use C99 style initializers for struct req")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoip-link.8: Fix font choices
Phil Sutter [Sat, 9 Jul 2016 09:22:50 +0000 (11:22 +0200)] 
ip-link.8: Fix font choices

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip-link.8: Add slave type option descriptions
Phil Sutter [Sat, 9 Jul 2016 09:22:49 +0000 (11:22 +0200)] 
ip-link.8: Add slave type option descriptions

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip-link.8: Place 'ip link set' warning more prominently
Phil Sutter [Sat, 9 Jul 2016 09:22:48 +0000 (11:22 +0200)] 
ip-link.8: Place 'ip link set' warning more prominently

This moves the warning to the beginning of the section about 'ip link
set' which makes it still stand out after adding more text to it's end.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip-link.8: Extend type list in synopsis
Phil Sutter [Sat, 9 Jul 2016 09:22:47 +0000 (11:22 +0200)] 
ip-link.8: Extend type list in synopsis

'ip link set' supports passing a type to set type-specific parameters.
Add this missing piece of information to the synopsis section.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: bond_slave: Add missing help functions
Phil Sutter [Sat, 9 Jul 2016 09:22:46 +0000 (11:22 +0200)] 
iplink: bond_slave: Add missing help functions

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: List valid 'type' argument in ip link help text
Phil Sutter [Sat, 9 Jul 2016 09:22:45 +0000 (11:22 +0200)] 
iplink: List valid 'type' argument in ip link help text

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agobridge: remove unused variable
Stephen Hemminger [Wed, 20 Jul 2016 19:03:33 +0000 (12:03 -0700)] 
bridge: remove unused variable

Debris from JSON changes.

9 years agobridge: update man page
Roopa Prabhu [Wed, 22 Jun 2016 13:45:55 +0000 (06:45 -0700)] 
bridge: update man page

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agobridge: add json schema for bridge fdb show
Anuradha Karuppiah [Wed, 22 Jun 2016 13:45:54 +0000 (06:45 -0700)] 
bridge: add json schema for bridge fdb show

Storing the schema file for the json format will be useful for doc
purposes as optional paramaters are typically suppressed in the json
sample outputs.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
9 years agobridge: add json support for bridge fdb show
Anuradha Karuppiah [Wed, 22 Jun 2016 13:45:53 +0000 (06:45 -0700)] 
bridge: add json support for bridge fdb show

Sample output:
$bridge -j fdb show
[{
        "mac": "44:38:39:00:69:88",
        "dev": "swp2s0",
        "vlan": 2,
        "master": "br0",
        "state": "permanent"
    },{
        "mac": "00:02:00:00:00:01",
        "dev": "swp2s0",
        "vlan": 2,
        "master": "br0"
    },{
        "mac": "00:02:00:00:00:02",
        "dev": "swp2s1",
        "vlan": 2,
        "master": "br0"
    },{
        "mac": "44:38:39:00:69:89",
        "dev": "swp2s1",
        "master": "br0",
        "state": "permanent"
    },{
        "mac": "44:38:39:00:69:89",
        "dev": "swp2s1",
        "vlan": 2,
        "master": "br0",
        "state": "permanent"
    },{
        "mac": "44:38:39:00:69:88",
        "dev": "br0",
        "master": "br0",
        "state": "permanent"
    }
]

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agobridge: add json support for bridge vlan show
Roopa Prabhu [Wed, 22 Jun 2016 13:45:52 +0000 (06:45 -0700)] 
bridge: add json support for bridge vlan show

$bridge -c vlan show
port vlan ids
swp1  1 PVID Egress Untagged
 10-13

swp2  1 PVID Egress Untagged
 10-13

br0  1 PVID Egress Untagged

$bridge  -json vlan show
{
    "swp1": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        },{
            "vlan": 10
        },{
            "vlan": 11
        },{
            "vlan": 12
        },{
            "vlan": 13
        }
    ],
    "swp2": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        },{
            "vlan": 10
        },{
            "vlan": 11
        },{
            "vlan": 12
        },{
            "vlan": 13
        }
    ],
    "br0": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        }
    ]
}

$bridge -c -json vlan show
{
    "swp1": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        },{
            "vlan": 10,
            "vlanEnd": 13
        }
    ],
    "swp2": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        },{
            "vlan": 10,
            "vlanEnd": 13
        }
    ],
    "br0": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        }
    ]
}

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agojson_writer: Removed automatic json-object type from the constructor
Anuradha Karuppiah [Wed, 22 Jun 2016 13:45:51 +0000 (06:45 -0700)] 
json_writer: Removed automatic json-object type from the constructor

Top level can be any json type and can be created using
jsonw_start_object/jsonw_end_object etc.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
9 years agoss: Add option to suppress header line
David Ahern [Fri, 15 Jul 2016 22:45:39 +0000 (15:45 -0700)] 
ss: Add option to suppress header line

Add option to suppress header line. When used the following line
is not shown:
"State  Recv-Q Send-Q     Local Address:Port  Peer Address:Port"

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoss: Fix support for device filter by index
David Ahern [Fri, 15 Jul 2016 22:41:35 +0000 (15:41 -0700)] 
ss: Fix support for device filter by index

Support was recently added for device filters. The intent was to allow
the device to be specified by name or index, and using the if%u format
(dev == if5) or the simpler and more intuitive index alone (dev == 5).
The latter case is broken since the index is not saved to the filter
after the strtoul conversion. Further, the tmp variable used for the
conversion shadows another variable used in the function. Fix both.

With this change all 3 variants work as expected:
$ ss -t 'dev == 62'
State   Recv-Q Send-Q         Local Address:Port    Peer Address:Port
ESTAB       0      224         10.0.1.3%mgmt:ssh   192.168.0.50:58442

$ ss -t 'dev == mgmt'
State   Recv-Q Send-Q         Local Address:Port    Peer Address:Port
ESTAB       0      224         10.0.1.3%mgmt:ssh   192.168.0.50:58442

$ ss -t 'dev == if62'
State   Recv-Q Send-Q         Local Address:Port    Peer Address:Port
ESTAB       0      36          10.0.1.3%mgmt:ssh   192.168.0.50:58442

Fixes: 2d2932125616 ("ss: Add support to filter on device")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
9 years agobpf: also check elf for official e_machine value
Daniel Borkmann [Mon, 18 Jul 2016 23:09:52 +0000 (01:09 +0200)] 
bpf: also check elf for official e_machine value

Use the official BPF ELF e_machine value that was assigned recently [1]
and will be propagated to glibc, libelf et al. LLVM will switch to it
in 3.9 release, therefore we need to prepare tc to check for EM_ELF as
well, older version still have the EM_NONE.

  [1] https://github.com/llvm-mirror/llvm/commit/36b9c09330bfb5e771914cfe307588f30d5510d2

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
9 years agoupdate headers files to current net-next
Stephen Hemminger [Fri, 15 Jul 2016 18:55:14 +0000 (11:55 -0700)] 
update headers files to current net-next