Commit Graph

407 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
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
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
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
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
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
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
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
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
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
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
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
David Ward
6128fdfd5c ip/xfrm: Improve transform protocol-specific parameter checking
Ensure that only algorithms and modes supported by the transform
protocol are specified (so that errors are more obvious).

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00
David Ward
ec839527f2 ip/xfrm: Do not allow redundant algorithm combinations to be specified
AEAD algorithms perform both encryption and authentication; they are
not combined with separate encryption or authentication algorithms.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00
David Ward
1d26e1fefd ip/xfrm: Extend SPI validity checking
A Security Policy Index (SPI) is not used with Mobile IPv6. IPComp
uses a smaller 16-bit Compression Parameter Index (CPI) which is
passed as the SPI value. Perform checks whenever specifying an ID.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-03-28 14:40:45 -07:00
James Chapman
dd10baa50d iproute2: add l2spec_type param to l2tp add session
When unmanaged L2TP sessions are created using "ip l2tp add session",
there is no option to allow the session's Layer2SpecificHeader type to
be selected - the kernel's default setting is always used. For
interopability with some vendor equipment, it might be necessary to
use a different setting. So add a new l2spec_type parameter to the "ip
l2tp add session" parameter list, allowing operators to set a specific
Layer2SpecificHeader type. The kernel already exposes the setting as a
netlink attribute so it is straightforward to add support for it in
iproute2.

This change allows unmanaged L2TP sessions to be configured between
Linux and some Cisco equipment by specifying "l2spec_type none" in "ip
l2tp add session" command parameters.

Signed-off-by: James Chapman <jchapman@katalix.com>
2013-03-27 13:20:58 -07:00
Thomas Egerer
0c5982fd7f ip xfrm state: Allow different selector family
My previous commit introduced a patch to allow for states with different
ip address families for selector and id. The must have somehow been a
mixup of the patch I tested and the one I send, so the patch sent breaks
the iproute2 build. This patch fixes this. My apologies.

Signed-off-by: Thomas Egerer <hakke_007@gmx.de>
2013-03-20 08:11:54 -07:00
Thomas Egerer
23d5b0d551 ip xfrm state: Allow different selector family
Do not enforce the selector of a state to have the same address family
as the id. This makes it possible to configure inter family states.

Signed-off-by: Thomas Egerer <hakke_007@gmx.de>
2013-03-18 10:23:00 -07:00
Stephen Hemminger
1124ffb721 ipaddress: minor white space cleanup
Convert leading spaces to tabs, and put alias in one printf
2013-03-14 13:47:49 -07:00
Stephen Hemminger
d947b2384e ipmaddr: add whitespace around =
fix warning from parser
2013-03-14 13:44:25 -07:00
Petr Šabata
4405123433 iproute2: Mention the 'up' argument in documentation
Both ip-link and ip-address support the 'up' argument, however this
isn't documented in neither their help outputs or ip-address' manpage.
This patch fixes that.

Signed-off-by: Petr Šabata <contyk@redhat.com>
Reported-by: Jiří Popelka <jpopelka@redhat.com>
2013-03-14 13:26:33 -07:00
Stephen Hemminger
e7b24b67db Fix build when shared libraries are disabled
On some platforms, shared libraries are not used. The stub code
need some updating to not generate errors.
2013-03-13 08:29:59 -07:00
roopa
263c894fd1 Fix -oneline output when alias present
This patch removes '\n' in -oneline output when alias
present on interface

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2013-03-12 15:50:13 -07:00
Eric W. Biederman
f480917486 iproute2: Document the -D and -I options
While looking into a sysctl regression in decnet on old kernels I
discovered this omission in the iproute2 documentation.

I can't imagine anyone's muscle memory remembering the longer forms.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-03-11 16:53:37 -07:00
David Ward
4e9a686020 iplink_vlan: Add flag for Multiple VLAN Registration Protocol (MVRP)
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Patrick McHardy <kaber@trash.net>
2013-03-06 10:46:37 -08:00
Stephen Hemminger
ae70d96656 ipntable: more fixes for ppc64
Not all arch have sizeof(unsigned long long) == sizeof(__u64)
2013-03-04 13:59:39 -08:00
Stephen Hemminger
a55a8fd83b fix dependency on sizeof(__u64) == sizeof(unsigned long long)
Some platforms like ppc64 have unsigned long long as 128 bits, and
the printf format string would cause errors. Resolve this by using
unsigned long long where necessary (or unsigned long).
2013-02-28 08:51:46 -08:00
Stephen Hemminger
a7c2882461 ip: fix ipv6 ntable on ppc64
Add casts to handle printf format when
 sizeof(unsigned long long) != sizeof(__u64)
2013-02-27 07:26:17 -08:00
Stephen Hemminger
caae16b3b8 ip: handle flush with table > 2^31
Fixes Debian bug #700434
Need to table id in filter to be unsigned to avoid conversion to -1

The documentation for "ip" suggests that, when using multiple routing tables, the table ID can be an arbitrary 32 bit number. I've been writing a script that calculates a table Id based on an IP addresses and sets up tables accordingly based on it. This seems to work for everything I've tried except "ip route flush". If you specify a table to flush with an ID over 2^31, it flushes all IPv4 routing tables. For example:

Will delete all routing tables, including the default one. Needless to say, this is quite annoying. I think this is an upstream bug, but your opinions will be greatly appreciated.
2013-02-12 11:42:57 -08:00
Stephen Hemminger
d1f28cf181 ip: make local functions static 2013-02-12 11:38:35 -08:00
Kees van Reeuwijk
14645ec231 iproute2: improved error messages
This patch improves many error messages as follows:
- For incorrect parameters, show the value of the offending parameter, rather than just say that it is incorrect
- Rephrased messages for clarity
- Rephrased to more `mainstream' english

Signed-off-by: Kees van Reeuwijk <reeuwijk@few.vu.nl>
2013-02-11 09:22:22 -08:00
Kees van Reeuwijk
ecf52428da iproute2: add a missing return statement
Since do_help() has to return an int to fit in the table of commands,
it should actually return an int. This patch lets it do so.

Signed-off-by: Kees van Reeuwijk <reeuwijk@few.vu.nl>
2013-02-11 09:22:17 -08:00
Stephen Hemminger
1cb6a110d6 ip: change format of promiscuity display
Don't put it on separate line, keep it on line with link address.
2013-02-05 08:16:28 -08:00
Nicolas Dichtel
ede6a3eaf5 iplink: display the value of IFLA_PROMISCUITY
This is useful to know the 'real' status of an interface (the flag IFF_PROMISC
is exported by the kernel only when the user set it explicitly, for example it
will not be exported when a tcpdump is running).

This information will be displayed when '-details' is provided by the user.

Example:
$ ip -d l l tun10
6: tun10: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN mode DEFAULT
    link/sit 10.16.0.249 peer 10.16.0.121
    sit remote 10.16.0.121 local 10.16.0.249 ttl inherit pmtudisc 6rd-prefix 2002::/16
    promiscuity 2

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-02-05 08:06:59 -08:00
Nicolas Dichtel
d36035185c ipaddr: fix a typo in error msg about SIOCGIFTXQLEN
The optname was wrong.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-02-04 09:05:31 -08:00
David Ward
e59fd3db2e ip/iptunnel: Extend TOS syntax
The 'inherit/STRING' or 'inherit/00..ff' syntax indicates that the
TOS field of tunneled packets should be copied from the original IP
header, but for non-IP packets the value STRING or 00..ff should be
used instead. (This syntax is already used by 'ip tunnel show'.)

Also clarify the man page and the command usage text (particularly
that the TOS is not specified as a decimal number).

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2013-02-04 08:56:45 -08:00
Eric W. Biederman
9a7b3d91b6 iproute2: Add "ip netns pids" and "ip netns identify"
Add command that go between network namespace names and process
identifiers.  The code builds and runs agains older kernels but
only works on Linux 3.8+ kernels where I have fixed stat to work
properly.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-02-04 08:35:07 -08:00
Eric W. Biederman
58a3e8270f iproute2: Make "ip netns delete" more likely to succeed
Sometimes "ip netns delete" fails because it can not delete the file a
network namespace was mounted on.  If this only happened when a
network namespace was really in use this would be fine, but today it
is possible to pin all network namespaces by simply having a long
running process started with "ip netns exec".

Every mount is copied when a network namespace is created so it is
impossible to prevent the mounts from getting into other mount
namespaces.  Modify all mounts in the files and subdirectories of
/var/run/netns to be shared mount points so that unmount events can
propogate, making it unlikely that "ip netns delete" will fail because
a directory is mounted in another mount namespace.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-02-04 08:33:58 -08:00
Eric W. Biederman
4395d48c78 iproute2: Improve "ip netns add" failure error message
Report the name of the network namespace that could not be
added.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-02-04 08:33:55 -08:00
Eric W. Biederman
8e2d47dce2 iproute2: Normalize return codes in "ip netns"
Ben Hutchings pointed out that the return value of do_netns is passed
to exit and the current convention of returning -1 for failure is
inconsitent with that reality.

Return EXIT_FAILURE instead of -1 and EXIT_SUCCESS instead of 0.  To make
it clear that the return codes are expected to be passed to exit.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-02-04 08:33:53 -08:00
Eric W. Biederman
144e6ce167 iproute2: Don't propogate mounts out of ip
Some systems are now following the advice in
linux/Documentation/sharedsubtrees.txt and running with all mount
points shared between all mount namespaces by default.

After creating the mount namespace call mount on / with
MS_SLAVE|MS_REC to modify all mounts in the new mount namespace to
slave mounts if they are shared or private mounts otherwise.
Guarnateeing that changes to the mount namespace created with
"ip netns exec" don't propgate to other namespaces.

Reported-by: Petr Šabata <contyk@redhat.com>
Tested-by: Petr Šabata <contyk@redhat.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-02-04 08:33:50 -08:00
Mike Frysinger
048bff6e02 ipxfrm: use alloca to allocate stack space
Clang doesn't support the gcc extension for embeddeding flexible arrays
inside of structures.  Use the slightly more portable alloca().

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-18 08:17:12 -08:00
Strake
5bd9dd49ae include needed files
Needed to build iproute2 with musl
2012-12-23 11:49:06 -08:00
Nicolas Dichtel
cbe195dc6b ip: update man pages and usage() for 'ip monitor'
Sync with the current code.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-17 08:47:51 -08:00
Zhi Yong Wu
602e9d36ba ip: add the type 'vxlan' in the output of "ip link help"
The new type 'vxlan' is added in the output of "ip link help"

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
2012-12-17 08:15:57 -08:00