History log of /external/iproute2/ip/iplink.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5c434a9e5a5eafec09ec9939b255948843423f80 01-Mar-2012 Christoph J. Thompson <cjsthompson@gmail.com> iproute2 - Fix up and simplify variables pointing to install directories

Define where is the are located the iproute2 config files.
Get rid of trailing slashes for paths in several file.

Signed-off-by: Christoph J. Thompson <cjsthompson@gmail.com>
4ccfb44dfbe4bf34130cf601a2a59152f4eec816 06-Apr-2012 Stephen Hemminger <stephen.hemminger@vyatta.com> Make link mode case independent

The link mode is printed in upper case, and following the general
rule that ip command output should work on input, allow either case.
4f2fdd44b6694f713aa638cc2222a2d7d17dfe5f 06-Apr-2012 Stephen Hemminger <stephen.hemminger@vyatta.com> Add ability to set link state with ip

Exposes existing netlink operations to modify link state of devices.
82499282b27c82a25448dc40948920950c9a6936 20-Mar-2012 Stephen Hemminger <shemminger@vyatta.com> ip: allow set and display of link mode parameter

The kernel supports a link mode attribute (which can be dormant or default).
This attribute is used to control how the link watch engine
handles operstate transistion.

This adds a new parameter to ip link command to allow setting and
displaying the value.
09fa32794154a69d4a6fbc58c1ee02dbe26a99e9 14-Mar-2012 Stephen Hemminger <shemminger@vyatta.com> iproute: allow changing gretap parameters

Change the order of evaluation of ip link type arguements to allow
changing parameters of gre tunnels.

The following wouldn't work:
# ip li add mytunnel type gretap remote key 3
# ip li set mytunnel type gretap key 9
cd70f3f522e04b4d2fa80ae10292379bf223a53b 28-Dec-2011 Stephen Hemminger <shemminger@vyatta.com> libnetlink: remove unused junk callback

Both rtnl_talk and rtnl_dump had a callback for handling portions
of netlink message that do not match the correct pid or seq.
But this callback was never used by any part of iproute2 so remove
6cf8398f5f487762586801c25539d8fe5bb33b39 23-Dec-2011 Stephen Hemminger <shemminger@vyatta.com> libnetlink: change rtnl_send() to take void *

Avoid having to cast buffer being sent.
7b8179c780a1abd547e5002c4e6fba898c6d72bb 13-Oct-2011 Greg Rose <gregory.v.rose@intel.com> iproute2: Add new command to ip link to enable/disable VF spoof check

Add ip link command parsing for VF spoof checking enable/disable

V2 - Fixed problem with parsing of dump info on kernels that don't
support the spoof checking option and also wrapped the ifla_vf_info
structure in #ifdef __KERNEL__ to prevent user space from directly
accessing the structure
V3 - Improved parsing of vfinfo
V4 - Put Makefile back to proper list of subdirs
V5 - Remove struct ifla_vf_info, it is only used by the kernel
V6 - Make sure spoof check is reported by the driver - rtnl will set
it to -1 to indicate driver didn't report a value.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
a22e92951d21d0f796040d0d6c00d59a1e188bca 07-Oct-2011 Sridhar Samudrala <sri@us.ibm.com> iproute2: Fix usage and man page for 'ip link'

Add bridge as a supported type with 'ip link' in usage and all the missing
types in 'ip' man page. Also fixed some typos.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
0dc34c7713bb7055378fe5cbc720d63d0db572a1 13-Jul-2011 Eric W. Biederman <ebiederm@xmission.com> iproute2: Add processless network namespace support

The goal of this code change is to implement a mechanism such that it is
simple to work with a kernel that is using multiple network namespaces
at once.

This comes in handy for interacting with vpns where there may be rfc1918
address overlaps, and different policies default routes, name servers
and the like.

Configuration specific to a network namespace that would ordinarily be
stored under /etc/ is stored under /etc/netns/<name>. For example if
the dns server configuration is different for your vpn you would create
a file /etc/netns/myvpn/resolv.conf.

File descriptors that can be used to manipulate a network namespace can
be created by opening /var/run/netns/<NAME>.

This adds the following commands to iproute.
ip netns add NAME
ip netns delete NAME
ip netns monitor
ip netns list
ip netns exec NAME cmd ....
ip link set DEV netns NAME

ip netns exec exists to cater the vast majority of programs that only
know how to operate in a single network namespace. ip netns exec
changes the default network namespace, creates a new mount namespace,
remounts /sys and bind mounts netns specific configuration files to
their standard locations.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
d5b7420a269e6e220e00cfbd69546d157fac1332 26-Feb-2011 Stephen Hemminger <stephen.hemminger@vyatta.com> Remove #ifdef's

The iproute package keeps its own headers so there is no need
of polluting code with #ifdef's
a1e191b90c35f5ef5d7dfba5ad8b5b7a7f57a421 26-Feb-2011 Jiri Pirko <jpirko@redhat.com> iplink: implement setting of master devic
db02608b6f408998ea8c823fb791cead3e574f50 02-Feb-2011 Vlad Dogaru <ddvlad@rosedu.org> iproute2: support device group semantics

Add the group keyword to ip link set, which has the following meaning:
If both a group and a device name are pressent, we change the device's
group to the specified one. If only a group is present, then the
operation specified by the rest of the command should apply on an entire
group, not a single device.

So, to set eth0 to the default group, one would use
ip link set dev eth0 group default

Conversely, to set all the devices in the default group down, use
ip link set group default down

Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org>
f960c92aac1838e0f336c0ca0f657bb55a42d8e9 02-Feb-2011 Vlad Dogaru <ddvlad@rosedu.org> iproute2: support listing devices by group

User can specify device group to list by using the group keyword:

ip link show group test

If no group is specified, 0 (default) is implied.

Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org>
1598b9ef7b6704af5126d632e324323703ca8112 13-Jan-2011 Stephen Hemminger <stephen.hemminger@vyatta.com> Revert "iproute2: add VF_PORT support"

This reverts commit 632110aa0db4518b33fc09189ffcdd1b2e2e1762.

There seem to be some recent changes in the 802.1Qbh/bg specs which may
result in changes to this patch in the near future. It seems like its best
to ignore this patch for now.
I will re-spin at a later time when the changes in the specs converge.

BTW, Please let me know if I should CC netdev list and others on the
original email. I can resend this email.

632110aa0db4518b33fc09189ffcdd1b2e2e1762 09-Nov-2010 Roopa Prabhu <roprabhu@cisco.com> iproute2: add VF_PORT support

Resubmitting Scott Feldmans original patch with below changes

- Fix port profile strlen which was off by 1
- Added function to convert IFLA_PORT_RESPONSE codes to string

Add support for IFLA_VF_PORTS. VF port netlink msg layout is

[IFLA_PORT_*], ...
[IFLA_PORT_*], ...
[IFLA_PORT_*], ...

The iproute2 cmd line for link set is now:

Usage: ip link add link DEV [ name ] NAME
[ txqueuelen PACKETS ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
type TYPE [ ARGS ]
ip link delete DEV type TYPE [ ARGS ]

ip link set DEVICE [ { up | down } ]
[ arp { on | off } ]
[ dynamic { on | off } ]
[ multicast { on | off } ]
[ allmulticast { on | off } ]
[ promisc { on | off } ]
[ trailers { on | off } ]
[ txqueuelen PACKETS ]
[ name NEWNAME ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
[ netns PID ]
[ alias NAME ]
[ port MODE { PROFILE | VSI } ]
[ vf NUM [ mac LLADDR ]
[ vlan VLANID [ qos VLAN-QOS ] ]
[ rate TXRATE ]
[ port MODE { PROFILE | VSI } ] ]
ip link show [ DEVICE ]

TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | can }
MODE := { assoc | preassoc | preassocrr | disassoc }
[ instance UUID ]
[ host UUID ]
VSI := vsi mgr MGRID type VTID ver VER
[ instance UUID ]

Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
3fd86630876aed8a23e4f2c2d72e68cbb2ee331a 18-May-2010 Chris Wright <chrisw@sous-sol.org> iproute2: rework SR-IOV VF support

The kernel interface changed just before 2.6.34 was released. This brings
iproute2 in line with the current changes. The VF portion of setlink is
comprised of a set of nested attributes.


Signed-off-by: Chris Wright <chrisw@sous-sol.org>
ae7229d5f99ed9d7fd6ae11bcc726b80e8f8cb87 10-Feb-2010 Williams, Mitch A <mitch.a.williams@intel.com> ip: Add support for setting and showing SR-IOV virtual funtion link params

Add support to 'ip' for setting and showing SR-IOV virtual function
link parameters.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
5a2044782b6a0eb7594d3b3e2e32bbd6a63e77f1 12-May-2009 Wolfgang Grandegger <wg@grandegger.com> iproute2: Support for the CAN netlink

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
cb2eb9997a0292a144968d117f4d831c155ca71d 30-Apr-2009 Andreas Henriksson <andreas@fatal.se> Bug#526329: iproute: Segfault on garbage lladdr

On tor, 2009-04-30 at 14:32 +0100, Timothy Baldwin wrote:
> Package: iproute
> Version: 20090324-1
> Severity: minor
> $ ip link set eth0 address help
> "help" is invalid lladdr.
> Segmentation fault
> Desipte the invalid command line arguments it shouldn't crash.

Callers need to check return value from ll_addr_a2n(). Patch below.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
685f3a9ffbdc504f27aff4a9fd70023f0b3da5d2 27-Mar-2009 Oliver Hartkopp <oliver@hartkopp.net> iproute2: add vcan to ip link help text

Hello Stephen,

thanks für the commit of my last CAN patch.

Today i got a hint, that the help text of 'ip link' can be improved also.

Many thanks!


Signed-Off-By: Oliver Hartkopp <oliver@hartkopp.net>
ace9c96121b10ff8f91d79b7486bb8a5520c12df 23-Mar-2009 Stephen Hemminger <stephen.hemminger@vyatta.com> Add support for IFALIAS

New 2.6.28 support for text description
750a405a5a6f6cdae7d14609b49051e59738177e 13-Oct-2008 Stephen Hemminger <stephen.hemminger@vyatta.com> Fix help text for ip link

This is a variant of Patrick McHardy patch for help text.
Add help for ip link add and ip link delete.
The help conditional on what the kernel supports.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
3ef0c8594283d4891e84b4b8d7d04901416aeae0 07-Oct-2008 Patrick McHardy <kaber@trash.net> Refuse "ip link add/replace" without device type parameter

Fix confusing error message noticed by Martin Josefsson:
Fix typo noticed by Phil Oester: information vs. informatin

# ip link add
RTNETLINK answers: Operation not supported

The reason is missing device type information, refuse this and print a message.

Signed-off-by: Patrick McHardy <kaber@trash.net>
053255520216654c6914e84b0a37e86c542898bd 07-Oct-2008 Patrick McHardy <kaber@trash.net> Support "ip link add help" for rtnl_link API

For some reason "ip link add help" is currently not supported when using
the new rtnl_link API. Fix that.

Signed-off-by: Patrick McHardy <kaber@trash.net>
5e3bb534ae179be141a92eb1a4e2eb48094193b7 22-Aug-2008 Andreas Henriksson <andreas@fatal.se> iproute: DESTDIR vs LIBDIR.

Hello Rafael Almeida.

I noticed your patch adding DESTDIR support in the latest iproute2 release.
Much appreciated! Soon the debian packages might be able to move to actually
using "make install" rather then it's own installation procedure when
building packages. I've noticed something that will break though....

Debian packages usually sets DESTDIR=debian/tmp/ and packages the contents
of that directory as if it where the root file system. This will break
the /usr/lib/{tc,ip}/ module loading, because they DESTDIR (/usr) will be
I beleive others usually call this the LIBDIR to make the separation between
DISTDIR being the (possibly temporary) place things are put when build is
done, and LIBDIR (and others) are used for actual runtime paths.

I'm attaching a patch that I think fixes this, but would be really happy if
you could have a look at to verify I'm not screwing something up.

Andreas Henriksson

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
b514b3587ee56552fcc87a066c955a7ff4f55d6f 02-Jun-2008 Rafael Almeida <rafaelc@dcc.ufmg.br> Fixed installation when changing DESTDIR

After changing the DESTDIR the installated binaries have some issues
due to hard coded paths. For example, using distributions on NetEm
would segfault.

I've changed iplink.c and tc_util.c so they are now aware of DESTDIR.
Along with that change I needed to change the main Makefile so it
defines the DESTDIR macro when calling gcc.

I also changed the paths so that during the installation sbin, etc,
share and lib directories are created directly inside of the DESTDIR,
instead of creating a usr directory inside that. That's the behaviour
of most packages out there, so I think most users will be expecting
that to happen.
e2613dc8605e56dbc53890ebbae263f93610bd41 20-Jun-2008 Benjamin Thery <benjamin.thery@bull.net> iproute2: add support for IFLA_NET_NS_PID in ip link

Hi Stephen,

I resend you this patch once more. This time I updated the documentation
too (may be that was the reason why you didn't take it before?).

Please tell me if there are other things missing in this patch
It applies on iproute2 git tree.



This patch adds support for the IFLA_NET_NS_PID type. It is used to
move network devices between network namespaces.

The syntax is:
ip link set DEVICE netns PID

PID is the pid of a process in the target network namespace.

(Daniel Lezcano is the original author).

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
909dfe2c7ebcfe853b2fe4f995be1c4681d5a2a5 19-Jul-2007 Pavel Emelyanov <xemul@openvz.org> iplink_parse() routine

This routine parses CLI attributes, describing generic link
parameters such as name, address, etc.

This is mostly copy-pasted from iplink_modify().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
66e529f579f45351828fc82d6ba2629cc6eb3ddd 25-Oct-2007 Patrick McHardy <kaber@trash.net> iproute 2.6.23 incompatibility

Arkadiusz Miskiewicz wrote:
> People are reporting that
>> ip link set multicast on dev eth0 (Invalid argument)
>> no longer works when using iproute 2.6.23 on kernel 2.6.21.
>> On my testing machine it also fails:
>> # ./ip link set eth0 multicast on
>> RTNETLINK answers: Invalid argument

It seems it fails to properly detect that your kernel is missing
RTM_NEWLINK support. Apparently the reason is that the kernels
I tested with return a different error in this situation.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
ca78b0e7d4042be7f7283d551d433b76da7f312b 12-Oct-2007 Patrick McHardy <kaber@trash.net> Prevent renaming interfaces to empty string.

Andreas Henriksson wrote:
> From: Alexander Wirt <formorer@debian.org>
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
> ---
> ip/iplink.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 4060845..da1f64e 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
> }
> if (newname && strcmp(dev, newname)) {
> + if (strlen(newname) == 0) {
> + printf("\"\" is not valid device identifier\n");
> + return -1;
> + }

Indentation fixed, same change for the non-ioctl case, use invarg.
While I'm at it I also fixed the error message for "name too long",
*argv is NULL at this point.

Signed-off-by: Patrick McHardy <kaber@trash.net>
5058332f3cd751cb0aa4970a0892ebc4b791b748 13-Oct-2007 Stephen Hemminger <shemminger@linux-foundation.org> Revert "don't allow "" for device name"

Use Patrick's instead

This reverts commit ba371d989038e0dda803528c194e12e5177f7008.
59cc4f73f20f802eda02baa0180a5fb92c14c25c 13-Oct-2007 Stephen Hemminger <shemminger@linux-foundation.org> Revert "Remove bogus reference to tc-filters(8) from tc(8) manpage."

This reverts commit 1bacc7ce752f795df3b1b3710245c4cd8c1bc396.
1bacc7ce752f795df3b1b3710245c4cd8c1bc396 12-Oct-2007 Andreas Barth <aba@not.so.argh.org> Remove bogus reference to tc-filters(8) from tc(8) manpage.

Spotted by Aleš Kozumplík <al_es@seznam.cz>

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
ba371d989038e0dda803528c194e12e5177f7008 12-Oct-2007 Stephen Hemminger <shemminger@linux-foundation.org> don't allow "" for device name

If a zero-length string is given, it is not rejected by
netlink in kernel so catch it at command line.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
1d93483985f0aa2d2afc72dde5179ff3f79a0999 22-Aug-2007 Patrick McHardy <kaber@trash.net> iplink: use netlink for link configuration

Add support for using netlink for link configuration. Kernel-support is
probed, when not available it falls back to using ioctls.

Signed-off-by: Patrick McHardy <kaber@trash.net>
ae665a522bd46bea44c5ea84c89c8b1731954170 05-Dec-2006 Stephen Hemminger <shemminger@osdl.org> Remove trailing whitespace

Go through source files and remove all trailing whitespace

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
7b5657545dc246ae37690d660597e8fa37040205 22-Mar-2006 shemminger <shemminger> The ip(8) command has a bug when dealing with IPoIB link layer
addresses. Specifically it does not correctly handle the addition of
new entries in the neighbor/arp table. For example, this command will

ip neigh add lladdr
00:00:04:04:fe:80:00:00:00:00:00:00:00:01:73:00:00:00:8a:91 nud
permanent dev ib0

An IPoIB link layer address is 20-bytes (see
section 9.1.1).

The command line parsing code expects link layer addresses to be a
maximum of 16-bytes. Addresses over 16-bytes are truncated.
f332d169246447bd5e258ac03d5ee840a70adb1e 06-Jul-2005 shemminger <shemminger> Cleanup GCC4 warnings about signedness.
71058eb8ef128aa99666dc4e6664e7632e12a1b9 01-Sep-2004 osdl.net!shemminger <osdl.net!shemminger> Fix ip command to not crash when interface name is too long.
always use strncpy(.., IFNAMSIZ)

(Logical change 1.79)
d27b1b5b41659d7b62f2e9f5213ffcefcad9753c 02-Jul-2004 net[shemminger]!shemminger <net[shemminger]!shemminger> Import patch iplink.c.more_ifcfg_opts.diff

(Logical change 1.42)
aba5acdfdb347d2c21fc67d613d83d4430ca3937 15-Apr-2004 osdl.org!shemminger <osdl.org!shemminger> (Logical change 1.3)
86fdf0e47be697587efcf9602cd1f952a1d73170 15-Apr-2004 osdl.org!shemminger <osdl.org!shemminger> Initial revision