Commit Graph

1614 Commits

Author SHA1 Message Date
Adam Borowski
5d8a75293c ip: fix build failure if time_t is not long int
This includes x32, and, per Linus' decree, any future arch with longs
shorter than 64 bits.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
2013-06-25 13:36:56 -07:00
Eric Dumazet
260804f422 ss: add more TCP_INFO components
Allow ss -i to display more TCP informations :

unacked:N   Number of un-acked packets
retrans:X/Y   X: number of outstanding retransmit packets
              Y: total number of retransmits for the session
lost:N       Number of lost packets (tcpi_lost)
sacked:N     Number of sacked packets (tcpi_sacked)
facked:N     Number of facked packets (tcpi_facked)
reordering:N Reordering level (if different of 3)

Example :

$ ss -emoi dst 10.7.7.83
tcp   ESTAB      0      1154056   10.7.7.84:54127    10.7.7.83:34342
timer:(on,200ms,0) ino:57003 sk:ffff88063c51d0c0 <->
	 skmem:(r0,rb89280,t0,tb2097152,f726504,w1436184,o0,bl0) ts sack cubic
wscale:7,6 rto:310 rtt:107.375/1 mss:1448 cwnd:568 ssthresh:108 send
61.3Mbps unacked:568 retrans:0/21 reordering:127 rcv_space:29200

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
2013-06-25 13:33:07 -07:00
esr@thyrsus.com
61f541fe12 First set of manpage markup fixes
Enclosed patch fixes inappropriate uses of the .SS macro.  Fuller explanation
in the change comment.

There are other problems in these pages that block lifting to
XML-DocBook, most notably in the command synopses.  They will take
some creativity to fix.  I'm working on it

>From 75745adba4b45b87577b61a2daa886dd444f44da Mon Sep 17 00:00:00 2001
From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Fri, 21 Jun 2013 15:27:38 -0400
Subject: [PATCH] Abolish presentation-level misuse of the .SS macro.

This change fixes most (but not all) fatal errors in attempts to lift
the iproute2 manual pages to XML-DocBook.  Where .SS is still used it
is a real subsection header, not just a way to outdent and bold text.
Presentation-level instances are turned into .TP calls and tables.
2013-06-24 17:00:54 -07:00
Patric McHardy
8fd8f6ed71 ip: iplink_vlan: add 802.1ad support
The following patch adds support to ip_vlan for configuring VLAN 802.1ad
support.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2013-06-21 08:59:24 -07:00
Eric Dumazet
a303853e84 get_rate: detect 32bit overflows
On Mon, 2013-06-03 at 16:36 +0100, Ben Hutchings wrote:

> Oops, I read this as being strtol() currently, not strtod().  Currently
> '1.5gbit' will work, but this change will break that.  So I think you
> need to keep bps as a double.

Arg

> Then here I think the check should be *rate != floor(bps), i.e. accept
> rounding down of a non-integer number of bytes but any other change is
> assumed to be overflow.

Thanks Ben, here is v4 then ;)

[PATCH v4] get_rate: detect 32bit overflows

Current rate limit is 34.359.738.360 bit per second, and
unfortunately 40Gbps links are above it.

overflows in get_rate() are currently not detected, and some
users are confused. Let's detect this and complain.

Note that some qdisc are ready to get extended range, but this will
need additional attributes and new iproute2

With help from Ben Hutchings

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
2013-06-07 09:24:56 -07:00
Stephen Hemminger
22fa92e367 htb: fix indentation
iproute2 uses kernel style indenting
2013-06-07 08:54:45 -07:00
Eric Dumazet
44f1ff0afc htb: report overhead attribute
"tc class show dev ..." omits the overhead attribute for HTB.

After patch I have :

tc class add dev $DEV parent 1: classid 1:1 est 1sec 4sec htb \
    rate 12Mbit mtu 1500 quantum 1514 overhead 20

tc class show dev $DEV
class htb 1:1 root prio 0 rate 12000Kbit overhead 20 ceil 12000Kbit
burst 1500b cburst 1500b

Signed-off-by: Eric Dumazet <edumazet@google.com>
2013-06-07 08:53:53 -07:00
Andrey Vagin
ecb928c876 ss: Get netlink sockets info via sock-diag (v2)
v2: update netlink_diag.h

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2013-06-05 08:54:35 -07:00
Andrey Vagin
f271fe011a ss: show destination address for netlink sockets
A netlink socket may be connected to a specific group.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2013-06-05 08:54:35 -07:00
Andrey Vagin
129709aea1 ss: create a function to print info about netlink sockets
It will be reused for printing info about netlink sockets, when
socket diag is used for retrieving information.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2013-06-05 08:54:35 -07:00
Andrey Vagin
d8402b9641 ss: handle socket diag request in a separate function
It will be reused to show netlink sockets

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2013-06-05 08:54:35 -07:00
Andrey Vagin
bcb9d40319 ip: set the close-on-exec flag for descriptors
Otherwise a program executed by "ip netns exec" has two extra
descriptors.

$ ip netns exec test /bin/bash
$ lsof -p $$
...
bash    817 root    0u   CHR  136,0       0t0          3 /dev/pts/0
bash    817 root    1u   CHR  136,0       0t0          3 /dev/pts/0
bash    817 root    2u   CHR  136,0       0t0          3 /dev/pts/0
bash    817 root    3u  sock    0,6       0t0      13386 protocol: NETLINK
bash    817 root    4r   REG    0,3         0 4026532155 net
bash    817 root  255u   CHR  136,0       0t0          3 /dev/pts/0

Cc: Stephen Hemminger <stephen@networkplumber.org>
Reported-by: Dilip Daya <dilip.daya@hp.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2013-06-04 09:11:06 -07:00
Andreas Henriksson
c083d99dd3 iproute2: fix build failure on sparc due to -Wformat and tv_usec
tv_usec is "suseconds_t" which is apparently usually
a signed long, but sometimes not....
Change the printf modifier to use signed and
cast the tv_usec to long in case it's not already long.

gcc -Wall -Wstrict-prototypes -Werror -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -fPIC   -c -o utils.o utils.c
utils.c: In function 'print_timestamp':
utils.c:802:2: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds_t' [-Werror=format]
cc1: all warnings being treated as errors

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2013-06-03 19:56:25 -07:00
John Fastabend
a40d0827a5 iproute2: bridge: fix 'bridge link' setlink/getlink parsing
Use IFLA_AF_SPEC nested attributes to lookup bridge mode and when
doing strcmp() check for equality.

These appear to be typos from the original commit,

commit 64108901b7
Author: Vlad Yasevich <vyasevic@redhat.com>
Date:   Fri Mar 15 10:01:28 2013 -0700

    bridge: Add support for setting bridge port attributes

Also set flags to BRIDGE_FLAGS_SELF instead of using OR operation.
This allows setting the bridge mode when not being used with a
master device.

To allow setting both master and self devices simultaneously we
will need to add a {self|master} field similar to fdb commands.
For now the command sets are mutually exclusive as noted in the
original commit.

With this patch 'bridge link set' works now,

# ./bridge/bridge link set dev veth1 cost 3
# ./bridge/bridge link show
10: veth1 state UP : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master bridge0 state forwarding priority 3 cost 3

CC: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
2013-06-03 19:55:32 -07:00
Stephen Hemminger
45a3b3fcd6 man: get rid of useless reference to GNU style options
No need to state the obvious here.
2013-05-28 08:47:56 -07:00
Sriram Narasimhan
c41e038f48 iptuntap: allow creation of multi-queue tun/tap device
This patch adds multi_queue option to ip tuntap.
This allows IFF_MULTI_QUEUE flag to be specified during
tun/tap device creation enabling multi-queue support in tun/tap
device.

Example: ip tuntap add dev tap0 mode tap multi_queue

Signed-off-by: Sriram Narasimhan <sriram.narasimhan@hp.com>
2013-05-24 08:12:52 -07:00
Nicolas Dichtel
f3c2f91e22 man: describe --bpf option of ss
This option has been recently added to ss utility.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-05-24 08:11:59 -07:00
Rami Rosen
b0f01cf60e ss: replace bfp with bpf in usage().
This patch fixes usage() of misc/ss.c to use bpf instead of bfp.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
2013-05-24 08:11:01 -07:00
Stephen Hemminger
92deabcf29 vxlan: remove dstport option
Dstport option does not work as expected in 3.10
It only allows setting port for sending and does not enable incoming
receive.
2013-05-23 10:21:15 -07:00
Pavel Emelyanov
5b81604753 ss: Show inet and unix sockets' shutdown state
When extended info is requested (-e option) one will be able to observe
arrows in the output, like this:

ESTAB 0 0  127.0.0.1:41705  127.0.0.1:12345  ino:143321 sk:ffff88003a8cea00 -->
ESTAB 0 0  127.0.0.1:46925  127.0.0.1:12346  ino:143322 sk:ffff88003a8ce4c0 <--
ESTAB 0 0  127.0.0.1:51678  127.0.0.1:12347  ino:143323 sk:ffff88003a8cdf80 ---
ESTAB 0 0  127.0.0.1:46911  127.0.0.1:12348  ino:143324 sk:ffff88003b7f05c0 <->

for SHUT_RD, SHUT_WR, SHUT_RDWR and non-shutdown sockets respectively.

The respective nlattrs in *_diag messages has appeared in Linux v3.7 and
are already present in ss's headers.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-17 08:46:51 -07:00
Nicolas Dichtel
372c30d2aa ss: allow to retrieve AF_PACKET info via netlink
This patch add support of netlink messages for AF_PACKET and thus it allows
to get filter information of this kind of sockets.
To dump these filters info the option --bfp must be specified and the user
must have admin rights.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-05-17 08:42:34 -07:00
Nicolas Dichtel
f7431e2913 ipnetconf: by default dump all entries
This is now possible, because the dump function has been added in kernel.
Note that IPv4 and IPv6 entries are displayed.

Before this patch, only all entries were displayed.

Example:
$ ip netconf
ipv4 dev lo forwarding on rp_filter off mc_forwarding 0
ipv4 dev eth0 forwarding on rp_filter off mc_forwarding 1
ipv4 all forwarding on rp_filter off mc_forwarding 1
ipv4 default forwarding on rp_filter off mc_forwarding 0
ipv6 dev lo forwarding on mc_forwarding 0
ipv6 dev eth0 forwarding on mc_forwarding 0
ipv6 all forwarding on mc_forwarding 0
ipv6 default forwarding on mc_forwarding 0

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2013-05-17 08:38:36 -07:00
Nicolas Dichtel
dc8867d0ff ip/xfrm: all to set flag XFRM_SA_XFLAG_DONT_ENCAP_DSCP
For the display part, we print extra-flags only if show_stats is set, like for
standard flags.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2013-05-17 08:38:26 -07:00
Stephen Hemminger
5cf35d6ad7 add BPF header files
For later ss change.
2013-05-17 08:36:52 -07:00
Stephen Hemminger
2a126a85fe vxlan: nag user to set port value
This change shifts burden onto the users to choose the UDP port value.
Kernel default value is incorrect UDP port 5287 but now there is
an official assigned port for VXLAN.

The kernel can't change because of legacy compatibility
but new deployments should not use the legacy port value.
2013-05-15 15:09:57 -07:00
David L Stevens
5b8a1d4a03 iproute2: support NTF_ROUTER flag in VXLAN fdb entries
This patch allows setting the "NTF_ROUTER" flag in VXLAN forwarding table
entries to enable L3 switching for router destinations while still allowing
L2 redirection appliances for non-router MAC destinations.

Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>
2013-05-06 07:54:44 -07:00
Eric Dumazet
9cb1eccf69 ss: add fastopen support
ss -i can output "fastopen" attribute if socket used Fast Open

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2013-05-03 20:48:30 -07:00
David Stevens
5f409678eb iproute2: generalize VXLAN forwarding tables
iproute2 patch to generalize VXLAN forwarding tables

This is the iproute2 support allowing an administrator to specify alternate
ports, vnis and outgoing interfaces for VXLAN device forwarding tables.

Changes since v3: changed NDA_PORT to be 16-bit network byte order to match
	changed byte-order/size in the VXLAN driver.

Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>
2013-05-03 13:20:34 -07:00
Stephen Hemminger
d85e0a59d4 Add vxlan destination port option
Add ability to set UDP destination port on a per device basis.
If no port is assigned, the default IANA assigned port will be used.
If you want the kernel default value, then use port 0.

Source port range option is now called 'srcport', to avoid
confusion. The old option syntax is accepted for compatiablity.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2013-05-03 13:18:45 -07:00
Daniel Borkmann
191b60bd73 ip: ipv6: add tokenized interface identifier support
This patch adds support for tokenized IIDs, that enable
administrators to assign well-known host-part addresses
to nodes whilst still obtaining global network prefix
from Router Advertisements. This is the iproute2 part for
the kernel patch f53adae4eae5 (``net: ipv6: add tokenized
interface identifier support'').

Example commands with iproute2:

Setting a device token:
  # ip token set ::1a:2b:3c:4d/64 dev eth1

Getting a device token:
  # ip token get dev eth1
  token ::1a:2b:3c:4d dev eth1

Listing all tokens:
  # ip token list  (or: ip token)
  token :: dev eth0
  token ::1a:2b:3c:4d dev eth1

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
2013-05-03 13:17:21 -07:00
Stephen Hemminger
79e9a1db11 Update headers to 3.10
Merge in kernel sanitized headers from upstream
2013-05-03 13:15:36 -07:00
Nicolas Dichtel
b0a9dbb816 ip: add missing help about mode argument
There is three possibilities: only IPv6, only IPv4 or both.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-05-03 12:29:22 -07:00
Kamil Rytarowski
824c843556 iproute2 patch against GCC 4.8.0
Hello!

I'm attaching a patch [1] "Feed GCC 4.8.0 against new warning that is
shipped with -Wall: -Wsizeof-pointer-memaccess.".

More details: http://gcc.gnu.org/gcc-4.8/porting_to.html

Regards,

[1] 0001-Feed-GCC-4.8.0-against-new-warning-that-is-shipped-w.patch

>From 1f3ea01fe2ff61cbbca6474f7d9903a0756a4f44 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Fri, 3 May 2013 18:43:38 +0200
Subject: [PATCH] Feed GCC 4.8.0 against new warning that is shipped with
 -Wall: -Wsizeof-pointer-memaccess.
2013-05-03 12:10:09 -07:00
Alexander Duyck
cfa292defa iproute2: act_ipt fix xtables breakage on older versions.
In trying to build on a RHEL6.3 I ran into several build issues that are
addressed in this patch.

The first is that xtables_merge_options only has 3 parameters.  It appears
this is how this code was originally.  As such for the case where the version
is less than 6 I am assuming it would be correct to maintain the original
setup that only had 3 parameters being passed instead of 4.

I also ran into an issue with the define for __ALIGN_KERNEL not being present.
I believe this may be due to the fact that __ALIGN_KERNEL was moved into a
separate header from ALIGN after the UAPI changes.  In order to just cover all
of the bases I have moved the main definition for the macros into
__ALIGN_KERNEL_MASK and __ALIGN_KERNEL and if ALIGN is also needed then it is
just a direct redefine to __ALIGN_KERNEL.

Cc: Hasan Chowdhury <shemonc@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
2013-05-01 08:01:47 -07:00
Stephen Hemminger
74c2f602f6 v3.9.0 2013-04-30 07:47:54 -07:00
Alexander Duyck
63338dca45 libnetlink: Use ifinfomsg instead of rtgenmsg in rtnl_wilddump_req_filter
This change corrects a kernel incompatibility that was resulting in the
ext_filter_mask not being correctly discovered by the kernel as it is buried
somewhere in the ifinfomsg.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
2013-04-26 16:40:30 -07:00
Stephen Hemminger
03fdb011dd ipnetns: fix build on older systems
Debian Squeeze has out of date <sys/mount.h> without the required flags.
2013-04-17 13:35:48 -07:00
Stephen Hemminger
2f9e88f3c9 Revert "add linux/fs.h"
This reverts commit 5abe4685b6.
2013-04-17 13:30:17 -07:00
Stephen Hemminger
5abe4685b6 add linux/fs.h
The ipnetns nees MS_SLAVE, MS_SHARED etc definitions which
are in include/linux/fs.h.
2013-04-17 13:26:47 -07:00
Stephen Hemminger
697ac63905 utils: fix range checking for get_u32/get_u64 et all
Be more careful about overflow in strtoXX routines.
Checks are based on documented interface on man pages.
Based on suggestion from "Mr Dash Four".

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2013-04-12 11:40:57 -07:00
Hubert Kario
ce93fffe82 add short description of batch mode in tc man page
The tc command is missing documentation of -batch and -force switches
that are returned by "tc -help".
Add short description on their syntax and usage.
2013-04-12 09:07:09 -07:00
Petr Sabata
6274b0b759 iproute2: Fix some manpage typos
This patch fixes some of the typos found in iproute2
documentation.

Signed-off-by: Petr Šabata <contyk@redhat.com>
2013-04-05 09:30:05 -07:00
Stephen Hemminger
a6d55bf0a0 Update kernel headers to 3.9-rc5 2013-04-01 11:56:36 -07:00
Stephen Hemminger
f0124b0f0a ip: remove unnecessary ll_init_map
Don't call ll_init_map on modify operations
Saves significant overhead with 1000's of devices.
2013-03-28 15:17:47 -07:00
Stephen Hemminger
0025e5d63d ll_map: add name and index hash
Make ll_ functions faster by having a name hash, and allow
for deletion. Also, allow them to work without calling ll_init_map.
2013-03-28 14:57:28 -07:00
Nicolas Dichtel
16f02e145e libnetlink: check flag NLM_F_DUMP_INTR during dumps
When this flag is set, it means that dump was interrupted and result may be
inconsistent.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-03-28 14:44:41 -07:00
David Ward
e8740e42ec ip/xfrm: Improve error strings
Quotation marks are now used only to indicate literal text on the
command line.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:42:32 -07:00
David Ward
29665f92c7 ip/xfrm: Improve usage text and documentation
Change ALGO-KEY to ALGO-KEYMAT to make it more obvious that the
keying material might need to contain more than just the key (such
as a salt or nonce value).

List the algorithm names that currently exist in the kernel.

Indicate that for IPComp, the Compression Parameter Index (CPI) is
used as the SPI.

Group the list of mode values by transform protocol.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00
David Ward
f3b9aa3df8 ip/xfrm: Command syntax should not expect a key for compression
Compression algorithms do not use a key.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00
David Ward
8dbe67d2fe ip/xfrm: Do not print a zero-length algorithm key
Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00