]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
8 years agoip monitor neigh: Change 'delete' to 'Deleted' to be consistent with ip route
Roopa Prabhu [Thu, 15 Oct 2015 18:47:43 +0000 (11:47 -0700)]
ip monitor neigh: Change 'delete' to 'Deleted' to be consistent with ip route

It helps to grep for one string "Deleted" when monitoring all events.

Fixes: 6ea3ebafe077 ("iproute2: inform user when a neighbor is removed")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
8 years agolibnetlink: introduce rta_nest and u8, u16, u64 helpers for nesting within rtattr
Roopa Prabhu [Thu, 15 Oct 2015 11:13:38 +0000 (13:13 +0200)]
libnetlink: introduce rta_nest and u8, u16, u64 helpers for nesting within rtattr

This patch introduces two new api's rta_nest and rta_nest_end to
nest attributes inside a rta attribute represented by 'struct rtattr'
as required to construct a nexthop. Also adds rta_addattr* variants
for u8, u16 and u64 as needed to support encapsulation.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Jiri Benc <jbenc@redhat.com>
8 years agofix "ss -p" segfaults
willy tarreau [Tue, 6 Oct 2015 10:09:33 +0000 (12:09 +0200)]
fix "ss -p" segfaults

I've updated Jose's patch to make it slightly simpler (eg: calloc instead
of malloc+memset), and ported it to 4.2.0 which requires it as well, and
attached it to this e-mail.

I can confirm that with this patch 4.1.1 doesn't segfault on me anymore.
The commit message should be reworked I guess though everything's in it
and I didn't want to modify his description.

Can it be merged as-is or should I reword the commit message and reference
Jose as the fix reporter ? We should not let this bug live forever.

From: "j.ps@openmailbox.org" <j.ps@openmailbox.org>

Essentially all that is needed to get rid of this issue is the
addition of:

    memset(u, 0, sizeof(*u));

after:

    if (!(u = malloc(sizeof(*u))))
            break;

Also patched some other situations (strcpy and sprintf uses) that
potentially produce the same results.

Signed-off-by: Jose P Santos <j.ps@openmailbox.org>
[ wt: made Jose's patch slightly simpler, all credits to him for the diag ]
Signed-off-by: Willy Tarreau <w@1wt.eu>
8 years agoman: ip-link: document MACVLAN/MACVTAP interface types
Phil Sutter [Fri, 25 Sep 2015 12:09:51 +0000 (14:09 +0200)]
man: ip-link: document MACVLAN/MACVTAP interface types

Signed-off-by: Phil Sutter <phil@nwl.cc>
8 years agoip: macvlan: support MACVLAN_FLAG_NOPROMISC flag
Phil Sutter [Fri, 25 Sep 2015 12:09:50 +0000 (14:09 +0200)]
ip: macvlan: support MACVLAN_FLAG_NOPROMISC flag

This flag is allowed for devices in passthru mode to prevent forcing the
underlying interface into promiscuous mode.

Signed-off-by: Phil Sutter <phil@nwl.cc>
8 years agoip: link: consolidate macvlan and macvtap
Phil Sutter [Fri, 25 Sep 2015 12:09:49 +0000 (14:09 +0200)]
ip: link: consolidate macvlan and macvtap

After eliminating the minor differences in both files which existed
solely because features/fixes were applied to only one of them and not
the other, the remaining differences were in function naming and error
messages. The latter is addressed by using the 'id' field of struct
link_util.

Fold both files into one in order to share common code and eliminate the
chance of having fixes/enhancements applied to only one of them.

Signed-off-by: Phil Sutter <phil@nwl.cc>
8 years agoip, bridge: document -timestamp option
Satish Ashok [Mon, 12 Oct 2015 16:28:55 +0000 (09:28 -0700)]
ip, bridge: document -timestamp option

This patch documents bridge and ip -timestamp option

Signed-off-by: Satish Ashok <sashok@cumulusnetworks.com>
8 years agobridge: add batch command support
Wilson Kok [Sun, 11 Oct 2015 21:03:03 +0000 (14:03 -0700)]
bridge: add batch command support

This patch adds support to batch bridge commands.
Follows ip batch code.

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Christophe Gouault <christophe.gouault@6wind.com>
8 years agoupdate kernel headers
Stephen Hemminger [Mon, 12 Oct 2015 16:22:29 +0000 (09:22 -0700)]
update kernel headers

8 years agobatch: support quoted strings
Christophe Gouault [Fri, 2 Oct 2015 09:59:37 +0000 (11:59 +0200)]
batch: support quoted strings

Support quoting strings with " or ' in an iproute2 batch file.

Enables to configure empty crypto keys (for ESP-null) or keys with
spaces:

    xfrm state add src 1.1.1.1 dst 2.2.2.2 proto ah spi 0x1 \
        mode tunnel auth hmac(sha1) "r4ezR/@kd6'749f2 6zf$"

    xfrm state add src 5.5.5.5 dst 2.2.2.2 proto esp spi 0x2 \
        mode tunnel enc cipher_null ""

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
8 years agoip: allow using a device "help" (or a prefix thereof)
Christoph Schulz [Fri, 25 Sep 2015 06:44:07 +0000 (08:44 +0200)]
ip: allow using a device "help" (or a prefix thereof)

Device names that match "help" or a prefix thereof should be allowed anywhere
a device name can be used. Note that a suitable keyword ("dev" or "name", the
latter for "ip tunnel") has to be used in these cases to resolve ambiguities.

Signed-off-by: Christoph Schulz <develop@kristov.de>
Reported-by: Leonhard Preis <leonhard@pre.is>
Reported-by: Wilhelm Wijkander <lists@0x5e.se>
8 years agoadd tipc manpages to Makefile
Stephen Hemminger [Wed, 7 Oct 2015 09:33:39 +0000 (10:33 +0100)]
add tipc manpages to Makefile

8 years agotipc: add man pages
Richard Alpe [Fri, 2 Oct 2015 08:15:21 +0000 (10:15 +0200)]
tipc: add man pages

This patch adds man pages for the TIPC tool. There is one main page
and one page for each top level sub-command. These pages mainly aims
to help a user of the tipc tool. In addition to this they describe
a bit about what TIPC is and some of its features as a protocol.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
8 years agofq: fix whitespace
Stephen Hemminger [Fri, 25 Sep 2015 19:40:00 +0000 (12:40 -0700)]
fq: fix whitespace

8 years agotc: fq: allow setting and retrieving orphan_mask
Eric Dumazet [Thu, 24 Sep 2015 11:43:26 +0000 (04:43 -0700)]
tc: fq: allow setting and retrieving orphan_mask

linux-3.19 fq packet scheduler got a new attribute, controlling
number of 'flows' holding packets not attached to a socket
(forwarding usage)

kernel commit is 06eb395fa9856b5a87cf7d80baee2a0ed3cdb9d7
("pkt_sched: fq: better control of DDOS traffic")

This patch adds corresponding code to tc command.

tc qd replace dev eth0 root fq orphan_mask 511

Signed-off-by: Eric Dumazet <edumazet@google.com>
8 years agoss: fix file-based filtering segfault
Dan Webster [Thu, 24 Sep 2015 07:36:53 +0000 (09:36 +0200)]
ss: fix file-based filtering segfault

Commit 1527a17 introduced a change where the second of two ssfilter_parse()
calls in ss.c was moved outside of a conditional block (ss.c: ~3575). This
commit enabled the parsing of services, such as 'sport = :ssh', but
inadvertently broke the '-F' file-based filtering:

8 years agoman: tc: add man page for fq pacer
Florian Westphal [Thu, 24 Sep 2015 00:10:28 +0000 (02:10 +0200)]
man: tc: add man page for fq pacer

Partially based on kernel Kconfig help text, code comments and
git commit messages from Eric Dumazet.

Joint work with Phil Sutter.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
8 years agotc : add timestamps to tc monitor
Eric Dumazet [Wed, 23 Sep 2015 23:40:04 +0000 (16:40 -0700)]
tc : add timestamps to tc monitor

Support -timestamp and -tshort options for tc monitor like ip monitor.

# tc -tshort monitor
[2015-09-23T16:39:11.260555] qdisc fq 8003: dev eth0 root refcnt 2 limit
10000p flow_limit 100p buckets 1024 quantum 3028 initial_quantum 15140
refill_delay 40.0ms

Signed-off-by: Eric Dumazet <edumazet@google.com>
9 years agoip: Add type and master filters to brief output
David Ahern [Wed, 23 Sep 2015 22:44:56 +0000 (16:44 -0600)]
ip: Add type and master filters to brief output

The brief format does not honer the master and type filters:

$ ip link show master vrf-mgmt
7: dummy0: <BROADCAST,NOARP,SLAVE> mtu 1500 qdisc noop master vrf-mgmt state DOWN mode DEFAULT group default qlen 1000
    link/ether 66:39:cc:2b:e9:bd brd ff:ff:ff:ff:ff:ff

$ ip -br link show master vrf-mgmt
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0             UP             08:00:27:de:14:c8 <BROADCAST,MULTICAST,UP,LOWER_UP>
eth1             UP             08:00:27:87:02:f1 <BROADCAST,MULTICAST,UP,LOWER_UP>
eth2             UP             08:00:27:61:1e:fd <BROADCAST,MULTICAST,UP,LOWER_UP>
vrf-blue         UNKNOWN        a6:3f:09:34:7e:74 <NOARP,MASTER,UP,LOWER_UP>
vrf-red          DOWN           fe:a2:2d:e1:bc:ac <NOARP,MASTER>
dummy0           DOWN           66:39:cc:2b:e9:bd <BROADCAST,NOARP,SLAVE>
dummy1           DOWN           4a:4f:13:91:64:b1 <BROADCAST,NOARP,SLAVE>
dummy2           DOWN           b2:4f:b6:cd:bd:a6 <BROADCAST,NOARP>
dummy3           DOWN           1e:06:3d:40:b8:c2 <BROADCAST,NOARP,SLAVE>
vrf-mgmt         DOWN           ce:b2:74:41:21:df <NOARP,MASTER>

With this patch the expected output is shown:

$ ip -br link show master vrf-mgmt
dummy0           DOWN           66:39:cc:2b:e9:bd <BROADCAST,NOARP,SLAVE>

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoroute: filter routes by family if it's specified
Andrew Vagin [Wed, 23 Sep 2015 11:43:46 +0000 (14:43 +0300)]
route: filter routes by family if it's specified

Currently when we specify AF_INET6 when it is disabled, we will get
all routes.

For example, we can boot kernel with ipv6.disable=1 and try to get ipv6
routes:
$ ip -6 route show
default via 192.168.122.1 dev eth0  proto static  metric 100
192.168.122.0/24 dev eth0  proto kernel  scope link  src 192.168.122.141  metric 100

Here are ipv4 routes and this is unexpected behaviour.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
9 years agoman tc-htb: Fix HRB -> HTB typo
Vadim Kochan [Tue, 22 Sep 2015 17:01:13 +0000 (20:01 +0300)]
man tc-htb: Fix HRB -> HTB typo

Changed HRB -> HTB.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Fix wording in VLAN reorder_hdr explanation
Vadim Kochan [Wed, 16 Sep 2015 16:55:19 +0000 (19:55 +0300)]
man ip-link: Fix wording in VLAN reorder_hdr explanation

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Acked-by: Jeremy Harris <jgh@redhat.com>
9 years agotc: fq: allow setting and retrieving flow refill delay
Phil Sutter [Thu, 10 Sep 2015 14:25:47 +0000 (16:25 +0200)]
tc: fq: allow setting and retrieving flow refill delay

Code to parse and export this tuneable via netlink is already present in
sched_fq.c of the kernel, so not making it accessible for users would be
a waste of resources.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: tc.8: mention available qdiscs
Phil Sutter [Tue, 22 Sep 2015 14:18:47 +0000 (16:18 +0200)]
man: tc.8: mention available qdiscs

Some qdiscs still lack a manpage, so listing them here is the only way
for a user to get to know them. For the others, this serves as an
overview of what is there.

Content was taken over from the dedicated manpage if available and
suitable, so there is definitely room for improvement at least by
adjusting it more to the context in which it is now. In case there
wasn't appropriate wording available, I tried to identify key aspects of
the given qdisc.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip-link: do not support 'ip link add dev help'
Phil Sutter [Mon, 21 Sep 2015 19:33:01 +0000 (21:33 +0200)]
ip-link: do not support 'ip link add dev help'

Commit 0532555 ('Support "ip link add help" for rtnl_link API') added a
check for specified help parameter. Though due to the place where it has
been added to, it is not possible anymore to force a given parameter to
be interpreted as interface name by prefixing it with 'dev '. Fix this
by forcing whatever follows 'dev' to be presumed as interface name.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: rtpr: add minimal manpage
Phil Sutter [Fri, 18 Sep 2015 18:17:05 +0000 (20:17 +0200)]
man: rtpr: add minimal manpage

While there is not much to explain about this rather trivial shell
script, having a manpage for it serves as good point of reference for
users wondering what it might be for.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: lnstat: rewrite manpage
Phil Sutter [Fri, 18 Sep 2015 18:17:04 +0000 (20:17 +0200)]
man: lnstat: rewrite manpage

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-address: document mngtmpaddr and noprefixroute flags
Phil Sutter [Fri, 18 Sep 2015 18:17:03 +0000 (20:17 +0200)]
man: ip-address: document mngtmpaddr and noprefixroute flags

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agocomment: Fix remaining listings of wrong FSF address
Phil Sutter [Fri, 18 Sep 2015 18:17:02 +0000 (20:17 +0200)]
comment: Fix remaining listings of wrong FSF address

This patch follows the changes of commit 4d98ab0 ("Fix FSF address in
file headers"), fixing file headers added after it.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip-address: align synopsis with help output
Phil Sutter [Fri, 18 Sep 2015 18:17:00 +0000 (20:17 +0200)]
man: ip-address: align synopsis with help output

When fixing the BNF syntax error, I overlooked that 'ip address help'
prints a more correct synopsis. This patch aligns them.

Fixes: 715296b ("ip-address.8.in: fix BNF syntax error")
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoman: ip: add -h[uman-readable] option
Phil Sutter [Fri, 18 Sep 2015 18:17:01 +0000 (20:17 +0200)]
man: ip: add -h[uman-readable] option

Since 'ip help' lists it, it should be described in ip.8 as well.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoconfigure: Check for Berkeley DB for arpd compilation
Vadim Kochan [Fri, 18 Sep 2015 16:17:13 +0000 (19:17 +0300)]
configure: Check for Berkeley DB for arpd compilation

Add check for Berkeley DB header & lib before compile arpd util.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip link: missing options in bond usage
Arthur Gautier [Fri, 11 Sep 2015 12:48:28 +0000 (12:48 +0000)]
ip link: missing options in bond usage

Signed-off-by: Arthur Gautier <baloo@gandi.net>
9 years agol2tp: add missing newline on show output
Stephen Hemminger [Fri, 11 Sep 2015 22:26:58 +0000 (15:26 -0700)]
l2tp: add missing newline on show output

After cookie there was no newline.

9 years agoss format bug
Mike Saal [Wed, 26 Aug 2015 15:59:17 +0000 (11:59 -0400)]
ss format bug

Hi:

I found a formatting bug in the 4.1.1 ss command. The following line was
incorrectly output due to passing a negative length to printf() when
displaying the local address. In this instance hostapd does a "bind to
device" on cdreth0 and then does a udp "in address any" port 67 bind.
Please note the whitespace between the '*' and ' %cdreth0:67'

    'udp UNCONN 0 0 ** %cdreth0:67* *:* users:(("hostapd",pid=19241,fd=5))'

Attached is my patch for the bug fix, it might be prudent to add more
guard code looking for negative length format codes.

Sincerely, Mike

9 years agoiproute: print more verbose error on route cache flush
Denis Kirjanov [Sat, 5 Sep 2015 07:40:50 +0000 (10:40 +0300)]
iproute: print more verbose error on route cache flush

Before:
kda@vfirst ~/devel/iproute2 $ ./ip/ip route flush cache
Cannot open "/proc/sys/net/ipv4/route/flush"

After:
kda@vfirst ~/devel/iproute2/ip $ ./ip route flush cache
Cannot open "/proc/sys/net/ipv4/route/flush": Permission denied

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
9 years agoiplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute
Toshiaki Makita [Mon, 31 Aug 2015 09:48:46 +0000 (18:48 +0900)]
iplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute

This patch adds support for bridge vlan_protocol.

Example:
$ ip link set br0 type bridge vlan_protocol 802.1ad
$ ip -d link show br0
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UP mode DEFAULT group default qlen 1000
    link/ether 44:37:e6:ab:cd:ef brd ff:ff:ff:ff:ff:ff promiscuity 0
    bridge forward_delay 0 hello_time 200 max_age 2000 ageing_time 30000
stp_state 0 priority 32768 vlan_filtering 0 vlan_protocol 802.1ad
addrgenmode eui64

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
9 years agoupdate kernel headers to 4.2-net-next
Stephen Hemminger [Mon, 31 Aug 2015 23:35:00 +0000 (16:35 -0700)]
update kernel headers to 4.2-net-next

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 31 Aug 2015 23:32:10 +0000 (16:32 -0700)]
Merge branch 'master' into net-next

9 years agov4.2.0
Stephen Hemminger [Mon, 31 Aug 2015 23:31:15 +0000 (16:31 -0700)]
v4.2.0

9 years agoadd 'vti'/'vti6' tunnel modes to ip-tunnel manual page
Konstantin Shemyak [Sat, 29 Aug 2015 18:36:32 +0000 (21:36 +0300)]
add 'vti'/'vti6' tunnel modes to ip-tunnel manual page

* "vti" and "vti6" tunnel modes added to ip-tunnel.8 manual page
* Added "hoplimit" terminology for IPv6
* Corrected usage line
* Minor language fix

9 years agoadd support for brief output for link and addresses
Andy Gospodarek [Fri, 28 Aug 2015 17:45:41 +0000 (13:45 -0400)]
add support for brief output for link and addresses

This adds support for slightly less output than is normally provided by
'ip link show' and 'ip addr show'.  This is a bit better when you have a
host with lots of interfaces.  Sample output:

$ ip -br link show
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
p2p1             UP             08:00:27:ee:0b:3b <BROADCAST,MULTICAST,UP,LOWER_UP>
p7p1             UP             08:00:27:9d:62:9f <BROADCAST,MULTICAST,UP,LOWER_UP>
p8p1             DOWN           08:00:27:dc:d8:ca <NO-CARRIER,BROADCAST,MULTICAST,UP>
p9p1             UP             08:00:27:76:d9:75 <BROADCAST,MULTICAST,UP,LOWER_UP>
p7p1.100@p7p1    UP             08:00:27:9d:62:9f <BROADCAST,MULTICAST,UP,LOWER_UP>

$ ip -br -4 addr show
lo               UNKNOWN        127.0.0.1/8
p2p1             UP             192.168.56.2/24
p7p1             UP             70.0.0.1/24
p8p1             DOWN           80.0.0.1/24
p9p1             UP             10.0.5.15/24
p7p1.100@p7p1    UP             200.0.0.1/24

$ ip -br -6 addr show
lo               UNKNOWN        ::1/128
p2p1             UP             fe80::a00:27ff:feee:b3b/64
p7p1             UP             7000::1/8 fe80::a00:27ff:fe9d:629f/64
p8p1             DOWN           8000::1/8
p9p1             UP             fe80::a00:27ff:fe76:d975/64
p7p1.100@p7p1    UP             fe80::a00:27ff:fe9d:629f/64

$ ip -br addr show p7p1
p7p1             UP             70.0.0.1/24 7000::1/8 fe80::a00:27ff:fe9d:629f/64

v2: Now with color support!
v3: Better field width estimation (except netdev names to keep output at a
decent width) and whitespace fixup.

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
9 years agoiplink: cleanup whitespace and checkpatch issues
Stephen Hemminger [Tue, 25 Aug 2015 22:57:04 +0000 (15:57 -0700)]
iplink: cleanup whitespace and checkpatch issues

Mostly just use of {} and whitespace.

9 years agoman ip-link: Add little explanations about VLAN qos map
Vadim Kochan [Mon, 24 Aug 2015 14:57:06 +0000 (17:57 +0300)]
man ip-link: Add little explanations about VLAN qos map

Add little more info about how to manually set priority by iptables,
and some little clarifications about ingress/egress QoS mapping.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoadd support for VRF device
David Ahern [Thu, 13 Aug 2015 20:59:11 +0000 (14:59 -0600)]
add support for VRF device

Allow user to create a vrf device and specify its table binding.
Based on the iplink_vlan implementation.

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
9 years agoupdate kernel headers to 4.2-net-next
Stephen Hemminger [Sun, 23 Aug 2015 17:10:44 +0000 (10:10 -0700)]
update kernel headers to 4.2-net-next

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sun, 23 Aug 2015 17:09:46 +0000 (10:09 -0700)]
Merge branch 'master' into net-next

9 years agoprovide common json output formatter
Stephen Hemminger [Fri, 21 Aug 2015 21:14:51 +0000 (14:14 -0700)]
provide common json output formatter

Formatting JSON is moderately painful.
Provide a simple API to do the syntax formatting.

9 years agoman ip-link: Add more explanation about vlan reordering
Vadim Kochan [Mon, 17 Aug 2015 19:22:24 +0000 (22:22 +0300)]
man ip-link: Add more explanation about vlan reordering

Add more explanation about VLAN reordering and what it affects.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip-address.8.in: fix BNF syntax error
Phil Sutter [Tue, 18 Aug 2015 16:11:12 +0000 (18:11 +0200)]
ip-address.8.in: fix BNF syntax error

The previous man page fixup introduced a syntax error due to missing
opening bracket, which might crash some humanoid BNF parsers.

Fixes: 4e972d5 ("ip-address: fix and extend documentation")
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agolib/namespace: fix fd leakage in non-error case
Phil Sutter [Tue, 18 Aug 2015 16:11:08 +0000 (18:11 +0200)]
lib/namespace: fix fd leakage in non-error case

My previous patch 5950ba9 ("lib/namespace: don't leak fd in error case")
was a step in the wrong direction. Instead of closing the opened file
descriptor in error case only, follow a better approach here and close
the fd as soon as it is not used anymore. This way the inelegant goto
statements can be dropped, and the fd leak in non-error case is fixed as
well.

Fixes: 5950ba9 ("lib/namespace: don't leak fd in error case")
Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoip-link: cut one level indentation
Zhang Shengju [Fri, 14 Aug 2015 03:13:41 +0000 (03:13 +0000)]
ip-link: cut one level indentation

Cut one level indentation to make things easier to read.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 14 Aug 2015 02:42:41 +0000 (19:42 -0700)]
Merge branch 'master' into net-next

9 years agoutils: add missing return value
Zhang Shengju [Fri, 14 Aug 2015 01:36:20 +0000 (01:36 +0000)]
utils: add missing return value

Add missing return value to fix warnings

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agobond: fix return after invarg
Stephen Hemminger [Thu, 13 Aug 2015 21:20:54 +0000 (14:20 -0700)]
bond: fix return after invarg

9 years agotc: fix return after invarg
Stephen Hemminger [Thu, 13 Aug 2015 21:20:40 +0000 (14:20 -0700)]
tc: fix return after invarg

9 years agoip-link: remove unnecessary return
Zhang Shengju [Thu, 13 Aug 2015 07:48:15 +0000 (07:48 +0000)]
ip-link: remove unnecessary return

Remove unnecessary retrun, because invarg() exit.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoip-address: fix and extend documentation
Pavel Šimerda [Wed, 12 Aug 2015 20:04:08 +0000 (22:04 +0200)]
ip-address: fix and extend documentation

 * Improve manual page synopsis and built-it help
 * Use full subcommand names (e.g. 'address' and 'maddress')
 * Specify when IPv4, IPv6 or both are affected
 * Add lifetimes, home and nodad
 * Remove any remaining excess spaces

Commit 43d29f7 substantially improves generated ip-address.8 instead of
ip-address.8.in and commit e419f2d removes the generated one losing the
improvements entirely. This commit recovers the lost changes, adapts
them to the current manual page and adds more man page and help
improvements.

Original commit by: Kenyon Ralph <kenyon@kenyonralph.com>

9 years agoip-link: fix and extend documentation
Pavel Šimerda [Wed, 12 Aug 2015 20:04:07 +0000 (22:04 +0200)]
ip-link: fix and extend documentation

 * Add `can` to list of supported link types
 * Document `addrgenmode`
 * Document `link-netnsid`
 * Document VLAN link type
 * Improve VXLAN link type documentation
    - Fix VXLAN srcport/dstport docs
    - Document `udpcsum`, `udp6zerocsumtx` and `udp6zerocsumrx`

9 years agoip: fix and extend documentation
Pavel Šimerda [Wed, 12 Aug 2015 20:04:06 +0000 (22:04 +0200)]
ip: fix and extend documentation

 * Use unabbreviated `address` and `maddress`
 * Keep only `-n` and `-netns` for network namespace

9 years agoip-link: enhance prompt message
Zhang Shengju [Thu, 13 Aug 2015 06:41:50 +0000 (06:41 +0000)]
ip-link: enhance prompt message

Enhance promtp message for 'spoofchk' and 'query_rss' flag, and fix a
typo.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoremove unnecessary extern
Stephen Hemminger [Thu, 13 Aug 2015 21:09:58 +0000 (14:09 -0700)]
remove unnecessary extern

No need for extern on function prototypes.

9 years agomisc/ss: fix memory leak in user_ent_hash_build()
Phil Sutter [Thu, 6 Aug 2015 12:24:36 +0000 (14:24 +0200)]
misc/ss: fix memory leak in user_ent_hash_build()

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agolib/namespace: don't leak fd in error case
Phil Sutter [Thu, 6 Aug 2015 12:24:35 +0000 (14:24 +0200)]
lib/namespace: don't leak fd in error case

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agomisc/ss: add missing fclose() calls
Phil Sutter [Thu, 6 Aug 2015 12:24:34 +0000 (14:24 +0200)]
misc/ss: add missing fclose() calls

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agomisc/ss: simplify buffer realloc, fix checking realloc failure
Phil Sutter [Thu, 6 Aug 2015 12:24:33 +0000 (14:24 +0200)]
misc/ss: simplify buffer realloc, fix checking realloc failure

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agomisc/ss: avoid NULL pointer dereference
Phil Sutter [Thu, 6 Aug 2015 12:24:32 +0000 (14:24 +0200)]
misc/ss: avoid NULL pointer dereference

This was working before, but only if realloc a) succeeded and b) did not
move the buffer to a different location. ''**buf = **new_buf' then
writes the value of *new_buf's first field into that of *buf.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: add support for IFLA_BR_VLAN_FILTERING attribute
Nikolay Aleksandrov [Wed, 12 Aug 2015 16:19:06 +0000 (09:19 -0700)]
iplink: add support for IFLA_BR_VLAN_FILTERING attribute

This patch implements support for the IFLA_BR_VLAN_FILTERING attribute
in iproute2 so it can enable/disable vlan_filtering.

Example:
$ ip link set br0 type bridge vlan_filtering 1
$ ip -d link show br0
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UP mode DEFAULT group default
    link/ether 08:00:27:ea:07:38 brd ff:ff:ff:ff:ff:ff promiscuity 0
    bridge forward_delay 1500 hello_time 200 max_age 2000 vlan_filtering 1
    addrgenmode eui64

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoupdate header files from 4.2 net-next
Stephen Hemminger [Wed, 12 Aug 2015 16:18:04 +0000 (09:18 -0700)]
update header files from 4.2 net-next

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 12 Aug 2015 16:14:48 +0000 (09:14 -0700)]
Merge branch 'master' into net-next

9 years agoiplink: add ageing_time, stp_state and priority for bridge
Nikolay Aleksandrov [Wed, 12 Aug 2015 16:11:30 +0000 (09:11 -0700)]
iplink: add ageing_time, stp_state and priority for bridge

When showing bridge attributes, show also ageing_time, stp_state and
priority if available.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 12 Aug 2015 16:09:43 +0000 (09:09 -0700)]
Merge branch 'master' into net-next

9 years agoip-link: fix a typo in help message
Zhang Shengju [Wed, 12 Aug 2015 06:29:59 +0000 (06:29 +0000)]
ip-link: fix a typo in help message

fix a typo: "noarp" -> "arp"

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoiplink: shortify printing the usage of link type
Zhang Shengju [Wed, 12 Aug 2015 06:03:24 +0000 (06:03 +0000)]
iplink: shortify printing the usage of link type

Allow to print link type usage by: ip link help bridge_slave

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoiplink: use the short format to print help info
Zhang Shengju [Wed, 12 Aug 2015 06:03:23 +0000 (06:03 +0000)]
iplink: use the short format to print help info

Allow to print link type usage by: ip link help bridge

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoiplink: add missing link type
Zhang Shengju [Wed, 12 Aug 2015 06:03:22 +0000 (06:03 +0000)]
iplink: add missing link type

Add missing link type "bridge_slave".

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoip-link: fix minor typo in manpage
Phil Sutter [Tue, 11 Aug 2015 17:14:11 +0000 (19:14 +0200)]
ip-link: fix minor typo in manpage

Change '-human-readble' to '-human-readable'.

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoipnetns: make net namespace cache variable size
Stephen Hemminger [Wed, 12 Aug 2015 15:35:54 +0000 (08:35 -0700)]
ipnetns: make net namespace cache variable size

Save some space by using variable size for nsid cache elements.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 10 Aug 2015 18:27:35 +0000 (11:27 -0700)]
Merge branch 'master' into net-next

9 years agomisc/ss: don't imply -a when -A was specified
Phil Sutter [Fri, 7 Aug 2015 13:31:27 +0000 (15:31 +0200)]
misc/ss: don't imply -a when -A was specified

Signed-off-by: Phil Sutter <phil@nwl.cc>
9 years agoiplink: bonding: add support for IFLA_BOND_TLB_DYNAMIC_LB
Nikolay Aleksandrov [Mon, 3 Aug 2015 10:19:55 +0000 (12:19 +0200)]
iplink: bonding: add support for IFLA_BOND_TLB_DYNAMIC_LB

Add support to be able to set and show the value of tlb_dynamic_lb
(IFLA_BOND_TLB_DYNAMIC_LB).
Example:
$ ip -d link show dev bond0 type bond
7: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default
    link/ether ce:2f:e1:6e:d7:e0 brd ff:ff:ff:ff:ff:ff promiscuity 0
    bond mode balance-tlb miimon 100 updelay 0 downdelay 0 use_carrier 1
arp_interval 0 arp_validate none arp_all_targets any primary_reselect
always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1
num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1
packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 1
addrgenmode eui64

$ ip -d l set dev bond0 type bond tlb_dynamic_lb 0
$ ip -d link show dev bond0 type bond
7: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default
    link/ether ce:2f:e1:6e:d7:e0 brd ff:ff:ff:ff:ff:ff promiscuity 0
    bond mode balance-tlb miimon 100 updelay 0 downdelay 0 use_carrier 1
arp_interval 0 arp_validate none arp_all_targets any primary_reselect
always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1
num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1
packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 0
addrgenmode eui64

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoupdate to net-next (4.3) headers
Stephen Hemminger [Mon, 10 Aug 2015 18:21:20 +0000 (11:21 -0700)]
update to net-next (4.3) headers

9 years agom_bpf: add frontend support for late binding
Daniel Borkmann [Fri, 7 Aug 2015 09:36:50 +0000 (11:36 +0200)]
m_bpf: add frontend support for late binding

Frontend support for kernel commit a5c90b29e5cc ("act_bpf: properly
support late binding of bpf action to a classifier").

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agotipc: fix bearer get/set help synopsis
Richard Alpe [Fri, 7 Aug 2015 07:55:09 +0000 (09:55 +0200)]
tipc: fix bearer get/set help synopsis

One option is required for bearer set and bearer get.

9 years agoupdate kernel headers from net-next
Stephen Hemminger [Sat, 1 Aug 2015 01:13:56 +0000 (18:13 -0700)]
update kernel headers from net-next

Align with upstream kernel.

9 years agobridge: mdb: add deleted when monitoring delmdb event
Nikolay Aleksandrov [Thu, 30 Jul 2015 09:30:32 +0000 (11:30 +0200)]
bridge: mdb: add deleted when monitoring delmdb event

Before this patch both addmdb and delmdb events were printed the same,
now we'll get a "Deleted" string in front when delmdb is received.
Before:
$ bridge mdb add dev br0 port eth3 grp 239.0.0.1
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
$ bridge mdb del dev br0 port eth3 grp 239.0.0.1
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
^^ No way to differentiate between both events.

After:
$ bridge mdb add dev br0 port eth3 grp 239.0.0.1
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
$ bridge mdb del dev br0 port eth3 grp 239.0.0.1
(monitor) Deleted dev br0 port eth3 grp 239.0.0.1 temp

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sat, 1 Aug 2015 01:12:57 +0000 (18:12 -0700)]
Merge branch 'master' into net-next

9 years agoip: Preserve original portocol family in batch mode
Antti Paila [Fri, 31 Jul 2015 10:55:31 +0000 (13:55 +0300)]
ip: Preserve original portocol family in batch mode

Reset the 'preferred_family' global variable
to its initially set value before each batch
file command is processed.

Signed-off-by: Antti Paila <antti.paila@gmail.com>
9 years agobridge fdb: add 'use' option to set NTF_USE flag in fdb add requests
Roopa Prabhu [Thu, 30 Jul 2015 21:37:02 +0000 (14:37 -0700)]
bridge fdb: add 'use' option to set NTF_USE flag in fdb add requests

This is similar to command options corresponding to other NTF_* flags
already exposed to the user space (examples self/master).

Also updates bridge man page (The man page patch also includes
a fix to the 'self' entry and documents 'master' for fdb entries)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agobridge: drop man page fragment
Stephen Hemminger [Tue, 28 Jul 2015 23:50:19 +0000 (16:50 -0700)]
bridge: drop man page fragment

Left over copy/paste from ip monitor man page.

9 years agobridge: mdb: add support for vlans
Nikolay Aleksandrov [Wed, 15 Jul 2015 15:45:20 +0000 (08:45 -0700)]
bridge: mdb: add support for vlans

This patch allows the user to specify the vlan of the mdb group being
added or deleted and adds support for displaying the vlan when
dumping mdb information or monitoring it. It also updates the man page
to reflect the new "vid" argument for mdb.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoip link: proto_down config and display.
Anuradha Karuppiah [Tue, 14 Jul 2015 20:43:22 +0000 (13:43 -0700)]
ip link: proto_down config and display.

This patch adds support to set and display protodown on a switch port. The
switch driver can handle this error state by doing a phys down on the port.

One example user space application setting this flag is a multi-chassis
LAG application to handle split-brain situation on peer-link failure.

Example:
root@net-next:~# ip link set eth1 protodown on
root@net-next:~/iproute2# ip link show eth1
4: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:12:35:01 brd ff:ff:ff:ff:ff:ff protodown on
root@net-next:~/iproute2# ip link set eth1 protodown off
root@net-next:~/iproute2# ip link show eth1
4: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:12:35:01 brd ff:ff:ff:ff:ff:ff
root@net-next:~/iproute2#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
9 years agoupdate to 4.2-net-next headers
Stephen Hemminger [Tue, 28 Jul 2015 23:42:12 +0000 (16:42 -0700)]
update to 4.2-net-next headers

9 years agoReplace BSD MAXPATHLEN by POSIX PATH_MAX
Felix Janda [Sun, 26 Jul 2015 19:25:32 +0000 (21:25 +0200)]
Replace BSD MAXPATHLEN by POSIX PATH_MAX

Prefer using the POSIX constant PATH_MAX instead of the legacy BSD
derived MAXPATHLEN. The necessary includes for MAXPATHLEN and PATH_MAX
are <sys/param.h> and <limits.h>, respectively.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
9 years agobridge: mdb: add support for router add/del notifications monitoring
Nikolay Aleksandrov [Mon, 27 Jul 2015 11:44:05 +0000 (13:44 +0200)]
bridge: mdb: add support for router add/del notifications monitoring

This patch adds support for ADDMDB/DELMDB notifications about router ports
which have been added or deleted/expired respectively.

Example output:
$ bridge -s monitor mdb
Deleted router port dev eth3 master br0
router port dev eth3 master br0

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
9 years agoip/ip6tunnel: fix missing return value check
Zhang Shengju [Fri, 24 Jul 2015 16:11:32 +0000 (12:11 -0400)]
ip/ip6tunnel: fix missing return value check

Make sure that return value of each socket() call is properly checked
and do not continue processing if the call failed.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agoxfrm: remove duplicated include
Zhang Shengju [Sat, 25 Jul 2015 08:44:24 +0000 (04:44 -0400)]
xfrm: remove duplicated include

Remove dupldated include for <linux/xfrm.h>, since it's already
included by 'xfrm.h'.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
9 years agotc: fix bpf compilation with old glibc
Nicolas Dichtel [Thu, 23 Jul 2015 07:17:41 +0000 (09:17 +0200)]
tc: fix bpf compilation with old glibc

Error was:
f_bpf.o: In function `bpf_parse_opt':
f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
m_bpf.o: In function `parse_bpf':
m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
collect2: error: ld returned 1 exit status

There is no special reason to use the secure version of getenv, thus let's
simply use getenv().

CC: Daniel Borkmann <daniel@iogearbox.net>
Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
9 years agoman ss: Fix explanation when no options specified
Vadim Kochan [Tue, 21 Jul 2015 13:46:28 +0000 (16:46 +0300)]
man ss: Fix explanation when no options specified

Really by default ss dumps not only TCP sockets but any kind of socket
which is in ESTABLISHED state (TCP/UDP/UNIX).

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Reported-by: Miha Marolt <miham@beyondsemi.com>
9 years agoip: fix all the checkpatch warnings
Stephen Hemminger [Mon, 27 Jul 2015 04:46:44 +0000 (21:46 -0700)]
ip: fix all the checkpatch warnings

Zhang Shengju some places where tabs were not being used.
Go ahead and fix all the trival checkpatch warnings in ip/ip.c
Also fix bridge.c