Commit Graph

629 Commits

Author SHA1 Message Date
Stephen Hemminger
1199c4f569 ip: add paren to silence warning
Gcc doesn't like mixed || and && in same conditional.
2014-07-14 12:06:52 -07:00
Sucheta Chakraborty
f89a2a05ff Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool
o "min_tx_rate" option has been added for minimum Tx rate. Hence, for
  consistent naming, "max_tx_rate" option has been introduced for maximum
  Tx rate.

o Change in v2: "rate" can be used along with "max_tx_rate".
  When both are specified, "max_tx_rate" should override.

o Change in v3:
  * IFLA_VF_RATE: When IFLA_VF_RATE is used, and user has given only one of
    min_tx_rate or max_tx_rate, reading of previous rate limits is done in
    userspace instead of in kernel space before ndo_set_vf_rate.

  * IFLA_VF_TX_RATE: When IFLA_VF_TX_RATE is used, min_tx_rate is always read
    in kernel space. This takes care of below scenarios:
    (1) when old tool sends "rate" but kernel is new (expects min and max)
    (2) when new tool sends only "rate" but kernel is old (expects only "rate")

o Change in v4 as suggested by Stephen Hemminger:
  * As per iproute policy, input and output formats should match. Changing display
    of max_tx_rate and min_tx_rate options accordingly.
	./ip/ip link show p3p1
	8: p3p1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
        link/ether 00:0e:1e:16:ce:40 brd ff:ff:ff:ff:ff:ff
        vf 0 MAC 2a:18:8f:4d:3d:d4, tx rate 700 (Mbps), max_tx_rate 700Mbps, min_tx_rate 200Mbps
        vf 1 MAC 72:dc:ba:f9:df:fd

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
2014-06-09 12:51:57 -07:00
Cong Wang
0cb6bb51b4 do not exit silently when link is not found
When we create a tunnel on top of a link and the link specified
in cmdline doesn't exist, an error message should be shown.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2014-06-09 12:38:32 -07:00
Stephen Hemminger
4ec0ffde42 fix format warnings
Enable format security, and fix the warning caused by printing
with string for format.
2014-05-29 10:31:30 -07:00
Oliver Hartkopp
2b70fe156b iplink: can: fix help text and man page
Controller Area Network (CAN) interfaces are physical network interfaces.
They can't be 'created' like software devices by 'ip link add type can'.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-28 16:58:13 -07:00
Jiri Pirko
c897067480 iproute2: ipa: show port id
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2014-05-28 16:57:32 -07:00
Mike Rapoport
55713c8c72 ipnetns: fix misprint in an error message
Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
2014-05-13 12:53:18 -07:00
Stephen Hemminger
4b726cb176 Whitespace and indentation cleanup
Need to go over whole source and scrub..
2014-05-09 12:36:46 -07:00
david decotigny
30b557929f iproute2: show counter of carrier on<->off transitions
This patch allows to display the current counter of carrier on<->off
transitions (IFLA_CARRIER_CHANGES, see kernel commit "expose number of
carrier on/off changes"):

  ip -s -s link show dev eth0
  32: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
    link/ether ................. brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    125552461  258881   0       0       0       10150
    RX errors: length  crc     frame   fifo    missed
               0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    40426119   224444   0       0       0       0
    TX errors: aborted fifo    window  heartbeat transns
               0        0       0       0        3

Tested:
  - kernel with patch "net-sysfs: expose number of carrier on/off
    changes": see "transns" column above
  - kernel wthout the patch: "transns" not displayed (as expected)

Signed-off-by: David Decotigny <decot@googlers.com>
2014-05-09 12:13:12 -07:00
Oliver Hartkopp
2bfe047017 iproute2: can: support CAN FD control interface
For CAN FD a new set of bittiming configuration and enabling functions for the
data section is provided by the CAN driver infrastructure.

This patch allows to configure the newly introduced CAN FD properties.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-09 12:04:55 -07:00
Oliver Hartkopp
3bbff7df0c iproute2: can: fix indention white spaces
When preparing a patch for CAN FD support these white space issues showed up.
Fix it in the current code to be able to provide a proper follow up patch.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-05-09 12:04:55 -07:00
Stephen Hemminger
e4d5edba68 Merge branch 'net-next' 2014-04-11 18:06:13 -07:00
Heiner Kallweit
a424c39360 ip: officially support flag mngtmpaddr also for "ip addr del"
Kernel is being extended to support flag IFA_F_MANAGETEMPADDR also for
deletion of addresses. This will allow a userspace application to indicate
that for a global address the kernel should delete all related temporary
addresses as well.

"ip addr del" internally calls ipaddr_modify which silently accepts
any flag provided on the command line already, independent of the
actual command.
Therefore only the usage documentation needs to be extended.

Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
2014-04-11 17:47:04 -07:00
WANG Cong
8b21f88dd0 ipaddress: do not add IFA_FLAGS when not necessary
commit 37c9b94ed2 (add support for extended ifa_flags)
introduced a regression:

        # ./ip/ip addr add 192.168.0.1/24 dev eth0
        RTNETLINK answers: Invalid argument

This is due to old kernels don't support IFA_FLAGS flag, we should not
use it if we don't use the flags beyond old .ifa_flags.

Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2014-04-11 17:44:57 -07:00
Kusanagi Kouichi
1891754487 veth: Handle flags correctry
Flags for a peer override flags for the other and not used for the
peer.

before:
# ip link add up type veth peer down multicast off
# ip link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 2e:5c:cd:f5:63:d2 brd ff:ff:ff:ff:ff:ff
3: veth1: <BROADCAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 72:b0:fa:1e:76:7a brd ff:ff:ff:ff:ff:ff

after:
# ip link add up type veth peer down multicast off
# ip link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: veth0: <BROADCAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 6e:db:03:b3:bd:ff brd ff:ff:ff:ff:ff:ff
3: veth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether a6:62:d9:84:f0:73 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
2014-04-11 17:44:48 -07:00
Nicolas Dichtel
f687d73c96 ipxfrm: allow to setup filter when dumping SA
It's now possible to filter SA directly into the kernel by specifying
XFRMA_PROTO and/or XFRMA_ADDRESS_FILTER.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2014-03-21 14:24:41 -07:00
Masatake YAMATO
577e5a53fc iproute: Show default type, table, proto and scope of route
In "ip route show" output unicast type, main table, boot protocol and
universe scope are hidden as default labels.

Sometimes it is helpful to show the hidden label for people not enough
familiar with routing subsystem to map the output of "ip route show" and
kernel source code.

With this patch "ip route show" with -d option shows the default labels.

Example of difference of output with -d option:

    $ ./ip/ip -4   route show table all dev virbr1
    ...
    192.168.121.0/28  proto kernel  scope link  src 192.168.121.1
    ...
    $ ./ip/ip -4 -d  route show table all dev virbr1
    ...
    unicast 192.168.121.0/28  table main  proto kernel  scope link  src 192.168.121.1
    ...

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-03-21 14:21:26 -07:00
Michal Kubeček
574e748806 iplink_bond_slave: show mii_status only once
With "ip -d link show", bonding slave mii status is displayed
twice, once as a number and once as a name.

Fixes: 730d3f61 ("iplink: add support for bonding slave")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
2014-02-28 10:13:46 -08:00
Michal Kubeček
f7a45e0955 iplink_bond: fix parameter value matching
Lookup function get_index() compares argument with table entries
only up to the length of the table entry so that if an entry
with lower index is a substring of a later one, earlier entry is
used even if the argument is equal to the other. For example,

  ip link set bond0 type bond xmit_hash_policy layer2+3

sets xmit_hash_policy to 0 (layer2) as this is found before
"layer2+3" can be checked.

Use strcmp() to compare whole strings instead.

v2: look for an exact match only

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
2014-02-17 10:58:56 -08:00
Stephen Hemminger
4806867a6c kill spaces before tabs 2014-02-17 10:56:31 -08:00
Stephen Hemminger
0612519e01 Remove trailing whitespace 2014-02-17 10:55:31 -08:00
Jiri Pirko
730d3f61d9 iplink: add support for bonding slave
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2014-02-17 10:53:34 -08:00
Jiri Pirko
fbea611564 introduce support for slave info data
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2014-02-17 10:53:33 -08:00
Michal Kubeček
32ad31fba1 iplink_bond: fix arp_all_targets parameter name in output
Name of arp_all_targets parameter in output of "ip -d link show"
is missing trailing "s".

Fixes: 63d127b0 ("iproute2: finish support for bonding attributes")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
2014-02-17 10:48:25 -08:00
Christoph Paasch
c33049044e tcp_metrics: Allow removal based on the source-IP
This patch allows adding the source-IP attribute to the netlink-command.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
2014-02-10 14:46:11 -08:00
Christoph Paasch
114aa720fa tcp_metrics: Display source-address
This patch allows to display the source-IP.
stype will be used in the next patch that allows to remove based on the
source-IP.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
2014-02-10 14:46:11 -08:00
Christoph Paasch
54b237a058 tcp_metrics: Rename addr to daddr and add local variable
Renaming addr to daddr, because we will introduce saddr later.

The local variable is necessary to store RTA_PAYLOAD(a) temporarily.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
2014-02-10 14:46:11 -08:00
Stephen Hemminger
a37c74724a Merge branch 'net-next-for-3.13' 2014-02-10 14:39:20 -08:00
Thomas Haller
58c69b226f add support for IFA_F_NOPREFIXROUTE
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-20 12:30:45 -08:00
Jiri Pirko
5b7e21c417 add support for IFA_F_MANAGETEMPADDR
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2014-01-20 12:30:44 -08:00
Stephen Hemminger
514cdfb443 Revert "vxlan: remove dstport option"
This reverts commit 92deabcf29.

Conflicts:
	ip/iplink_vxlan.c

Allow setting dst_port in 3.12
2014-01-10 15:17:06 -08:00
sfeldma@cumulusnetworks.com
63d127b05d iproute2: finish support for bonding attributes
Add support for bonding attributes just added to net-next.
On set, allow string or number value for enumerated attributes.
On show, use always use string value for attribute.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2014-01-09 23:09:01 -08:00
Jiri Pirko
37c9b94ed2 add support for extended ifa_flags
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2014-01-09 22:49:29 -08:00
Stephen Hemminger
ef056b2190 Merge branch 'master' into net-next-for-3.13 2014-01-09 22:44:17 -08:00
Hangbin Liu
1c28bd597b iptunnel: Allow GRE_KEY for vti interface
The vti interface will use GRE_KEY to match the right policy in kernel. So we
can not return fail when the tunnel is vti.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2013-12-28 11:29:53 -08:00
Pavel Emelyanov
5e25cf77b9 iproute: Make it possible to specify index on link creation
The RTM_NEWLINK message accepts ifi_index non-zero value and lets
creation of links with given index (if it's free, or course). This
functionality is available since linux-v3.5.

This patch makes this API available via ip tool.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-28 11:24:11 -08:00
Arvid Brodin
5c0aec93a5 ip: Add HSR support
Add basic support for High-Availability Seamless Redundancy (HSR) network
devices.

Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
2013-12-20 08:33:19 -08:00
Sergey Popovich
e0d47aa303 Handle netdev group for veth peer too
Currently ip-link(8) parses, but ignores "group" argument to
peer interface on veth creation.

Insert IFLA_GROUP attribute for peer interface when present.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
2013-12-20 08:27:51 -08:00
Stephen Hemminger
be2c3142f9 veth: fix uninitialized arguments
Based on patch by Sergey Popovich <popovich_sergei@mail.ru>
This fixes crash when ip-link(8) invoced with command:

  ip link add dev veth1a type veth peer
2013-12-20 08:25:13 -08:00
Stephen Hemminger
d2468da0a3 check return value of rtnl_send and related functions
Use warn_unused_result to enforce checking return value of rtnl_send,
and fix where the errors are.

Suggested by initial patch from Petr Písař <ppisar@redhat.com>
2013-12-20 08:24:44 -08:00
Stephen Hemminger
29cc864089 netconf: add support for neighbor proxy attribute
Report changes to proxy_arp/proxy_ndp attribute.
2013-12-17 22:32:58 -08:00
Stephen Hemminger
4d98ab00de Fix FSF address in file headers 2013-12-06 15:05:07 -08:00
Sami Kerola
fa10855a7e ip: make -resolve addr to print names rather than addresses
As a system admin I occasionally want to be able to check that all
interfaces has a name in DNS or /etc/hosts file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-11-22 17:04:06 -08:00
Hangbin Liu
bc7635a8b3 ipaddrlabel: use uint32_t instead of int32_t
As both linux kernel and function ipaddrlabel_modify use unsigned int for
label. We should also use unsigned int value when print addrlabel in case of
misunderstanding.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2013-11-22 17:03:15 -08:00
Jiri Pirko
cc26a8909f iplink: add support for bonding netlink
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-10-30 16:45:04 -07:00
WANG Cong
aa574cd60e vxlan: add ipv6 support
The kernel already supports it, so add the support
to iproute2 as well.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2013-10-30 16:37:05 -07:00
Nicolas Dichtel
1253a10a63 iplink: update available type list
macvtap and vti were missing.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-10-09 15:29:09 -07:00
Christophe Gouault
b557416532 xfrm: enable to set non-wildcard mark 0 on SAs and SPs
ip xfrm considers that the user-defined mark is "any" as soon as
(mark.v & mark.m == 0), which prevents from specifying non-wildcard
marks that include the value 0 (typically 0/0xffffffff).

Yet, matching exactly mark 0 is useful for instance to separate
vti policies from global policies.

Always configure the user mark if mark.m != 0.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2013-10-09 15:29:05 -07:00
xeb@mail.ru
af89576d7a iproute2: GRE over IPv6 tunnel support.
GRE over IPv6 tunnel support.

Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
2013-09-30 21:33:55 -07:00
Fan Du
99500b56d9 xfrm: use memcpy to suppress gcc phony buffer overflow warning.
This bug is reported from below link:
https://bugzilla.redhat.com/show_bug.cgi?id=982761

An simplified command from its original reproducing method in bugzilla:
ip xfrm state add src 10.0.0.2 dst 10.0.0.1 proto ah spi 0x12345678 auth md5 12
will cause below spew from gcc.

Reported-by: Sohny Thomas <sthomas@linux.vnet.ibm.com>
2013-09-30 21:09:05 -07:00
Stephen Hemminger
c5e3ee2c1f Merge branch 'master' into net-next-3.11 2013-09-03 08:45:27 -07:00
Nicolas Dichtel
3c61c01a66 ipnetns: fix ip batch mode when using 'netns exec'
Since commit a05f6511f5, ip batch mode is broken when using 'netns exec' cmd.

When WIFEXITED() returns true, it means that the child exited normally, hence
we must not call exit() but just returns the status. If we call exit, the next
commands in the file file are not executed.
If WIFEXITED() returns false, we can call exit() because it means that the
child failed.

This patch partially reverts commit a05f6511f5.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-09-03 08:20:16 -07:00
Thomas Egerer
1ed509bb52 ip/xfrm: Fix potential SIGSEGV when printing extra flags
The git-commit dc8867d0, that added support for displaying the
extra-flags of a state, introduced a potential segfault.
Trying to show a state without the extra-flag attribute and show_stats
enabled, would cause the NULL pointer in tb[XFRMA_SA_EXTRA_FLAGS] to be
dereferenced.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2013-08-31 10:33:21 -07:00
Lutz Jaenicke
7dc0481aa1 macvlan: fix typo in macvlan_print_opt()
The mode information is contained in IFLA_MACVLAN_MODE instead
of IFLA_VLAN_ID (both evaluating to "1" in their enums).

Signed-off-by: Lutz Jaenicke <ljaenicke@innominate.com>
2013-08-31 10:30:11 -07:00
Richard Godbee
30d07e9e36 iproute2: spelling: noptmudisc -> nopmtudisc
Signed-off-by: Richard Godbee <richard@godbee.net>
2013-08-31 10:30:03 -07:00
Richard Godbee
8f48063721 iproute2: iproute.c: fix usage() spacing problems
Fix two spacing problems around square brackets in usage text.

Signed-off-by: Richard Godbee <richard@godbee.net>
2013-08-31 10:30:01 -07:00
Stephen Hemminger
001856532f add ability to filter neighbour discovery by protocol
Useful to be able to monitor arp and IPv6 nd seperately.
Default is both.
2013-08-29 12:18:52 -07:00
Martin Schwenke
488c41d216 ip: Add label option to ip monitor
Prefix labelling is currently only activated when monitoring "all"
objects.  However, the output can still be confusing when monitoring
more than 1 object, so add an option to always print prefix labels.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2013-08-19 08:57:24 -07:00
Stephen Hemminger
d259f0302f Fix spelling errors
Minor errors found by codespell
2013-08-04 15:00:56 -07:00
Stephen Hemminger
ac3ff72032 cleanup help message
Split it naturally
2013-08-04 15:00:42 -07:00
Stefan Tomanek
b1d0525f9c ip rule: add route suppression options
When configuring a system with multiple network uplinks and default routes, it
is often convenient to reference a routing table multiple times - but reject
its routing decision if certain constraints are not met by it.

Consider this setup:

$ ip route add table secuplink default via 10.42.23.1

$ ip rule add pref 100            table main suppress_prefixlength 0
$ ip rule add pref 150 fwmark 0xA table secuplink

With this setup, packets marked 0xA will be processed by the additional routing
table "secuplink", but only if no suitable route in the main routing table can
be found. By suppressing entries with a prefixlength of 0 (or less), the
default route (/0) of the table "main" is hidden to packets processed by rule
100; packets traveling to destinations via more specific routes are processed
as usual.

It is also possible to suppress a routing entry if a device belonging to
a specific interface group is to be used:

$ ip rule add pref 150 table main suppress_group 1

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
2013-08-04 11:54:15 -07:00
Stefan Tomanek
c4fdf75d3d ip link: fix display of interface groups
This change adds the interface group to the output of "ip link show".

It also makes "ip link" print _all_ devices if no group filter is specified;
previously, only interfaces of the default group (0) were shown.

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
2013-08-04 11:50:38 -07:00
Nicolas Dichtel
77620be89a ip: allow to specify mode for sit tunnels
It's now possible to have IPv4 and IPv6 over IPv4 tunnels with the module sit.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-07-26 14:30:36 -07:00
Nicolas Dichtel
973eb50b18 ipadress: fix display of IPv6 peer address
Because only IPv4 was supported, the size was static. Now, IPv6 also supports
peer address.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-07-26 14:27:19 -07:00
Atzm Watanabe
7cfa3802ca vxlan: Allow setting destination to unicast address.
This patch allows setting VXLAN destination to unicast address.
It allows that VXLAN can be used as peer-to-peer tunnel without
multicast.

v6: change back to the v3 except for using new attribute because
    replacing command-line parameters breaks existing scripts,
    based by Cong Wang's comments.

v5: rebase on the latest.

v4: replace "group" with "remote" based by David Stevens's comments.

v3: move a new attribute REMOTE into the last of an enum list
    based by Stephen Hemminger's comments.
    fix the usage to show explicitly that both "remote" and "group"
    cannot be specified, based by Ben Hutchings's comments.

v2: use a new argument "remote" instead of "group" based by
    Stephen Hemminger's comments.

Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
2013-07-26 14:25:42 -07:00
Stephen Hemminger
cc71ad3ddd Merge branch 'net-next-3.10' 2013-07-16 10:20:31 -07:00
Stephen Hemminger
a3aa47a559 Make tc and ip batch mode consistent
Change the code for tc and ip so that batch mode is handled
the same.
2013-07-16 10:04:05 -07:00
Stephen Hemminger
a05f6511f5 netns: follow return value conventions of the rest of the code
The netns code was using EXIT_SUCCESS/EXIT_FAILURE but the rest of the ip
code used -1 explictly, so change to follow convention. Also, certain types
of errors like fork failure should abort a batch operation, rather than just
returning an error.
2013-07-12 08:43:23 -07:00
JunweiZhang
95592b47be ipbatch: fix use of 'ip netns exec'
execvp() does not return when the command succeed, hence all commands in the
batch file after the line 'ip netns exec' are not executed.

Let's fork before calling execvp() if batch mode is used..

Example:
$ cat test.batch
netns add netns1
netns exec netns1 ip l
netns
$ ip -b test.batch
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT
    link/sit 0.0.0.0 brd 0.0.0.0

All command after 'netns exec' are never executed.

With the patch:
$ ip -b test.batch
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT
    link/sit 0.0.0.0 brd 0.0.0.0
netns1

Now, existing netns are displayed.

Signed-off-by: JunweiZhang <junwei.zhang@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2013-07-09 09:14:10 -07:00
Amerigo Wang
86c00faae2 iptunnel: check SIT_ISATAP flag only for SIT tunnel
Without patch, I got:

	# ./ip/ip tunnel show
	ip_vti0: ioctl 89f4 failed: Invalid argument
	ip_vti0: ip/ip  remote any  local any  ttl inherit  nopmtudisc key 0

this is due to VTI_ISVTI has the same numeric value with SIT_ISATAP,
but only sit tunnel has SIOCGETPRL, therefore it should check for SIT
tunnel first.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
2013-07-09 09:08:14 -07:00
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
Cong Wang
b37f2c895d add quickack option to ip route
This patch adds quickack option to enable/disable TCP quick ack
mode for per-route.

Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <amwang@redhat.com>
2013-06-20 08:35:21 -07:00
Rony Efraim
07fa9c1529 Add VF link state control
Add link state per VF command

Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
2013-06-19 18:14:39 -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
Nicolas Dichtel
e34d3dcce2 ip: use rtnelink to manage mroute
mroute was using /proc/net/ip_mr_[vif|cache] to display mroute entries. Hence,
only RT_TABLE_DEFAULT was displayed and only IPv4.
With rtnetlink, it is possible to display all tables for IPv4 and IPv6. The output
format is kept. Also, like before the patch, statistics are displayed when user specify
the '-s' argument.

The patch also adds the support of 'ip monitor mroute', which is now possible.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-14 10:08:17 -08:00
Nicolas Dichtel
2a898320be ip: update mand pages and usage() for 'ip mroute'
Sync with the current code.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-14 09:56:47 -08:00
Nicolas Dichtel
195f0f62d7 ip/link_iptnl: fix indentation Logged in as shemminger
Use tabs instead of space when possible.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-14 09:50:33 -08:00
David L Stevens
1556e29d3c add DOVE extensions for iproute2
This patch adds a new flag to iproute2 for vxlan devices to enable
DOVE features. It also adds support for L2 and L3 switch lookup miss
netlink messages to "ip monitor".

Changes since v2: fix merge conflict
Changes since v1:
	- split "dove" flag into separate feature flags:
		- "proxy" for ARP reduction
		- "rsc" for route short circuiting
		- "l2miss" for L2 switch miss notifications
		- "l3miss" for L3 switch miss notifications

Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
2012-12-12 10:02:19 -08:00
Nicolas Dichtel
1ce2de9738 ip: add support of 'ip link type [ipip|sit]'
This patch allows to manage ip tunnels via the interface ip link.
The syntax for parameters is the same that 'ip tunnel'.

It also allows to display tunnels parameters with 'ip -details link' or
'ip -details monitor link'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-12 09:10:22 -08:00
Nicolas Dichtel
9d0efc1048 ip: add support of 'ip link type ip6tnl'
This patch allows to manage ip6 tunnels via the interface ip link.
The syntax for parameters is the same that 'ip -6 tunnel'.

It also allows to display tunnels parameters with 'ip -details link' or
'ip -details monitor link'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-12-12 09:09:23 -08:00
Nicolas Dichtel
4852ba750a ip: add support of netconf messages
Example of the output:
$ ip monitor netconf&
[1] 24901
$ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
ipv6 dev lo forwarding off
ipv6 dev eth0 forwarding off
ipv6 all forwarding off
$ echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding
ipv4 dev eth0 forwarding on

$ ip -6 netconf
ipv6 all forwarding on mc_forwarding 0
$ ip netconf show dev eth0
ipv4 dev eth0 forwarding on rp_filter off mc_forwarding 1

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Minor cleanup of original patch, made sure netconf.h matched
result of santized kernel headers
2012-12-12 09:05:51 -08:00
Nicolas Dichtel
df5574d066 ip/ip6tunnel: fix update of tclass and flowlabel
When tclass or flowlabel field were updated, we only performed an OR with the
new value. For example, it was not possible to reset tclass:
  ip -6 tunnel change ip6tnl2 tclass 0

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-11-16 08:15:39 -08:00
Nicolas Dichtel
3f83dce573 ip/ip6tunnel: reset encap limit flag on change
Flag IP6_TNL_F_IGN_ENCAP_LIMIT is set when encaplimit is none, but it was not
removed if encaplimit was set on update (ip tunnel change).

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-11-16 08:15:39 -08:00
Nicolas Dichtel
d0c8420c09 ip/ip6tunnel: fix help for TCLASS
Help is "[tclass TCLASS]", but only TOS was described.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-11-16 08:15:39 -08:00
Vincent Bernat
4d6c3796a5 ip: fix "ip -6 route add ... nexthop"
IPv6 multipath routes were not accepted by "ip route" because an IPv4
address was expected for each gateway. Use `get_addr()` instead of
`get_addr32()`.

Signed-off-by: Vincent Bernat <bernat@luffy.cx>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-10-25 09:07:01 -07:00
Or Gerlitz
de0389935f iplink: Added support for the kernel IPoIB RTNL ops
Added support to ipoib rtnl ops through which one can create, configure,
query and delete IPoIB devices, for example

 $ ip link add link ib0.8001 name ib0.8001 type ipoib pkey 0x8001
 $ ip link add link ib0.1 name ib0.1 type ipoib mode connected
 $ ip --details link show dev ib0.1

Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
2012-10-25 08:53:12 -07:00
Stephen Hemminger
b64da5a5e0 vxlan: only send group address if defined
Don't send 0 as group address.
2012-10-19 13:25:17 -07:00
Stephen Hemminger
2d596120cf vxlan: add support for port range 2012-10-09 23:39:17 -07:00
Julian Anastasov
ea63a69b6d iproute2: add support for tcp_metrics
ip tcp_metrics/tcpmetrics

	We support get/del for single entry and dump for
show/flush.

v3:
 - fix rtt/rttvar shifts as suggested by Eric Dumazet
 - show rtt/rttvar usecs as suggested by David Laight

Signed-off-by: Julian Anastasov <ja@ssi.bg>
2012-10-08 10:23:07 -07:00
Nicolas Dichtel
6ea3ebafe0 iproute2: inform user when a neighbor is removed
When running 'ip monitor neigh', there is no hint to tell if a neighbor is
updated or deleted.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2012-10-08 09:48:23 -07:00
Petr Písař
7f747fd937 iproute2: List interfaces without net address by default
This fixes regression in iproute2-3.5.1 when `ip addr show' skipped
interfaces without network layer address.

Wrong output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:54:00:0f:03 brd ff:ff:ff:ff:ff:ff
    inet 10.34.25.198/23 brd 10.34.25.255 scope global eth0
    inet6 2620:52:0:2219:250:54ff:fe00:f03/64 scope global dynamic
       valid_lft 2591919sec preferred_lft 604719sec
    inet6 fe80::250:54ff:fe00:f03/64 scope link
       valid_lft forever preferred_lft forever

Expected output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:54:00:0f:03 brd ff:ff:ff:ff:ff:ff
    inet 10.34.25.198/23 brd 10.34.25.255 scope global eth0
    inet6 2620:52:0:2219:250:54ff:fe00:f03/64 scope global dynamic
       valid_lft 2591896sec preferred_lft 604696sec
    inet6 fe80::250:54ff:fe00:f03/64 scope link
       valid_lft forever preferred_lft forever
5: veth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 8a:ec:35:34:1f:a8 brd ff:ff:ff:ff:ff:ff
6: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 2e:97:ef:77:40:82 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Petr Písař <ppisar@redhat.com>
2012-10-03 08:47:14 -07:00
Stephen Hemminger
a5494df2c1 vxlan support 2012-10-01 08:36:50 -07:00
Stephen Hemminger
27bca61531 Add support for AF_BRIDGE
This can be useful when displaying neighbour table
2012-09-17 15:50:27 -07:00
Julian Anastasov
328d482c48 iproute2: GENL: merge GENL_REQUEST and GENL_INITIALIZER
Both macros are used together, so better to have
single define. Update all requests in ipl2tp.c to use the
new macro.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
2012-09-17 15:46:45 -07:00
Pavel Emelyanov
81824ac228 iproute: Add ability to save, restore and show the interfaces' addresses (resend)
This functionality is required by checkpoint-restore project. Since the
dump and restore for routes is already done in ip tool it's naturally to
dump and restore addresses in the ip tool as well.

The implementation logic is the same as for the respective one for routes.
The magic number digits are taken from the Seattle coordinates.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-11 09:18:21 -07:00
Julian Anastasov
4ef9ff2a8f iproute2: use libgenl in ipl2tp
Use the common code from libgenl.c to parse family, and initialize
structures.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
2012-09-11 09:05:42 -07:00
Pavel Emelyanov
93b7986345 iproute: Add route showdump command (v2)
Some time ago the save+restore commands were added to ip route (git
id f4ff11e3, Add ip route save/restore). These two save the raw rtnl
stream into a file and restore one (reading it from stdin).

The problem is that there's no way to get the contents of the dump
file in a human readable form. The proposal is to add a command that
reads the rtnl stream from stdin and prints the data in a way the
usual "ip route list" does?

changes since v1:

* Take the magic at the beginning of the dump file into account
* Check for stdin (the dump is taken from) is not a tty

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-07 09:13:32 -07:00
Pavel Emelyanov
76c61b34a6 iproute: Add magic cookie to route dump file
In order to somehow verify that a blob contains route dump a
4-bytes magic is put at the head of the data and is checked
on restore.

Magic digits are taken from Portland (OR) coordinates :) Is
there any more reliable way of generating such?

Signed-of-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-07 09:10:51 -07:00
Dan Kenigsberg
f1675d615b utils: invarg: msg precedes the faulty arg
fix all call which reversed the arg order.

Signed-off-by: Dan Kenigsberg <danken@redhat.com>
2012-08-17 13:35:36 -07:00
Mike Frysinger
af9d406f99 Fix regression with 'ip address show'
`ip a s` no longer shows addresses since 3.4.0 works, but 3.5.0,

the simple test case:
make clean && make -j -s && ./ip/ip a s lo

before that change, i would get:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

but after, i now get:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

seems like the bug was introduced in the middle of that patch:

-	if (filter.family != AF_PACKET) {
+	if (filter.family && filter.family != AF_PACKET) {
+		if (filter.oneline)
+			no_link = 1;
+
 		if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
 			perror("Cannot send dump request");
 			exit(1);

if i revert the change to the if statement there, `ip a s` works for me again.
2012-08-13 08:09:52 -07:00
Jiri Pirko
d992f3e611 iplink: add support for num[tr]xqueues 2012-08-01 16:19:55 -07:00
Saurabh
7357933907 iproute2: VTI support for ip link command.
Support for VTI via rt netlink.

Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
2012-08-01 16:13:32 -07:00
Saurabh Mohan
eec476088a VTI support for ip tunnel
Configure VTI using 'ip tunnel'
2012-08-01 16:11:25 -07:00
Stephen Hemminger
fa1f7441a9 Remove reference to multipath algorithms in usage
IP multipath algorithms support was removed several revisions ago.
Remove from usage as well
2012-07-26 16:12:20 -07:00
Stephen Hemminger
8d07e5f7d9 Refactor ipaddr_list_or_flush
Alternative solution to problem reported by Pravin B Shelar <pshelar@nicira.com>
Split large function ipaddr_list_or_flush into components.
Fix memory leak of address and link nlmsg info.
Avoid fetching address info if only flushing.
2012-07-13 13:37:50 -07:00
Eric Dumazet
62e2e54091 ip: speedup ip link
ip link has quadratic behavior because store_nlmsg()
has a head list pointer and search the end of list.

Provides a head/tail to cut time.

Time with 128000 net devices, to do "ip link show dev xxx"

Before: 2m3.594s
After: 0m2.830s

Signed-off-by: Eric Dumazet <edumazet@google.com>
2012-06-11 14:55:23 -07:00
Chris Elston
6618e334ba iproute2: allow IPv6 addresses for l2tp local and remote parameters
Adds support for parsing IPv6 addresses to the parameters local and
remote in the l2tp commands. Requires netlink attributes L2TP_ATTR_IP6_SADDR
and L2TP_ATTR_IP6_DADDR, added in a required kernel patch already submitted
to netdev.

Also enables printing of IPv6 addresses returned by the L2TP_CMD_TUNNEL_GET
request.

Signed-off-by: Chris Elston <celston@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
2012-05-22 14:24:46 -07:00
Andreas Henriksson
6e30461e73 iproute2: man page and /bin/ip disagree on del vs delete
Reported by Robert Henney:
> the 'ip' man page does not mention the command "del" at all but does
> claim, "As a rule, it is possible to add, delete and show (or list ) objects".
> however, 'ip' does not always recognize "delete" as a commend.
>
> robh@debian:~$ ip tunnel delete
> Command "delete" is unknown, try "ip tunnel help".

Lets use "delete" in all calls to matches() for consistency. This will
make both "del" and "delete" work everywhere.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2012-05-21 15:17:28 -07:00
Stephen Hemminger
e278088076 Revert "iproute2: allow IPv6 addresses for l2tp local and remote parameters"
This reverts commit 16eba34485.
Hold off until next release.
2012-04-26 08:06:38 -07:00
Chris Elston
16eba34485 iproute2: allow IPv6 addresses for l2tp local and remote parameters
Adds support for parsing IPv6 addresses to the parameters local and
remote in the l2tp commands. Requires netlink attributes L2TP_ATTR_IP6_SADDR
and L2TP_ATTR_IP6_DADDR, added in a required kernel patch already submitted
to netdev.

Also enables printing of IPv6 addresses returned by the L2TP_CMD_TUNNEL_GET
request.

Signed-off-by: Chris Elston <celston@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
2012-04-25 13:12:37 -07:00
Christoph J. Thompson
5c434a9e5a 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>
2012-04-12 09:49:10 -07:00
Stephen Hemminger
ff24746cca Convert to use rta_getattr_ functions
User new functions (inspired by libmnl) to do type safe access
of routeing attributes
2012-04-10 08:47:55 -07:00
Jorge Boncompte [DTI2]
49b730d7b2 iproute: show metrics as an unsigned value
Avoids showing negative metrics.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
2012-04-10 08:23:59 -07:00
Stephen Hemminger
4ccfb44dfb 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.
2012-04-05 15:10:19 -07:00
Stephen Hemminger
4f2fdd44b6 Add ability to set link state with ip
Exposes existing netlink operations to modify link state of devices.
2012-04-05 15:08:57 -07:00
João Valverde
ae5555d334 ipl2tp: allow setting session interface name
Hi,

I've attached a trivial patch for iproute2 to allow naming interfaces
created with "ip l2tp add session".

I believe patches should go through the netdev mailing list but this
patch is so small I figured that would just add noise. Hope that's OK.

Originally I thought I would need a bigger patch and was going to take a
stab at implementing something like

ip l2tp add tunnel L2TP_TUNNEL_ARGS
ip link add name NAME  [ LINK_OPTS ] type l2tp L2TP_SESSION_ARGS

(a better interface IMHO) but all the code was there already, all that I
needed to add was option parsing.

Thanks,

João Valverde

From fd8c3b712527d2e959aeabc6f6b71a9910e7be7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= <joao.valverde@ist.utl.pt>
Date: Mon, 26 Mar 2012 18:30:56 +0100
Subject: [PATCH] ipl2tp: allow setting session interface name
2012-04-03 11:38:51 -07:00
Stephen Hemminger
82499282b2 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.
---
2012-03-19 17:24:43 -07:00
Stephen Hemminger
718165534d gre: allow 0 as a legal key value
There is nothing in the standard that says 0 can't be used as a key.
It makes sense to allow it. Also fix typo where ikey was printed for
when printing okey.
2012-03-19 17:18:49 -07:00
Florian Westphal
598a42c091 ip: xfrm: report nat-t/encapsulation portmapping updates
Signed-off-by: Florian Westphal <fw@strlen.de>
2012-03-15 14:49:03 -07:00
Stephen Hemminger
09fa327941 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 1.1.1.1 key 3
 # ip li set mytunnel type gretap key 9
2012-03-14 10:28:33 -07:00
Yegor Yefremov
8ced4fcd50 iproute2: cleanup dependencies
LIBNETLINK will be defined in the main Makefile, so
both ../lib/libnetlink.a ../lib/libutil.a will be
automatically appended during linking. Otherwise
../lib/libnetlink.a ../lib/libutil.a will appear
twice during linking.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2012-02-27 08:27:54 -08:00
Stephen Hemminger
e6e6fb5c6a ipaddress: cleanup code for link stats64
On 64 bit platform, casting to unsigned long long is unnecessary.
Use inttypes.h and stdtypes.h to resolve it.
2012-02-21 17:18:59 -08:00
Tony Zelenoff
1dac7817b4 Modify neighbour proxy show
New "ip neigh show proxy" command now can show proxies which
were added with "ip neigh add proxy" command. Kernel code to
support this feature sent a bit earlier to netdev.

Signed-off-by: Tony Zelenoff <antonz@parallels.com>
2012-02-09 15:06:52 -08:00
Stephen Hemminger
5aa08f6bf4 ip: make 'ip l' be 'ip link'
Restore compatiablity for those lazy typists.
2012-01-20 08:16:02 -08:00
Stephen Hemminger
13603f6a9e iplt2p: remove unused libnl headers
Leftover from change to original code.
2012-01-10 08:50:49 -08:00
Stephen Hemminger
38cd311ade l2tp: Add l2tp support
Based on earlier implementation by James Chapman. But instead of
dragging in all of libnl, use existing libnetlink infrastructure.
2011-12-29 09:35:37 -08:00
Stephen Hemminger
cd70f3f522 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
it.
2011-12-28 10:37:12 -08:00
Stephen Hemminger
6cf8398f5f libnetlink: change rtnl_send() to take void *
Avoid having to cast buffer being sent.
2011-12-23 10:41:50 -08:00
Greg Rose
7b8179c780 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>
2011-11-23 14:53:12 -08:00
Stephen Hemminger
7397944de6 ip: fix exit codes
Alternative fix to problem reported by: Bin Li
The issue is came from https://bugzilla.novell.com/show_bug.cgi?id=681952.

In any previous version (since suse ... 10.0?), ip addr add always returned
the error code 2 in case the ip address is already set on the interface:

    inet 172.16.2.3/24 brd 172.16.2.255 scope global bond0
RTNETLINK answers: File exists
2

On 11.4, it returns the exit code 254:

    inet 172.16.1.1/24 brd 172.16.1.255 scope global eth0
RTNETLINK answers: File exists
254

This of course causes ifup to return an error in this quite common case..
2011-10-13 08:38:33 -07:00
Thomas Jarosch
19bcc05bea Fix file descriptor leak on error in read_igmp()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:20:23 -07:00
Thomas Jarosch
297452a1c2 Fix file descriptor leak in do_tunnels_list()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:20:22 -07:00
Thomas Jarosch
e588a7db16 Fix file descriptor leak on error in read_mroute_list()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:20:21 -07:00
Thomas Jarosch
67ef60a293 Fix file descriptor leak on error in read_viftable()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:18:41 -07:00
Thomas Jarosch
25352af7c2 Fix file descriptor leak on error in iproute_flush_cache()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:18:09 -07:00
Thomas Jarosch
e9a927dc08 Add missing closedir() call in do_show()
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-07 11:17:41 -07:00
Jiri Benc
21a5a6b378 iproute2: fix changing of ip6ip6 tunnel parameters
When changing ip6ip6 parameters (ip -6 tun change), ip passes zeroed
struct ip6_tnl_parm to the kernel. The kernel then tries to change all of
the tunnel parameters to the passed values, including zeroing of local and
remote address. This fails (-EEXIST in net/ipv6/ip6_tunnel.c:ip6_tnl_ioctl).

For other tunnel types, ip fetches the current parameters first and applies
the required changes on top of them. This patch applies the same code as in
ip/iptunnel.c to ip/ip6tunnel.c.

See http://bugzilla.redhat.com/730627 for the original bug report.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2011-10-07 11:14:47 -07:00
Sridhar Samudrala
a22e92951d 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>
2011-10-07 11:04:46 -07:00
Dan McGee
1313ceb4d6 iptuntap: avoid double open
would leak a file handle
2011-08-31 12:14:51 -07:00
Eric W. Biederman
223f4d8ea6 iproute2: Fail "ip netns add" on existing network namespaces.
Use O_EXCL so that we only create and mount a new network namespace
if there is no chance an existing network namespace is present.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2011-08-31 11:02:26 -07:00
Eric W. Biederman
2e8a07f543 iproute2: Auto-detect the presence of setns in libc
If libc has setns present use that version instead of
rolling the syscall wrapper by hand.

Dan McGee found the following compile error:

    gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I../include
    -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib/\"   -c -o ipnetns.o ipnetns.c
    ipnetns.c:31:12: error: static declaration of ‘setns’ follows non-static
    declaration
    /usr/include/bits/sched.h:93:12: note: previous declaration of ‘setns’
    was here
    make[1]: *** [ipnetns.o] Error 1

Reported-by:  Dan McGee <dan@archlinux.org>
Tested-by:  Dan McGee <dan@archlinux.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2011-08-31 11:02:02 -07:00
Andreas Henriksson
c0c44bfedd iproute2: Remove "monitor" from "ip route help" output
$ ip route help 2>&1 | grep monitor
ip route { add | del | change | append | replace | monitor } ROUTE
$ ip route monitor
Command "monitor" is unknown, try "ip route help".

(I guess what was really intended is "ip monitor route", so just remove
the argument from the help output.)

Originally reported by martin f krafft at http://bugs.debian.org/537681

While at it, also drop all non-existant (route,link,netns) monitor
arguments from the ip(8) man page.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2011-07-20 16:04:04 -07:00
Christoph Biedl
c13f598242 ip: fix display of prefix cache info
The "ip monitor" command does properly decode the "preferred" and
"valid" lifetime records in router advertisements from netlink
messages.
2011-07-20 16:02:50 -07:00
Eric W. Biederman
0dc34c7713 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>
2011-07-13 09:48:26 -07:00
David Ward
cbec021913 xfrm: Update documentation
The ip(8) man page and the "ip xfrm [ XFRM-OBJECT ] help" command output
are updated to include missing options, fix errors, and improve grammar.
There are no functional changes made.

The documentation for the ip command has many different meanings for the
same formatting symbols (which really needs to be fixed). This patch makes
consistent use of brackets [ ] to indicate optional parameters, pipes | to
mean "OR", braces { } to group things together, and dashes - instead of
underscores _ inside of parameter names. The parameters are listed in the
order in which they are parsed in the source code.

There are several parameters and options that are still not mentioned or
need to be described more thoroughly in the "COMMAND SYNTAX" section of
the ip(8) man page. I would appreciate help from the developers with this.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2011-07-11 10:12:06 -07:00
Stephen Hemminger
d93b6b51e6 ip: iproute fix set never used warning 2011-06-20 14:34:11 -07:00
Stephen Hemminger
cdf3585224 ip: addrlabel fix set never used warning 2011-06-20 14:33:55 -07:00
Eric Dumazet
f78e316f25 ip: Support IFLA_TXQLEN in ip link command
Eric Dumazet a écrit :
> We currently use an expensive ioctl() to get device txqueuelen, while
> rtnetlink gave it to us for free. This patch speeds up ip link operation
> when many devices are registered.
>

Here is a 2nd version od this patch, not displaying "qlen 0" useless info

[PATCH iproute2] ip: Support IFLA_TXQLEN in ip link show command

We currently use an expensive ioctl() to get device txqueuelen, while
rtnetlink gave it to us for free. This patch speeds up ip link operation
when many devices are registered.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
2011-05-12 08:55:49 -07:00
Stephen Hemminger
4d91e4f168 Merge branch 'for-2.6.39' of /home/shemminger/iproute2-net-next
Conflicts:
	include/linux/xfrm.h
	ip/iplink.c
2011-04-12 14:42:20 -07:00
Stephen Hemminger
242b8da71b Use INIT_NETDEV_GROUP
Now that headers are sanitized, use the define.
2011-04-12 14:40:14 -07:00
Ulrich Weber
c0635644cd iproute2: parse flag XFRM_POLICY_ICMP
parse flag XFRM_POLICY_ICMP

Signed-off-by: Ulrich Weber <uweber@astaro.com>
2011-04-12 14:38:32 -07:00
Brandon Philips
1f7190db39 ip: fix memory leak in ipmaddr.c
If the continue is taken, then there is a memory leak.

https://bugzilla.novell.com/show_bug.cgi?id=538996

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Brandon Philips <bphilips@suse.de>
2011-04-12 14:23:52 -07:00