]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
8 years agolibnetlink: add size argument to rtnl_talk
Stephen Hemminger [Wed, 27 May 2015 19:26:14 +0000 (12:26 -0700)]
libnetlink: add size argument to rtnl_talk

There have been several instances where response from kernel
has overrun the stack buffer from the caller. Avoid future problems
by passing a size argument.

Also drop the unused peer and group arguments to rtnl_talk.

8 years agogre: raising the size of the buffer holding nl messages.
Jetchko Jekov [Thu, 21 May 2015 14:32:24 +0000 (16:32 +0200)]
gre: raising the size of the buffer holding nl messages.

Now it matches the size for the answer defined in rtnl_talk()
and prevents stack corruption with answer > 1024 bytes.

8 years agoss: Show more info (ring,fanout) for packet socks
Vadim Kochan [Fri, 15 May 2015 14:19:30 +0000 (17:19 +0300)]
ss: Show more info (ring,fanout) for packet socks

Print such info like version, tx/rx ring, fanout for
packet sockets when '-e' option was specified.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
8 years agotests: Add test for 'ip route add default'
Vadim Kochan [Tue, 12 May 2015 14:40:16 +0000 (17:40 +0300)]
tests: Add test for 'ip route add default'

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
8 years agotests: Run each test in network namespace
Vadim Kochan [Tue, 12 May 2015 14:40:15 +0000 (17:40 +0300)]
tests: Run each test in network namespace

Changed to forcely running each test in network
namespace to do not affect on current network setup.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
8 years agotipc: add new TIPC configuration tool
Richard Alpe [Thu, 7 May 2015 13:07:36 +0000 (15:07 +0200)]
tipc: add new TIPC configuration tool

tipc is a user-space configuration tool for TIPC (Transparent
Inter-process Communication). It utilizes the TIPC netlink API in the
kernel to fetch data or perform actions.

The tipc tool has somewhat similar syntax to the ip tool meaning that
users of the ip tool should not feel that unfamiliar with this tool.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
8 years agoUpdate to latest kernel headers
Stephen Hemminger [Thu, 21 May 2015 21:39:27 +0000 (14:39 -0700)]
Update to latest kernel headers

Also add tipc_netlink.h for later TIPC support

8 years agotc: gred: Adopt the term VQ in the command syntax and output
David Ward [Mon, 18 May 2015 15:35:13 +0000 (11:35 -0400)]
tc: gred: Adopt the term VQ in the command syntax and output

In the GRED kernel source code, both of the terms "drop parameters"
(DP) and "virtual queue" (VQ) are used to refer to the same thing.
Each "DP" is better understood as a "set of drop parameters", since
it has values for limit, min, max, avpkt, etc. This terminology can
result in confusion when creating a GRED qdisc having multiple DPs.
Netlink attributes and struct members with the DP name seem to have
been left intact for compatibility, while the term VQ was otherwise
adopted in the code, which is more intuitive.

Use the VQ term in the tc command syntax and output (but maintain
compatibility with the old syntax).

Rewrite the usage text to be concise and similar to other qdiscs.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: gred: Handle unsigned values properly in option parsing/printing
David Ward [Mon, 18 May 2015 15:35:12 +0000 (11:35 -0400)]
tc: gred: Handle unsigned values properly in option parsing/printing

DPs, def_DP, and DP are unsigned values that are sent and received
in TCA_GRED_* netlink attributes; handle them properly when they
are parsed or printed. Use MAX_DPs as the initial value for def_DP
and DP, and fix the operator used for bounds checking them.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: gred: Improve parameter/statistics output
David Ward [Mon, 18 May 2015 15:35:11 +0000 (11:35 -0400)]
tc: gred: Improve parameter/statistics output

Make the output more consistent with the RED qdisc, and only show
details/statistics if the appropriate flag is set when calling tc.

Show the parameters used with "gred setup". Add missing statistics
"pdrop" and "other". Fix format specifiers for unsigned values.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: gred: Print usage text if no arguments appear after "gred"
David Ward [Mon, 18 May 2015 15:35:10 +0000 (11:35 -0400)]
tc: gred: Print usage text if no arguments appear after "gred"

This is more helpful to the user, since the command takes two forms,
and the message that would otherwise appear about missing parameters
assumes one of those forms.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: gred: Fix whitespace issues in code
David Ward [Mon, 18 May 2015 15:35:09 +0000 (11:35 -0400)]
tc: gred: Fix whitespace issues in code

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: red: Mark "bandwidth" parameter as optional in usage text
David Ward [Mon, 18 May 2015 15:35:08 +0000 (11:35 -0400)]
tc: red: Mark "bandwidth" parameter as optional in usage text

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: red, gred: Notify when using the default value for "bandwidth"
David Ward [Mon, 18 May 2015 15:35:07 +0000 (11:35 -0400)]
tc: red, gred: Notify when using the default value for "bandwidth"

The "bandwidth" parameter is optional, but ensure the user is aware
of its default value, to proactively avoid configuration problems.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: red, gred: Fix format specifier in burst size warning
David Ward [Mon, 18 May 2015 15:35:06 +0000 (11:35 -0400)]
tc: red, gred: Fix format specifier in burst size warning

burst is an unsigned value.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
8 years agotc: red, gred: Rename overloaded variable wlog
David Ward [Mon, 18 May 2015 15:35:05 +0000 (11:35 -0400)]
tc: red, gred: Rename overloaded variable wlog

It is used when parsing three different parameters, only one of
which is Wlog. Change the name to make the code less confusing.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
9 years agoman ip-link: Remove extra GROUP explanation
Vadim Kochan [Wed, 13 May 2015 15:03:51 +0000 (18:03 +0300)]
man ip-link: Remove extra GROUP explanation

Remove double explanation of GROUP option from 'ip link set' section.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Add missing lowpan link type
Lennert Buytenhek [Mon, 11 May 2015 07:17:14 +0000 (10:17 +0300)]
man ip-link: Add missing lowpan link type

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
9 years agotc: minor cleanup on ingress
Daniel Borkmann [Sat, 9 May 2015 20:59:17 +0000 (22:59 +0200)]
tc: minor cleanup on ingress

Fix whitespacing and remove the unnecessary condition.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agoss: dctcp changes
Eric Dumazet [Fri, 8 May 2015 20:28:40 +0000 (13:28 -0700)]
ss: dctcp changes

Missing space before dctcp: markers.

With dctcp, cwnd=2 is pretty common, just display cwnd value even
if cwnd has this value, it makes parsing easier.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agoss: small optim in tcp_show_info()
Eric Dumazet [Wed, 6 May 2015 18:33:23 +0000 (11:33 -0700)]
ss: small optim in tcp_show_info()

Kernel can give us smaller tcp_info than our.

We copy the kernel provided structure and fill with 0
the remaining part.

Lets clear only the missing part to save some cycles, as we intend to
slightly increase tcp_info size in the future.

Signed-off-by: Eric Dumazet <edumazet@google.com>
9 years agoroute: Add missing newline in helptext
Thomas Graf [Wed, 6 May 2015 15:25:39 +0000 (17:25 +0200)]
route: Add missing newline in helptext

Signed-off-by: Thomas Graf <tgraf@suug.ch>
9 years agotc: fill in handle before checking argc
WANG Cong [Tue, 5 May 2015 22:30:20 +0000 (15:30 -0700)]
tc: fill in handle before checking argc

When deleting a specific basic filter with handle,
tc command always ignores the 'handle' option, so
tcm_handle is always 0 and kernel deletes all filters
in the selected group. This is wrong, we should respect
'handle' in cmdline.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
9 years agoiproute2: Fix typo in get_prefix_1()
Thomas Graf [Tue, 5 May 2015 00:14:16 +0000 (02:14 +0200)]
iproute2: Fix typo in get_prefix_1()

Fixes a typo in get_prefix_1() which broke the prefix default
names { default | any | all }.

The most obvious fallout from this bug was:

$ ip route add default via 1.1.1.1
Error: an inet prefix is expected rather than "default".

Fixes: dacc5d4197c1 ("add basic mpls support to iproute")
Signed-off-by: Thomas Graf <tgraf@suug.ch>
9 years agoip: fix exit code for addrlabel
Stephen Hemminger [Wed, 6 May 2015 16:55:07 +0000 (09:55 -0700)]
ip: fix exit code for addrlabel

The exit code for ip label was not correct.
The return from the command function is negated and turned into
the exit code on failure.

9 years agoip: fix exit code for rule failures
Stephen Hemminger [Wed, 6 May 2015 16:53:41 +0000 (09:53 -0700)]
ip: fix exit code for rule failures

If ip rule command fails talking to kernel, exit code should be 2.
The sub-command is called by cmd loop and the exit code is negative
of return value from the command callback.

9 years agoip: return correct exit code on route failure
Stephen Hemminger [Wed, 6 May 2015 16:48:06 +0000 (09:48 -0700)]
ip: return correct exit code on route failure

If kernel complains about ip route request, exit status should be
2 not 1.

This fixes regression introduced by:
commit 42ecedd4bae534fc688194a795eb4548c6530cda
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date:   Tue Mar 17 19:26:32 2015 -0700

    fix ip -force -batch to continue on errors

9 years agoip: document exit code
Stephen Hemminger [Wed, 6 May 2015 16:47:22 +0000 (09:47 -0700)]
ip: document exit code

The ip command has always had a consistent exit status
document it so that developers see it.

9 years agoip link set vf: Added "query_rss" command
Vlad Zolotarov [Thu, 30 Apr 2015 10:46:43 +0000 (13:46 +0300)]
ip link set vf: Added "query_rss" command

Add a new option to toggle the ability of querying the RSS configuration of a specific VF.

VF RSS information like RSS hash key may be considered sensitive on some devices where
this information is shared between VF and PF and thus its querying may be prohibited by default.

This new option allows a system administrator with privileges to modify a PF state
to control if the above VF querying is allowed or not.

For example:
 To enable RSS querying of VF[0] of ethX:
 >> ip link set dev ethX vf 0 query_rss on

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
9 years agoip link: Add group in usage() for 'ip link delete'
Vadim Kochan [Fri, 1 May 2015 19:26:52 +0000 (22:26 +0300)]
ip link: Add group in usage() for 'ip link delete'

Show deleting by group in 'ip link help' output:

...
ip link delete { DEVICE | dev DEVICE | group DEVGROUP } type TYPE [ ARGS ]
...

Also show separately DEVICE option in { } list.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Add deleting links by group
Vadim Kochan [Fri, 1 May 2015 18:46:41 +0000 (21:46 +0300)]
man ip-link: Add deleting links by group

Indicate possibility deleting virtual links by group.

Also changed the alignment of 'ip link delete' args
descriptions, to look like similary to 'ip link set'.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Fix wrong filter behaviour
Vadim Kochan [Thu, 30 Apr 2015 04:30:24 +0000 (07:30 +0300)]
ss: Fix wrong filter behaviour

Fixed applying family & socket type filters.
It was not possible to select UDP & UNIX sockets together.

Now selected families are ORed.

The problem was that filters were combined by AND.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Reported-By: Mihai Moldovan <ionic@ionic.de>
9 years agotc: {m, f}_ebpf: add option for dumping verifier log
Daniel Borkmann [Tue, 28 Apr 2015 11:37:42 +0000 (13:37 +0200)]
tc: {m, f}_ebpf: add option for dumping verifier log

Currently, only on error we get a log dump, but I found it useful when
working with eBPF to have an option to also dump the log on success.
Also spotted a typo in a header comment, which is fixed here as well.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
9 years agoip: Add color output option
Mathias Nyman [Tue, 28 Apr 2015 10:18:21 +0000 (13:18 +0300)]
ip: Add color output option

It is hard to quickly find what you are looking for in the output of the
ip command. Color helps.

This patch adds a '-c' flag to highlight these with individual colors:
  - interface name
  - ip address
  - mac address
  - up/down state

Signed-off-by: Mathias Nyman <m.nyman@iki.fi>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
9 years agoupdate headers to reflect BPF changes
Stephen Hemminger [Wed, 29 Apr 2015 19:33:24 +0000 (12:33 -0700)]
update headers to reflect BPF changes

Reclone sanitized headers from 4.1-rc

9 years agoexamples: bpf: fix ld offs to have same prog loaded on ingress/egress
Daniel Borkmann [Mon, 20 Apr 2015 11:48:54 +0000 (13:48 +0200)]
examples: bpf: fix ld offs to have same prog loaded on ingress/egress

Fix up the eBPF example program to match our kernel fix in a166151cbe33 ("bpf:
fix bpf helpers to use skb->mac_header relative offsets"). Tested on ingress
and egress paths.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
9 years agotc: built-in eBPF exec proxy
Daniel Borkmann [Thu, 16 Apr 2015 19:20:06 +0000 (21:20 +0200)]
tc: built-in eBPF exec proxy

This work follows upon commit 6256f8c9e45f ("tc, bpf: finalize eBPF
support for cls and act front-end") and takes up the idea proposed by
Hannes Frederic Sowa to spawn a shell (or any other command) that holds
generated eBPF map file descriptors.

File descriptors, based on their id, are being fetched from the same
unix domain socket as demonstrated in the bpf_agent, the shell spawned
via execvpe(2) and the map fds passed over the environment, and thus
are made available to applications in the fashion of std{in,out,err}
for read/write access, for example in case of iproute2's examples/bpf/:

  # env | grep BPF
  BPF_NUM_MAPS=3
  BPF_MAP1=6        <- BPF_MAP_ID_QUEUE (id 1)
  BPF_MAP0=5        <- BPF_MAP_ID_PROTO (id 0)
  BPF_MAP2=7        <- BPF_MAP_ID_DROPS (id 2)

  # ls -la /proc/self/fd
  [...]
  lrwx------. 1 root root 64 Apr 14 16:46 0 -> /dev/pts/4
  lrwx------. 1 root root 64 Apr 14 16:46 1 -> /dev/pts/4
  lrwx------. 1 root root 64 Apr 14 16:46 2 -> /dev/pts/4
  [...]
  lrwx------. 1 root root 64 Apr 14 16:46 5 -> anon_inode:bpf-map
  lrwx------. 1 root root 64 Apr 14 16:46 6 -> anon_inode:bpf-map
  lrwx------. 1 root root 64 Apr 14 16:46 7 -> anon_inode:bpf-map

The advantage (as opposed to the direct/native usage) is that now the
shell is map fd owner and applications can terminate and easily reattach
to descriptors w/o any kernel changes. Moreover, multiple applications
can easily read/write eBPF maps simultaneously.

To further allow users for experimenting with that, next step is to add
a small helper that can get along with simple data types, so that also
shell scripts can make use of bpf syscall, f.e to read/write into maps.

Generally, this allows for prepopulating maps, or any runtime altering
which could influence eBPF program behaviour (f.e. different run-time
classifications, skb modifications, ...), dumping of statistics, etc.

Reference: http://thread.gmane.org/gmane.linux.network/357471/focus=357860
Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
9 years agomroute: remove invalid check against NLM_F_MULTI
Nicolas Dichtel [Wed, 22 Apr 2015 08:27:07 +0000 (10:27 +0200)]
mroute: remove invalid check against NLM_F_MULTI

This flag is only for the netlink protocol (multi-part messages), no reason
to reject messages without it.

Note that this flag was removed by the following kernel patches (v3.14)
65886f439ab0 ipmr: fix mfc notification flags
f518338b1603 ip6mr: fix mfc notification flags

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agolibnamespaces: fix warning about syscall()
Nicolas Dichtel [Wed, 22 Apr 2015 08:27:06 +0000 (10:27 +0200)]
libnamespaces: fix warning about syscall()

The warning was:
In file included from namespace.c:14:0:
../include/namespace.h: In function ‘setns’:
../include/namespace.h:37:2: warning: implicit declaration of function ‘syscall’ [-Wimplicit-function-declaration]

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agotc: fix compilation warning on 32bits arch
Nicolas Dichtel [Wed, 22 Apr 2015 08:27:05 +0000 (10:27 +0200)]
tc: fix compilation warning on 32bits arch

The warning was:
m_simple.c: In function ‘parse_simple’:
m_simple.c:142:4: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’ [-Wformat]

Useful to be able to compile with -Werror.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agotc util: Fix possible buffer overflow when print class id
Vadim Kochan [Mon, 20 Apr 2015 05:33:32 +0000 (08:33 +0300)]
tc util: Fix possible buffer overflow when print class id

Use correct handle buffer length.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoipxfrm: wrong nl msg sent on deleteall cmd
Nicolas Dichtel [Wed, 15 Apr 2015 12:00:53 +0000 (14:00 +0200)]
ipxfrm: wrong nl msg sent on deleteall cmd

XFRM netlink family is independent from the route netlink family. It's wrong
to call rtnl_wilddump_request(), because it will add a 'struct ifinfomsg' into
the header and the kernel will complain (at least for xfrm state):

netlink: 24 bytes leftover after parsing attributes in process `ip'.

Reported-by: Gregory Hoggarth <Gregory.Hoggarth@alliedtelesis.co.nz>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agonetns: allow to dump and monitor nsid
Nicolas Dichtel [Wed, 15 Apr 2015 12:23:22 +0000 (14:23 +0200)]
netns: allow to dump and monitor nsid

Two commands are added:
 - ip netns list-id
 - ip monitor nsid

A cache is also added to remember the association between the iproute2 netns
name (from /var/run/netns/) and the nsid.
To avoid interfering with the rth socket, a new rtnl socket (rtnsh) is used to
get nsid (we may send rtnl request during listing on rth).

Example:
$ ip netns list-id
nsid 0 (iproute2 netns name: foo)
$ ip monitor nsid
Deleted nsid 0 (iproute2 netns name: foo)
nsid 16 (iproute2 netns name: bar)

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agolnstat: dump to stdout, not stderr
Pavel Šimerda [Mon, 13 Apr 2015 14:01:00 +0000 (16:01 +0200)]
lnstat: dump to stdout, not stderr

See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=736332

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agolnstat: run indefinitely by default
Pavel Šimerda [Mon, 13 Apr 2015 14:01:01 +0000 (16:01 +0200)]
lnstat: run indefinitely by default

See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=977845

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agocbq: fix find syntax in example
Pavel Šimerda [Mon, 13 Apr 2015 14:00:58 +0000 (16:00 +0200)]
cbq: fix find syntax in example

Without modification, using the example resulted in the following error:

[root@localhost sbin]# cbq restart
find: warning: you have specified the -maxdepth option after a
non-option argument (, but options are not positional (-maxdepth affects
tests specified before it as well as those specified after it).  Please
specify options before other arguments.

find: warning: you have specified the -maxdepth option after a
non-option argument (, but options are not positional (-maxdepth affects
tests specified before it as well as those specified after it).  Please
specify options before other arguments.

**CBQ: failed to compile CBQ configuration!

See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=539232

Reported-by: Mads Kiilerich <mads@kiilerich.com>
Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agoip-xfrm: support 'proto any' with 'sport' and 'dport'
Pavel Šimerda [Mon, 13 Apr 2015 14:00:57 +0000 (16:00 +0200)]
ip-xfrm: support 'proto any' with 'sport' and 'dport'

When creating an IPsec SA that sets 'proto any' (IPPROTO_IP) and
specifies 'sport' and 'dport' at the same time in selector, the
following error is issued:

"sport" and "dport" are invalid with proto=ip

However using IPPROTO_IP with ports is completely legal and necessary
when one wants to share the SA on both TCP and UDP. One of the
applications requiring sharing SAs is 3GPP IMS AKA authentication.

See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=497355

Reported-by: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agoturn Makefile more distribution friendly
Pavel Šimerda [Mon, 13 Apr 2015 14:00:56 +0000 (16:00 +0200)]
turn Makefile more distribution friendly

Changes:

 * Accept directory settings from environment.
 * Remove redundant ROOTDIR variable.
 * Set KERNEL_INCLUDE default to '/usr/include'.
 * Use CFLAGS from environemnt.

Note: In the long term it might be better to improve the configure
script to generate those parts of the Makefile in a manner similar
to autoconf. It might be even practical to autotoolize the package.

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agotc: add support for connmark action
Felix Fietkau [Sun, 15 Feb 2015 16:57:19 +0000 (11:57 -0500)]
tc: add support for connmark action

Add ability to add the netfilter connmark support.

Typical usage:
...lets tag outgoing icmp with mark 0x10..
iptables -tmangle -A PREROUTING -p icmp -j CONNMARK --set-mark 0x10
..add on ingress of $ETH an extractor for connmark...
tc filter add dev $ETH parent ffff: prio 4 protocol ip \
u32 match ip protocol 1 0xff \
flowid 1:1 \
action connmark continue
...if the connmark was 0x11, we police to a ridic rate of 10Kbps
tc filter add dev $ETH parent ffff: prio 5 protocol ip \
handle 0x11 fw flowid 1:1 \
action police rate 10kbit burst 10k

Other ways to use the connmark is to supply the zone, index and
branching choice. Refer to help.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
9 years agoupdate kernel headers and add tc_connmark.h
Stephen Hemminger [Mon, 13 Apr 2015 17:47:00 +0000 (10:47 -0700)]
update kernel headers and add tc_connmark.h

Needed for later tc action patches

9 years agoiproute2: unify naming for entries offloaded to hardware
Andy Gospodarek [Fri, 10 Apr 2015 20:50:40 +0000 (16:50 -0400)]
iproute2: unify naming for entries offloaded to hardware

The kernel now has the capability to offload FDB and FIB entries to hardware.
It is important to let users know if table entries are also offloaded to
hardware.  Currently offloaded FDB entries are indicated by the existence of
the flag 'external' on the entry as of the following commit:

commit 28467b7f3facd6114b2fbe0c9fecf57adbd52e12
Author: Scott Feldman <sfeldma@gmail.com>
Date:   Thu Dec 4 09:57:15 2014 +0100

    bridge/fdb: add flag/indication for FDB entry synced from offload device

When the patch to add support for indicating that FIB entries were also
offloaded as posted to netdev by Scott Feldman it became clear that 'external'
would not be an ideal name for routes.  There could definitely be confusion
about what this might mean since many routes are to external networks -- a
collision/confusion that did not happen with FDB.

Scott Feldman asked me to check with others and build concensus around a name.
After speaking with several people about this I am proposing we refer to both
FDB and FIB entries that are currently backed by hardware (based on the work
done in rocker) with the flag 'offload' appended to the end ofthe entry.

Some people liked the string 'external,' others liked 'hardware,' but the point
is to communicate that these routes are available to something that will will
offload the forwarding normally done by the kernel.  Since the term 'offload'
is used so frequently it seems appropriate to use the same language in
ip/bridge output.

The term 'offload' also seems to resonate with many of the people who have
responded on Scott's original thread or to those who I reached out to directly
and did respond to my query, so it seems we have reached consensus that it
should be the term used going forward.

v2: rebased against net-next branch

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: John W. Linville <linville@tuxdriver.com>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: Scott Feldman <sfeldma@gmail.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Mon, 13 Apr 2015 16:39:46 +0000 (09:39 -0700)]
Merge branch 'master' into net-next

9 years agofix whitespace
Stephen Hemminger [Mon, 13 Apr 2015 16:39:34 +0000 (09:39 -0700)]
fix whitespace

9 years agov4.0.0
Stephen Hemminger [Mon, 13 Apr 2015 15:55:11 +0000 (08:55 -0700)]
v4.0.0

9 years agoipnetns: add a runtime check for RTM_GETNSID support
Nicolas Dichtel [Mon, 13 Apr 2015 08:34:26 +0000 (10:34 +0200)]
ipnetns: add a runtime check for RTM_GETNSID support

The goal of this patch is to test during the runtime if the command RTM_GETNSID
is supported by the kernel.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agoRevert "ip netns: Fix rtnl error while print netns list"
Nicolas Dichtel [Mon, 13 Apr 2015 08:34:25 +0000 (10:34 +0200)]
Revert "ip netns: Fix rtnl error while print netns list"

This reverts commit d116ff34145b00db54a37e2a6282dccd8bc08225.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agoRevert "configure: add missing INCLUDE to netnsid detection"
Nicolas Dichtel [Mon, 13 Apr 2015 08:34:24 +0000 (10:34 +0200)]
Revert "configure: add missing INCLUDE to netnsid detection"

This reverts commit d059de70cafb470f77fc19a42d95f6dc442cf6a3.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agotc, bpf: finalize eBPF support for cls and act front-end
Daniel Borkmann [Wed, 1 Apr 2015 15:57:44 +0000 (17:57 +0200)]
tc, bpf: finalize eBPF support for cls and act front-end

This work finalizes both eBPF front-ends for the classifier and action
part in tc, it allows for custom ELF section selection, a simplified tc
command frontend (while keeping compat), reusing of common maps between
classifier and actions residing in the same object file, and exporting
of all map fds to an eBPF agent for handing off further control in user
space.

It also adds an extensive example of how eBPF can be used, and a minimal
self-contained example agent that dumps map data. The example is well
documented and hopefully provides a good starting point into programming
cls_bpf and act_bpf.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Fri, 10 Apr 2015 20:27:37 +0000 (13:27 -0700)]
Merge branch 'master' into net-next

9 years agoman tc: Add description about class name option
Vadim Kochan [Wed, 8 Apr 2015 15:27:43 +0000 (18:27 +0300)]
man tc: Add description about class name option

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoconfigure: add missing INCLUDE to netnsid detection
Jiri Benc [Wed, 8 Apr 2015 19:42:00 +0000 (21:42 +0200)]
configure: add missing INCLUDE to netnsid detection

Fixes: d116ff34145b0 ("ip netns: Fix rtnl error while print netns list")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
9 years agoxfrm: revise man page and document ip xfrm policy set
Christophe Gouault [Thu, 9 Apr 2015 15:39:33 +0000 (17:39 +0200)]
xfrm: revise man page and document ip xfrm policy set

- document ip xfrm policy set
- update ip xfrm monitor documentation
- in DESCRIPTION section, reorganize grouping of commands

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
9 years agoxfrm: add command for configuring SPD hash table
Christophe Gouault [Thu, 9 Apr 2015 15:39:32 +0000 (17:39 +0200)]
xfrm: add command for configuring SPD hash table

add a new command to configure the SPD hash table:
   ip xfrm policy set [ hthresh4 LBITS RBITS ] [ hthresh6 LBITS RBITS ]

and code to display the SPD hash configuration:
  ip -s -s xfrm policy count

hthresh4: defines minimum local and remote IPv4 prefix lengths of
selectors to hash a policy. If prefix lengths are greater or equal
to the thresholds, then the policy is hashed, otherwise it falls back
in the policy_inexact chained list.

hthresh6: defines minimum local and remote IPv6 prefix lengths of
selectors to hash a policy, otherwise it falls back
in the policy_inexact chained list.

Example:

% ip -s -s xfrm policy count
         SPD IN  0 OUT 0 FWD 0 (Sock: IN 0 OUT 0 FWD 0)
         SPD buckets: count 7 Max 1048576
         SPD IPv4 thresholds: local 32 remote 32
         SPD IPv6 thresholds: local 128 remote 128

% ip xfrm pol set hthresh4 24 16 hthresh6 64 56

% ip -s -s xfrm policy count
         SPD IN  0 OUT 0 FWD 0 (Sock: IN 0 OUT 0 FWD 0)
         SPD buckets: count 7 Max 1048576
         SPD IPv4 thresholds: local 24 remote 16
         SPD IPv6 thresholds: local 64 remote 56

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
9 years agoupdate kernel headers for net-next
Stephen Hemminger [Fri, 10 Apr 2015 20:18:38 +0000 (13:18 -0700)]
update kernel headers for net-next

Current santized kernel headers from net-next

9 years agoxfrm: fix build with later kernel headers
Stephen Hemminger [Fri, 10 Apr 2015 20:17:54 +0000 (13:17 -0700)]
xfrm: fix build with later kernel headers

Need to include netinet/in.h to get the correct glibc headers
instead of getting definitions in linux/in6.h

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Tue, 7 Apr 2015 15:56:14 +0000 (08:56 -0700)]
Merge branch 'master' into net-next

Conflicts:
man/man8/ip-route.8.in

9 years agodocs: make spacing consistent
Pavel Šimerda [Tue, 7 Apr 2015 15:41:36 +0000 (08:41 -0700)]
docs: make spacing consistent

Result of the following command:

    sed -ri 's/\.  /. /g' man/*/*

Signed-Off-By: Pavel Šimerda <psimerda@redhat.com>
9 years agoman ip-link: Add missing link types - vti,ipvlan,nlmon
Vadim Kochan [Sat, 4 Apr 2015 16:00:55 +0000 (19:00 +0300)]
man ip-link: Add missing link types - vti,ipvlan,nlmon

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip-link: Align usage at [link-netns ID] line
Vadim Kochan [Sat, 4 Apr 2015 14:06:19 +0000 (17:06 +0300)]
ip-link: Align usage at [link-netns ID] line

Output of the usage was shifted be cause of missing TAB

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-netns: Fix shifted layout at bottom of 'ip netns del'
Vadim Kochan [Thu, 2 Apr 2015 15:08:03 +0000 (18:08 +0300)]
man ip-netns: Fix shifted layout at bottom of 'ip netns del'

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agotc class: Ignore if default class name file does not exist
Vadim Kochan [Wed, 25 Mar 2015 03:14:37 +0000 (05:14 +0200)]
tc class: Ignore if default class name file does not exist

If '-nm' specified that do not fail if there is no
default class names file in /etc/iproute2.

Changed default class name file cls_names -> tc_cls.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip: support RFC4191 router preference
Lubomir Rintel [Mon, 16 Mar 2015 15:01:47 +0000 (16:01 +0100)]
ip: support RFC4191 router preference

This allows querying and setting the route preference. It's usually set from
the IPv6 Neighbor Discovery Router Advertisement messages.

Introduced in "ipv6: expose RFC4191 route preference via rtnetlink", enqueued
for Linux 4.1.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
9 years agoadd basic mpls support to iproute
Eric W. Biederman [Sun, 15 Mar 2015 19:53:45 +0000 (14:53 -0500)]
add basic mpls support to iproute

- Pull in the uapi mpls.h
- Update rtnetlink.h to include the mpls rtnetlink notification multicast group.
- Define AF_MPLS in utils.h if it is not defined from elsewhere
  as is done with AF_DECnet

The address syntax for multiple mpls labels is a complete invention.
When I looked there seemed to be no wide spread convention for talking
about an mpls label stack in text for.  Sometimes people did:
"{ Label1, Label2, Label3 }", sometimes people would do:
"[ label3, label2, label1 ]", and most of the time label
stacks were not explicitly shown at all.

The syntax I wound up using, so it would not have spaces and so it
would visually distinct from other kinds of addresses is.

label1/label2/label3 Where label1 is the label at the top of the label
stack and label3 is the label at the bottom on the label stack.

When there is a single label this matches what seems to be convention
with other tools.  Just print out the numeric value of the mpls label.

The netlink protocol for labels uses the on the wire format for a
label stack. The ttl and traffic class are expected to be 0.  Using
the on the wire format is common and what happens with other address
types. BGP when passing label stacks also uses this technique with the
exception that the ttl byte is not included making each label in a BGP
label stack 3 bytes instead of 4.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agoadd support for the RTA_NEWDST attribute.
Eric W. Biederman [Sun, 15 Mar 2015 19:53:11 +0000 (14:53 -0500)]
add support for the RTA_NEWDST attribute.

This attribute is like RTA_DST except it specifies the destination
address to place on a packet when it leaves the host.  For ip based
protocols this is destination NAT and not a common part of forwarding.
For protocols like MPLS label swapping is something that typically
happens on every hop.

There is likely to be a RTA_NEWSRC at some point so RTA_NEWDST
is printed as "as to"  and can be specified either as "as to"
or just "as"

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agoadd support for the RTA_VIA attribute
Eric W. Biederman [Sun, 15 Mar 2015 19:52:06 +0000 (14:52 -0500)]
add support for the RTA_VIA attribute

Add support for the RTA_VIA attribute that specifies an address family
as well as an address for the next hop gateway.

To make it easy to pass this reorder inet_prefix so that it's tail
is a proper RTA_VIA attribute.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agomisc whitespace cleanup
Eric W. Biederman [Sun, 15 Mar 2015 19:51:10 +0000 (14:51 -0500)]
misc whitespace cleanup

9 years agoadd address family to/from string helper functions.
Eric W. Biederman [Sun, 15 Mar 2015 19:50:03 +0000 (14:50 -0500)]
add address family to/from string helper functions.

Add the functions family_name and read_family to convert an address
family to a string and to convernt a string to an address family.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agoadd support for printing AF_PACKET addresses
Eric W. Biederman [Sun, 15 Mar 2015 19:49:35 +0000 (14:49 -0500)]
add support for printing AF_PACKET addresses

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agomake the addr argument of ll_addr_n2a const
Eric W. Biederman [Sun, 15 Mar 2015 19:49:10 +0000 (14:49 -0500)]
make the addr argument of ll_addr_n2a const

This avoids build warnings when AF_PACKET support is added
to rt_addr_n2a.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agoadd a source addres length parameter to rt_addr_n2a
Eric W. Biederman [Sun, 15 Mar 2015 19:48:32 +0000 (14:48 -0500)]
add a source addres length parameter to rt_addr_n2a

For some address families (like AF_PACKET) it is helpful to have the
length when prenting the address.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years agotc: add eBPF support to f_bpf
Daniel Borkmann [Mon, 16 Mar 2015 18:37:41 +0000 (19:37 +0100)]
tc: add eBPF support to f_bpf

This work adds the tc frontend for kernel commit e2e9b6541dd4 ("cls_bpf:
add initial eBPF support for programmable classifiers").

A C-like classifier program (f.e. see e2e9b6541dd4) is being compiled via
LLVM's eBPF backend into an ELF file, that is then being passed to tc. tc
then loads, if any, eBPF maps and eBPF opcodes (with fixed-up eBPF map file
descriptors) out of its dedicated sections, and via bpf(2) into the kernel
and then the resulting fd via netlink down to cls_bpf. cls_bpf allows for
annotations, currently, I've used the file name for that, so that the user
can easily identify his filter when dumping configurations back.

Example usage:

  clang -O2 -emit-llvm -c cls.c -o - | llc -march=bpf -filetype=obj -o cls.o
  tc filter add dev em1 parent 1: bpf run object-file cls.o classid x:y

  tc filter show dev em1 [...]
  filter parent 1: protocol all pref 49152 bpf handle 0x1 flowid x:y cls.o

I placed the parser bits derived from Alexei's kernel sample, into tc_bpf.c
as my next step is to also add the same support for BPF action, so we can
have a fully fledged eBPF classifier and action in tc.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
9 years agoupdate kernel headers to net-next 4.0-rc5
Stephen Hemminger [Tue, 24 Mar 2015 22:21:24 +0000 (15:21 -0700)]
update kernel headers to net-next 4.0-rc5

Lastest features

9 years agomisc: header rebase, add bpf.h
Daniel Borkmann [Mon, 16 Mar 2015 17:10:56 +0000 (18:10 +0100)]
misc: header rebase, add bpf.h

Include the bpf.h uapi header file.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
9 years agoip: enable configuring multicast group autojoin
Madhu Challa [Wed, 4 Mar 2015 18:30:10 +0000 (10:30 -0800)]
ip: enable configuring multicast group autojoin

Joining multicast group on ethernet level via "ip maddr" command would
not work if we have an Ethernet switch that does igmp snooping since
the switch would not replicate multicast packets on ports that did not
have IGMP reports for the multicast addresses.

Linux vxlan interfaces created via "ip link add vxlan" have the group option
that enables then to do the required join.

By extending ip address command with option "autojoin" we can get similar
functionality for openvswitch vxlan interfaces as well as other tunneling
mechanisms that need to receive multicast traffic.

example:
ip address add 224.1.1.10/24 dev eth5 autojoin
ip address del 224.1.1.10/24 dev eth5

9 years agoroute: label externally offloaded routes
Scott Feldman [Sun, 8 Mar 2015 06:15:35 +0000 (22:15 -0800)]
route: label externally offloaded routes

On ip route print dump, label externally offloaded routes with "external".
Offloaded routes are flagged with RTNH_F_EXTERNAL, a recent additon to
net-next.  For example:

$ ip route
default via 192.168.0.2 dev eth0
11.0.0.0/30 dev swp1  proto kernel  scope link  src 11.0.0.2 external
11.0.0.4/30 via 11.0.0.1 dev swp1  proto zebra  metric 20 external
11.0.0.8/30 dev swp2  proto kernel  scope link  src 11.0.0.10 external
11.0.0.12/30 via 11.0.0.9 dev swp2  proto zebra  metric 20 external
12.0.0.2  proto zebra  metric 30 external
        nexthop via 11.0.0.1  dev swp1 weight 1
        nexthop via 11.0.0.9  dev swp2 weight 1
12.0.0.3 via 11.0.0.1 dev swp1  proto zebra  metric 20 external
12.0.0.4 via 11.0.0.9 dev swp2  proto zebra  metric 20 external
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.15

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
9 years agoupdate headers files for net-next
Stephen Hemminger [Sun, 15 Mar 2015 19:35:23 +0000 (12:35 -0700)]
update headers files for net-next

Use sanitized headers from 4.0.0-rc3

9 years agotc: m_bpf: fix next arg selection after tc opcode
Daniel Borkmann [Wed, 18 Mar 2015 09:13:34 +0000 (10:13 +0100)]
tc: m_bpf: fix next arg selection after tc opcode

Next argument after the tc opcode/verdict is optional, using NEXT_ARG()
requires to have another argument after that one otherwise tc will bail
out. Therefore, we need to advance to the next argument manually as done
elsewhere.

Fixes: 86ab59a6660f ("tc: add support for BPF based actions")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Pirko <jiri@resnulli.us>
9 years agoman ip-netns: Fix syntax in default ns process, indent's
Vadim Kochan [Tue, 24 Mar 2015 09:41:52 +0000 (11:41 +0200)]
man ip-netns: Fix syntax in default ns process, indent's

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Add ip-netns(8) in 'SEE ALSO'
Vadim Kochan [Thu, 19 Mar 2015 21:09:28 +0000 (23:09 +0200)]
man ip-link: Add ip-netns(8) in 'SEE ALSO'

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolib utils: fix family during af_bit_len calculation
Roopa Prabhu [Wed, 18 Mar 2015 02:18:28 +0000 (19:18 -0700)]
lib utils: fix family during af_bit_len calculation

commit f3a2ddc124e0 ("lib utils: Use helpers to get AF bit/byte len")
used a wrong family or family of zero in the default case
during af_bit_len calculation causing ip route commands to
fail with below error

Error: an inet prefix is expected rather than "10.0.2.14/24".

Reported-by: Sven-Haegar Koch <haegar@sdinet.de>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agoxfrm: Fix -o (oneline) being broken in xfrm and correct mark radix
philipp@redfish-solutions.com [Thu, 19 Mar 2015 19:54:28 +0000 (13:54 -0600)]
xfrm: Fix -o (oneline) being broken in xfrm and correct mark radix

Don't insert newline in -o (oneline) mode; print mark as hex.

Oneline mode is supposed to force all output to be on oneline and
machine-parsable, but this isn't the case for "ip xfrm" as shown:

% ip -o xfrm monitor
...
src 0.0.0.0/0 dst 0.0.0.0/0 \   dir out priority 2051 ptype main \  mark -1879048191/0xffffffff
    tmpl src 203.0.130.10 dst 198.51.130.30\        proto esp reqid 16384 mode tunnel\
...

as that's 2 lines, not one. Also, the "mark" is shown in signed
decimal, but the mask is in hex. This is confusing: let's use
hex for both.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
9 years agofix ip -force -batch to continue on errors
Roopa Prabhu [Wed, 18 Mar 2015 02:26:32 +0000 (19:26 -0700)]
fix ip -force -batch to continue on errors

This patch replaces exits with returns in several
iproute2 commands. This fixes `ip -batch -force`
to not exit but continue on errors.

$cat c.txt
route del 1.2.3.0/24 dev eth0
route del 1.2.4.0/24 dev eth0
route del 1.2.5.0/24 dev eth0
route add 1.2.3.0/24 dev eth0

$ip -force -batch c.txt
RTNETLINK answers: No such process
Command failed c.txt:2
RTNETLINK answers: No such process
Command failed c.txt:3

Reported-by: Sven-Haegar Koch <haegar@sdinet.de>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
9 years agobridge: drop reference to unused option embedded from manpage
Andy Gospodarek [Tue, 17 Mar 2015 15:34:10 +0000 (11:34 -0400)]
bridge: drop reference to unused option embedded from manpage

While looking at the manpage, I noticed a reference to 'embedded' that was
added by this commit:

commit d611682a8c8f28205158e6d3a7d5e2d01db022cc
Author: John Fastabend <john.r.fastabend@intel.com>
Date:   Thu Sep 13 23:50:36 2012 -0700

    iproute2: bridge: finish removing replace option in man pages

I no longer see any reference to the 'embedded' option in any c- or h-files, so
it seems worthwhile to remove.

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: John Fastabend <john.r.fastabend@intel.com>
9 years agoip: Make uniform the use of synonyms list, show and lst
Mark Einon [Mon, 16 Mar 2015 09:59:09 +0000 (09:59 +0000)]
ip: Make uniform the use of synonyms list, show and lst

Where used in the ip tool, the 'show' option always has the synonyms
'list' and 'lst', except for ip-token and ip-addrlabel, which are missing
'lst'. Add this as a synonym for these commands.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
9 years agotc class: Show class names from file
Vadim Kochan [Tue, 3 Mar 2015 16:41:18 +0000 (18:41 +0200)]
tc class: Show class names from file

It is possible to use class names from file /etc/iproute2/cls_names
which tc will use when showing class info:

    # tc/tc -nm class show dev lo
class htb 1:10 parent 1:1 leaf 10: prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
class htb 1:1 root rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
class htb web#1:20 parent 1:1 leaf 20: prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
class htb 1:2 root rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
class htb 1:30 parent 1:1 leaf 30: prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
class htb voip#1:40 parent 1:2 leaf 40: prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
class htb 1:50 parent 1:2 leaf 50: prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
class htb 1:60 parent 1:2 leaf 60: prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b

or to specify via file path:

    # tc/tc -nm -cf /tmp/cls_names class show dev lo

Class names file contains simple "maj:min  name" structure:

1:20    web
1:40    voip

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip netns: Fix rtnl error while print netns list
Vadim Kochan [Sat, 7 Mar 2015 06:30:58 +0000 (08:30 +0200)]
ip netns: Fix rtnl error while print netns list

Observed on the Linux 3.18:

    # ip netns
    RTNETLINK answers: Operation not supported
    net0

CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Fixes: d182ee1307c7 ("ipnetns: allow to get and set netns ids")
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolib utils: Use helpers to get AF bit/byte len
Vadim Kochan [Sat, 28 Feb 2015 00:50:24 +0000 (02:50 +0200)]
lib utils: Use helpers to get AF bit/byte len

Added funcs to get AF_XXX len in bit/bytes and replace
places where switch(AF_XXX) is used for this.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: better 32bit support
Eric Dumazet [Tue, 10 Mar 2015 16:56:47 +0000 (09:56 -0700)]
ss: better 32bit support

Socket cookies are 64bit, even if ss happens to be
a 32bit binary, running on a 64 bit host.

Signed-off-by: Eric Dumazet <edumazet@google.com>
9 years agoss: Allow to specify sport/dport without ':'
Vadim Kochan [Fri, 27 Feb 2015 21:54:36 +0000 (23:54 +0200)]
ss: Allow to specify sport/dport without ':'

Ugly change but it allows to specify sport/dport w/o ':'

    # ss dport = 80 and sport = 44862

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-netns: Notice about loose device when do 'del'
Vadim Kochan [Sun, 15 Mar 2015 15:49:16 +0000 (17:49 +0200)]
man ip-netns: Notice about loose device when do 'del'

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>