]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
9 years agoss: Unify inet sockets output
Vadim Kochan [Tue, 20 Jan 2015 14:14:24 +0000 (16:14 +0200)]
ss: Unify inet sockets output

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Unify meminfo output
Vadim Kochan [Tue, 20 Jan 2015 14:14:23 +0000 (16:14 +0200)]
ss: Unify meminfo output

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agotests: Add few 'ip link' related tests
Vadim Kochan [Thu, 15 Jan 2015 16:59:22 +0000 (18:59 +0200)]
tests: Add few 'ip link' related tests

Added two tests which checks the following fixed issues:

    1) Bug when not possible add new virtual interface via:

        $ ip link add dev XXX type

       It was fixed a few releases ago.

    2) Crash on older kernels when VF rate info does not exist:

        $ ip link show

       Used dump file from William Dauchy <william@gandi.net>:
           testsuite/tests/ip/link/dev_wo_vf_rate.nl

       So 'ip link show' replaced by 'ip -d monitor file ...' which does
       the same thing.

Also added new func in testsuite/lib/generic.sh to gen new random dev name.

Added 'clean' dependency on running all tests.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Filter inet dgram sockets with established state by default
Vadim Kochan [Thu, 8 Jan 2015 17:32:22 +0000 (19:32 +0200)]
ss: Filter inet dgram sockets with established state by default

As inet dgram sockets (udp, raw) can call connect(...)  - they
might be set in ESTABLISHED state. So keep the original behaviour of
'ss' which filtered them by ESTABLISHED state by default. So:

    $ ss -u

    or

    $ ss -w

Will show only ESTABLISHED UDP sockets by default.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolib: fix setns() function when !HAVE_SETNS
Nicolas Dichtel [Thu, 15 Jan 2015 10:36:25 +0000 (11:36 +0100)]
lib: fix setns() function when !HAVE_SETNS

When HAVE_SETNS is not set, iproute2 provides a local implementation of this
function based on __NR_setns.
This macro is defined in sys/syscall.h, which was not included, thus the local
implementation always returned -1.

CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agolib: fix warning in namespace.h
Nicolas Dichtel [Thu, 15 Jan 2015 10:36:24 +0000 (11:36 +0100)]
lib: fix warning in namespace.h

Warning was:
In file included from bridge.c:16:0:
../include/namespace.h:33:12: warning: ‘setns’ defined but not used [-Wunused-function]

CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agoiproute2: ip-link.8.in: Spelling fixes
Reese Moore [Wed, 4 Feb 2015 19:04:48 +0000 (14:04 -0500)]
iproute2: ip-link.8.in: Spelling fixes

In the ip-link(8) man page, for the gretap, ip6gre, and ip6gretap types, the
word tunnel was incorrectly spelled 'tuunel'.

Signed-off-by: Reese Moore <ram@vt.edu>
9 years agoneighbor: check return values
Stephen Hemminger [Wed, 14 Jan 2015 02:06:16 +0000 (18:06 -0800)]
neighbor: check return values

Need to check for invalid address and buffer overrun in ip neigh
command with invalid paramters.

9 years agonetns: Rename & move get_netns_fd to lib
Vadim Kochan [Tue, 13 Jan 2015 20:08:44 +0000 (22:08 +0200)]
netns: Rename & move get_netns_fd to lib

Renamed get_netns_fd -> netns_get_fd and moved to
lib/namespace.c

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoUse one func to print timestamp from nlmsg
Vadim Kochan [Tue, 13 Jan 2015 18:14:24 +0000 (20:14 +0200)]
Use one func to print timestamp from nlmsg

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoAdd define for nlmsg_types with timestamp
Vadim Kochan [Tue, 13 Jan 2015 18:14:23 +0000 (20:14 +0200)]
Add define for nlmsg_types with timestamp

Add #define for nlmsg_type = 15

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Usage filter state names, options alignment
Vadim Kochan [Thu, 8 Jan 2015 02:30:43 +0000 (04:30 +0200)]
ss: Usage filter state names, options alignment

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Fix case when UDP is printed as ipproto-xxx
Vadim Kochan [Thu, 8 Jan 2015 00:42:54 +0000 (02:42 +0200)]
ss: Fix case when UDP is printed as ipproto-xxx

When 'ss' prints UDP sockets info together with RAW sockets
e.g.:

    $ ss -a

then UDP sockets are resolved as "ipproto-xxx".

It was caused that dg_proto was set after printing UDP
socket info from netlink. So fixed issue by moving
setting dg_proto before printing info from Netlink.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip link: Fix crash on older kernels when show VF dev
Vadim Kochan [Fri, 9 Jan 2015 19:24:31 +0000 (21:24 +0200)]
ip link: Fix crash on older kernels when show VF dev

The issue was caused that ifla_vf_rate does not exist on
older kernels and should be checked if it exists as nested attr.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Reported-by: William Dauchy <william@gandi.net>
Tested-by: William Dauchy <william@gandi.net>
9 years agoactions: Get vlan action to work in pipeline
Jamal Hadi Salim [Sun, 11 Jan 2015 14:31:30 +0000 (09:31 -0500)]
actions: Get vlan action to work in pipeline

When specified in a graph such as:
action vlan ... action foobar
the vlan action chewed more than it can swallow

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
9 years agoiplink: print out addrgenmode attribute
Jiri Pirko [Thu, 8 Jan 2015 08:49:55 +0000 (09:49 +0100)]
iplink: print out addrgenmode attribute

addrgenmode is currently write only by ip. So display this information
if provided by kernel as well.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agoss: Filtering logic changing, with fixes
Vadim Kochan [Sun, 4 Jan 2015 20:18:40 +0000 (22:18 +0200)]
ss: Filtering logic changing, with fixes

This patch fixes some filtering combinations issues which does not
work on the 'master' version:

    $ ss -4
    shows inet & unix sockets, instead of only inet sockets

    $ ss -u
    needs to specify 'state closed'

    $ ss src unix:*X11*
    needs to specify '-x' shortcut for UNIX family

    $ ss -A all
    shows only sockets with established states

There might some other issues which was not observed.

Also changed logic for calculating families, socket types and
states filtering. I think that this version is a little simpler
one. Now there are 2 predefined default tables which describes
the following maping:

    family  -> (states, dbs)
    db      -> (states, families)

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Unify packet stats output from netlink and proc
Vadim Kochan [Sun, 4 Jan 2015 20:18:39 +0000 (22:18 +0200)]
ss: Unify packet stats output from netlink and proc

Refactored to use one func for output packet stats info
from both /proc and netlink.

Added possibility to get packet stats info from /proc
by setting environment variable PROC_ROOT or PROC_NET_PACKET.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Unify unix stats output from netlink and proc
Vadim Kochan [Sun, 4 Jan 2015 20:18:38 +0000 (22:18 +0200)]
ss: Unify unix stats output from netlink and proc

Refactored to use one func for output unix stats info
from both /proc and netlink.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolibnetlink: add parse_rtattr_one_nested helper
Jiri Pirko [Tue, 6 Jan 2015 16:23:45 +0000 (17:23 +0100)]
libnetlink: add parse_rtattr_one_nested helper

Sometimes, it is more convenient to get only one specific nested attribute by
type. For example for IFLA_AF_SPEC where type is address family (AF_INET6).
So add this helper for this purpose.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agofix spelling of Kuznetsov
Stephen Hemminger [Sat, 3 Jan 2015 17:58:41 +0000 (09:58 -0800)]
fix spelling of Kuznetsov

Suggested by Vadim Kochan

9 years agobridge/link: add learning_sync policy flag
Scott Feldman [Mon, 29 Dec 2014 20:20:07 +0000 (12:20 -0800)]
bridge/link: add learning_sync policy flag

v2:

Resending now that the dust has cleared in 3.18 on "self" vs. hwmode debate for
brport settings.  learning_sync is now set/cleared using "self" qualifier on
brport.

v1:

Add 'learned_sync' flag to turn on/off syncing of learned MAC addresses from
offload device to bridge's FDB.   Flag is be set/cleared on offload device port
using "self" qualifier:

  $ sudo bridge link set dev swp1 learning_sync on self

  $ bridge -d link show dev swp1
  2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 2
      hairpin off guard off root_block off fastleave off learning off flood off
  2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0
      learning on learning_sync on

Adds new IFLA_BRPORT_LEARNED_SYNCED attribute for IFLA_PROTINFO on the SELF
brport.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
9 years agoman ss: Add state filter description
Vadim Kochan [Thu, 1 Jan 2015 18:01:06 +0000 (10:01 -0800)]
man ss: Add state filter description

Stolen from generated doc/ss.html
Also added reference to RFC 793 for TCP states.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman tc: Add description for -graph option
Vadim Kochan [Sun, 28 Dec 2014 10:33:05 +0000 (12:33 +0200)]
man tc: Add description for -graph option

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip: Small corrections of '-tshort' option in usage
Vadim Kochan [Sun, 28 Dec 2014 09:47:43 +0000 (11:47 +0200)]
ip: Small corrections of '-tshort' option in usage

Fixed -t[short] to -ts[hort] as '-t' is related to
-timestamp option.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agotc: Allow to easy change network namespace
Vadim Kochan [Wed, 24 Dec 2014 21:04:11 +0000 (23:04 +0200)]
tc: Allow to easy change network namespace

Added new '-netns' option to simplify executing following cmd:

    ip netns exec NETNS tc OPTIONS COMMAND OBJECT

    to

    tc -n[etns] NETNS OPTIONS COMMAND OBJECT

e.g.:

    tc -net vnet0 qdisc

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agobridge: Allow to easy change network namespace
Vadim Kochan [Wed, 24 Dec 2014 21:04:10 +0000 (23:04 +0200)]
bridge: Allow to easy change network namespace

Added new '-netns' option to simplify executing following cmd:

    ip netns exec NETNS bridge OPTIONS COMMAND OBJECT

    to

    bridge -n[etns] NETNS OPTIONS COMMAND OBJECT

e.g.:

    bridge -net vnet0 fdb

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agoip: Allow to easy change network namespace
Vadim Kochan [Wed, 24 Dec 2014 21:04:09 +0000 (23:04 +0200)]
ip: Allow to easy change network namespace

Added new '-netns' option to simplify executing following cmd:

    ip netns exec NETNS ip OPTIONS COMMAND OBJECT

    to

    ip -n[etns] NETNS OPTIONS COMMAND OBJECT

e.g.:

    ip -net vnet0 link add br0 type bridge
    ip -n vnet0 link

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agolib: Add netns_switch func for change network namespace
Vadim Kochan [Wed, 24 Dec 2014 21:04:08 +0000 (23:04 +0200)]
lib: Add netns_switch func for change network namespace

New netns_switch func moved to the lib/namespace.c from ip/ipnetns.c
so it can be used from the other tools for fast switching
network namespace.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agoss: Use rtnl_dump_filter for inet_show_netlink
Vadim Kochan [Fri, 26 Dec 2014 02:26:27 +0000 (04:26 +0200)]
ss: Use rtnl_dump_filter for inet_show_netlink

Just another refactoring for ss to use rtnl API from lib

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Small example of 'ip link show master'
Vadim Kochan [Fri, 26 Dec 2014 02:46:20 +0000 (04:46 +0200)]
man ip-link: Small example of 'ip link show master'

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agotc class: Show classes as ASCII graph
Vadim Kochan [Fri, 26 Dec 2014 00:10:06 +0000 (02:10 +0200)]
tc class: Show classes as ASCII graph

Added new '-g[raph]' option which shows classes in the graph view.

Meanwhile only generic stats info output is supported.

e.g.:

$ tc/tc -g class show dev tap0
+---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
|    +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
|    +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
|    |    +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
|    |
|    +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
|
+---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
     +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
     +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
     +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b

$ tc/tc -g -s class show dev tap0
+---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
|    |    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
|    |    rate 0bit 0pps backlog 0b 0p requeues 0
|    |
|    +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
|    |          Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
|    |          rate 0bit 0pps backlog 0b 0p requeues 0
|    |
|    +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
|    |    |     Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
|    |    |     rate 0bit 0pps backlog 0b 0p requeues 0
|    |    |
|    |    +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
|    |               Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
|    |               rate 0bit 0pps backlog 0b 0p requeues 0
|    |
|    +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
|               Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
|               rate 0bit 0pps backlog 0b 0p requeues 0
|
+---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
     |    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
     |    rate 0bit 0pps backlog 0b 0p requeues 0
     |
     +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
     |          Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
     |          rate 0bit 0pps backlog 0b 0p requeues 0
     |
     +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
     |          Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
     |          rate 0bit 0pps backlog 0b 0p requeues 0
     |
     +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
                Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
                rate 0bit 0pps backlog 0b 0p requeues 0

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip: extend "ip-address" man page to reflect the recent flag extensions
Heiner Kallweit [Wed, 24 Dec 2014 22:11:50 +0000 (23:11 +0100)]
ip: extend "ip-address" man page to reflect the recent flag extensions

Extend "ip-address" man page to reflect the recent extension of
allowing to list addresses with flags tentative, deprecated, dadfailed
not being set.

Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
9 years agobridge link: add option 'self'
Roopa Prabhu [Sat, 6 Dec 2014 08:21:01 +0000 (00:21 -0800)]
bridge link: add option 'self'

Currently self is set internally only if hwmode is set.
This makes it necessary for the hw to have a mode.
There is no hwmode really required to go to hardware. So, introduce
self for anybody who wants to target hardware.

v1 -> v2
    - fix a few bugs. Initialize flags to zero: this was required to
    keep the current behaviour unchanged.

v2 -> v3
    - fix comment

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
9 years agoip link: use addattr_nest()/addattr_nest_end()
Duan Jiong [Wed, 17 Dec 2014 07:28:45 +0000 (15:28 +0800)]
ip link: use addattr_nest()/addattr_nest_end()

Use addattr_nest() and addattr_nest_end() to simplify the code.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
9 years agoMerge branch 'net-next'
Stephen Hemminger [Wed, 24 Dec 2014 20:23:00 +0000 (12:23 -0800)]
Merge branch 'net-next'

9 years agov3.18.0
Stephen Hemminger [Wed, 24 Dec 2014 20:20:49 +0000 (12:20 -0800)]
v3.18.0

9 years agoip link: Show devices by type
Vadim Kochan [Wed, 10 Dec 2014 08:11:29 +0000 (10:11 +0200)]
ip link: Show devices by type

Added new option 'type' to 'ip link show'
command which allows to filter devices by type:

    ip link show type bridge
    ip link show type vlan

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip: allow ip address show to list addresses with certain flags not being set
Heiner Kallweit [Mon, 22 Dec 2014 19:18:43 +0000 (20:18 +0100)]
ip: allow ip address show to list addresses with certain flags not being set

Sometimes it's needed to have "ip address show" list only addresses
with certain flags not being set, e.g. in network scripts.
As an example one might want to exclude addresses in "tentative"
or "deprecated" state.

Support listing addresses with flags tentative, deprecated, dadfailed
not being set by prefixing the respective flag with a minus.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
9 years agoip lib: Added shorter timestamp option
Vadim Kochan [Mon, 22 Dec 2014 22:13:58 +0000 (00:13 +0200)]
ip lib: Added shorter timestamp option

Added another timestamp format to look like more logging info:

[2014-12-22T22:36:50.489 ] 2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default
    link/ether 3c:97:0e:a3:86:2e brd ff:ff:ff:ff:ff:ff

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agowhitespace cleanup
Stephen Hemminger [Sat, 20 Dec 2014 23:47:17 +0000 (15:47 -0800)]
whitespace cleanup

Remove all trailing whitespace and space before tabs.

9 years agoss: Dont show netlink and packet sockets by default
Vadim Kochan [Sat, 20 Dec 2014 23:40:55 +0000 (15:40 -0800)]
ss: Dont show netlink and packet sockets by default

Checking by SS_CLOSE state was remowed in:

    (45a4770bc0) ss: Remove checking SS_CLOSE state for packet and netlink

which is not really correct because now by default all sockets are seen
when do 'ss'.

Here is most correct fix which considers specified family.

To see netlink sockets:
    ss -A netlink

To see packet sockets:
    ss -A packet

And ss by default will show only connected/established sockets as it
was before all the time.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoupdate kernel headers to 3.19-rc1
Stephen Hemminger [Sat, 20 Dec 2014 20:22:01 +0000 (12:22 -0800)]
update kernel headers to 3.19-rc1

9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Sat, 20 Dec 2014 20:18:14 +0000 (12:18 -0800)]
Merge branch 'master' into net-next

9 years agoss: Use rtnl_dump_filter in handle_netlink_request
vadimk [Thu, 4 Dec 2014 10:32:58 +0000 (12:32 +0200)]
ss: Use rtnl_dump_filter in handle_netlink_request

Replaced handling netlink messages by rtnl_dump_filter
from lib/libnetlink.c, also:

    - removed unused dump_fp arg;
    - added MAGIC_SEQ #define for 123456 seq id;
    - silently exit if ENOENT errno is caused for NETLINK_SOCK_DIAG proto
        in lib/libnetlink.c: rtnl_duml_filter_l(...) function. This fix
        was added in a3fd8e58c1787af186f5c4b234ff974544f840b6 by Eric
        for misc/ss.c

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoresolve header file conflict betwen linux/in6.h and netinet/in.h
Stephen Hemminger [Sat, 20 Dec 2014 20:12:34 +0000 (12:12 -0800)]
resolve header file conflict betwen linux/in6.h and netinet/in.h

Go back to kernel version of if_bridge.h and use patched
version of linux/in6.h and libc-compat.h

9 years agort_names can't be const
Stephen Hemminger [Sat, 20 Dec 2014 19:36:54 +0000 (11:36 -0800)]
rt_names can't be const

Needs to be built at runtime.

9 years agoss: Use nl_proto_a2n for filtering by netlink proto
vadimk [Sat, 6 Dec 2014 00:52:19 +0000 (02:52 +0200)]
ss: Use nl_proto_a2n for filtering by netlink proto

Now it is posible to filter by existing Netlink protos:

    ss -A netlink src uevent
    ss -A netlink src nft
    ss -A netlink src genl

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolib names: Add helper func for parse id and name from file
vadimk [Sat, 6 Dec 2014 02:05:12 +0000 (04:05 +0200)]
lib names: Add helper func for parse id and name from file

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agolib names: Use CONFDIR for specify 'group' file path
vadimk [Sat, 6 Dec 2014 02:05:11 +0000 (04:05 +0200)]
lib names: Use CONFDIR for specify 'group' file path

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoiproute2: Add support for CAN presume-ack feature
Nikita Edward Baruzdin [Fri, 5 Dec 2014 08:41:42 +0000 (11:41 +0300)]
iproute2: Add support for CAN presume-ack feature

This patch makes CAN_CTRLMODE_PRESUME_ACK netlink feature configurable.
When enabled, the feature sets CAN controller in mode in which
acknowledgement absence is ignored.

Signed-off-by: Nikita Edward Baruzdin <nebaruzdin@gmail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
9 years agoiproute2/nstat: Bug in displaying icmp stats
Eric Dumazet [Sat, 6 Dec 2014 02:10:08 +0000 (18:10 -0800)]
iproute2/nstat: Bug in displaying icmp stats

On Fri, 2014-12-05 at 17:13 -0800, Eric Dumazet wrote:

> I guess we could count number of spaces/fields in both lines,
> and disable the iproute2 trick if counts match.

Something like that maybe ?

 misc/nstat.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
Tested-by: Vijay Subramanian <subramanian.vijay@gmail.com>
9 years agoss: Fix layout/output issues introduced by regression
vadimk [Fri, 5 Dec 2014 17:19:11 +0000 (19:19 +0200)]
ss: Fix layout/output issues introduced by regression

This patch fixes the following issues which was introduced by me in commits:

    #1 (2dc854854b7f1b) ss: Fixed broken output for Netlink 'Peer Address:Port' column
    ISSUE: Broken layout when all sockets are printed out

    #2 (eef43b5052afb7) ss: Identify more netlink protocol names
    ISSUE: Protocol id is not printed if 'numbers only' output was specified (-n)

Also aligned the width of the local/peer ports to be more wider.

I tested with a lot of option combinations (I may miss some test cases),
but layout seems to me better than the previous released version of iproute2/ss.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoif_bridge: remove in6.h
Stephen Hemminger [Wed, 10 Dec 2014 04:19:26 +0000 (20:19 -0800)]
if_bridge: remove in6.h

Adding in6.h breaks build with redefined values.

9 years agoip monitor: Fix issue when timestamp is printed w/o msg
vadimk [Fri, 5 Dec 2014 00:18:59 +0000 (02:18 +0200)]
ip monitor: Fix issue when timestamp is printed w/o msg

The issue was observed when IPv6 router broadcasted NDUSEROPT
messages which are not handled by monitor and caused printing
'Timestamps' w/o message because such kind of rtnl messages is not
handled by monitor.

As 'ip monitor' by default subscribes to the all mcast rtnl groups except
RTGRP_TC then all messages of these rtnl groups which are not handled by
monitor may cause such issues.

Fixed by subscribing by default to rtnl mcast groups which are
supported by 'ip monitor'.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoipaddress: enable -details option
Nicolas Dichtel [Thu, 4 Dec 2014 16:41:07 +0000 (17:41 +0100)]
ipaddress: enable -details option

This option was used only for 'ip link', but it can be useful to have it for
'ip address'. Thus it is possible to display link details and addresses with one
command.

Example:
$ ip -d a ls dev gre1
9: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1468 qdisc noqueue state UNKNOWN group default
    link/gre 10.16.0.249 peer 10.16.0.121 promiscuity 0
    gre remote 10.16.0.121 local 10.16.0.249 ttl inherit ikey 0.0.0.10 okey 0.0.0.10 icsum ocsum
    inet 192.168.0.249 peer 192.168.0.121/32 scope global gre1
       valid_lft forever preferred_lft forever
    inet6 fe80::5efe:a10:f9/64 scope link
       valid_lft forever preferred_lft forever

Suggested-by: Christophe Gouault <christophe.gouault@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agoipaddress: enable -details option
Nicolas Dichtel [Thu, 4 Dec 2014 16:41:07 +0000 (17:41 +0100)]
ipaddress: enable -details option

This option was used only for 'ip link', but it can be useful to have it for
'ip address'. Thus it is possible to display link details and addresses with one
command.

Example:
$ ip -d a ls dev gre1
9: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1468 qdisc noqueue state UNKNOWN group default
    link/gre 10.16.0.249 peer 10.16.0.121 promiscuity 0
    gre remote 10.16.0.121 local 10.16.0.249 ttl inherit ikey 0.0.0.10 okey 0.0.0.10 icsum ocsum
    inet 192.168.0.249 peer 192.168.0.121/32 scope global gre1
       valid_lft forever preferred_lft forever
    inet6 fe80::5efe:a10:f9/64 scope link
       valid_lft forever preferred_lft forever

Suggested-by: Christophe Gouault <christophe.gouault@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agobridge/fdb: add flag/indication for FDB entry synced from offload device
Scott Feldman [Thu, 4 Dec 2014 08:57:15 +0000 (09:57 +0100)]
bridge/fdb: add flag/indication for FDB entry synced from offload device

Add NTF_EXT_LEARNED flag to neigh flags to indicate FDB entry learned by
device has been learned externally to bridge FDB.  For these entries,
add "external" annotation in bridge fdb show output:

  00:02:00:00:03:00 dev swp2 used 2/2 master br0 external
  00:02:00:00:03:00 dev swp2 self permanent

In the example above, 00:02:00:00:03:00 is shown twice on dev swp2.  The
first entry if from the bridge (master) and is marked as "external" by
the offload device.  The second entry is from the brport offload device (self),
and was learned by the device.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
9 years agoMerge branch 'master' into net-next
Stephen Hemminger [Wed, 10 Dec 2014 00:33:59 +0000 (16:33 -0800)]
Merge branch 'master' into net-next

9 years agobridge/fdb: fix statistics output spacing
Scott Feldman [Thu, 4 Dec 2014 08:57:14 +0000 (09:57 +0100)]
bridge/fdb: fix statistics output spacing

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
9 years agoip route: enable per-route ecn settings via 'features' option
Florian Westphal [Thu, 6 Nov 2014 21:15:32 +0000 (22:15 +0100)]
ip route: enable per-route ecn settings via 'features' option

This permits to selectively enable explicit congestion notification via
the routing table.

If this ecn feature is not set, the kernel will use the tcp_ecn sysctl
to decide wheter to use ECN when establising a TCP connection.

At the time of this writing, the kernel supports ecn and allfrags, but
allfrags is of dubious value and not implemented here.

Example:

ip route change 192.168.2.0/24 dev eth0 features ecn

Signed-off-by: Florian Westphal <fw@strlen.de>
9 years agoneed libc-compat.h for new in6.h
Stephen Hemminger [Fri, 5 Dec 2014 20:47:34 +0000 (12:47 -0800)]
need libc-compat.h for new in6.h

The header wars continue...

9 years agoadd local version of linux/in6.h
Stephen Hemminger [Fri, 5 Dec 2014 20:16:36 +0000 (12:16 -0800)]
add local version of linux/in6.h

Need this header file to avoid build issues on older systems
like Debian 7

9 years agoip-link: fix unterminated string in manpage
Stephen Hemminger [Thu, 4 Dec 2014 03:35:36 +0000 (19:35 -0800)]
ip-link: fix unterminated string in manpage

Missing "

9 years agotc: minor spelling fixes
Stephen Hemminger [Thu, 4 Dec 2014 03:28:34 +0000 (19:28 -0800)]
tc: minor spelling fixes

9 years agotunnel: decode ESP tunnel type
Stephen Hemminger [Thu, 4 Dec 2014 03:08:41 +0000 (19:08 -0800)]
tunnel: decode ESP tunnel type

Add ESP to decode switch.

9 years agort_dsfield: fix Expedited Forwarding PHB
Stephen Hemminger [Thu, 4 Dec 2014 02:50:59 +0000 (18:50 -0800)]
rt_dsfield: fix Expedited Forwarding PHB

RFC 2598 defines Expedited Forwarding in section 2.3
   Codepoint 101110 is recommended for the EF PHB.
which translates to B8 as encoded in rt_dsfield

9 years agoip link: Add ipvlan support to the iproute2/ip util
Mahesh Bandewar [Mon, 24 Nov 2014 02:06:11 +0000 (18:06 -0800)]
ip link: Add ipvlan support to the iproute2/ip util

Adding basic support to create virtual devices using 'ip'
utility. Following is the syntax -

ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ]
e.g. ip link add link eth0 ipvl0 type ipvlan mode l3

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Laurent Chavey <chavey@google.com>
Cc: Tim Hockin <thockin@google.com>
Cc: Brandon Philips <brandon.philips@coreos.com>
Cc: Pavel Emelianov <xemul@parallels.com>
9 years agotc: add support for vlan tc action
Jiri Pirko [Fri, 21 Nov 2014 11:31:30 +0000 (12:31 +0100)]
tc: add support for vlan tc action

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Reviewed-by: Cong Wang <cwang@twopensource.com>
9 years agoupdate kernel headers to net-next (3.18-rc6)
Stephen Hemminger [Wed, 3 Dec 2014 17:27:43 +0000 (09:27 -0800)]
update kernel headers to net-next (3.18-rc6)

Early merge of upstream headers

9 years agoman ip-link: Fix indentation for 'ip link show' options
vadimk [Tue, 2 Dec 2014 20:39:11 +0000 (22:39 +0200)]
man ip-link: Fix indentation for 'ip link show' options

BEFORE:
              The show command has additional formatting options:

       -s, -stats, -statistics
              output more statistics about packet usage.

       -d, -details
              output more detailed information.

       -h, -human, -human-readble
              output statistics with human readable values number followed by suffix

       -iec   print human readable rates in IEC units (ie. 1K = 1024).
AFTER:
       The show command has additional formatting options:

              -s, -stats, -statistics
                     output more statistics about packet usage.

              -d, -details
                     output more detailed information.

              -h, -human, -human-readble
                     output statistics with human readable values number followed by suffix

              -iec   print human readable rates in IEC units (ie. 1K = 1024).

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip route: don't assume default route
Pavel Simerda [Tue, 2 Dec 2014 16:45:10 +0000 (17:45 +0100)]
ip route: don't assume default route

Just print the help when "ip route del" is called without any other
arguments.

Resolves:

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

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
9 years agoconfigure: Add check for the doc tools
vadimk [Sun, 30 Nov 2014 16:08:25 +0000 (18:08 +0200)]
configure: Add check for the doc tools

Added checking existence of the doc files converters.
If the XXX tool exists then HAVE_XXX:=y will be written
to the Config file. Example of the configure script output:

TC schedulers
 ATM no
 IPT using xtables
 IPSET  yes

iptables modules directory: /usr/lib/iptables
libc has setns: yes
SELinux support: no

Docs
 latex: no
 WARNING: no docs can be built from LaTeX files
 sgml2html: yes

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoupdate if_bridge
Stephen Hemminger [Sun, 30 Nov 2014 17:48:14 +0000 (09:48 -0800)]
update if_bridge

Use current upstream header.

9 years agoss: Use generic handle_netlink_request for packet
vadimk [Sat, 29 Nov 2014 21:44:32 +0000 (23:44 +0200)]
ss: Use generic handle_netlink_request for packet

Get rid of self-handling and creating of Netlink socket for show packet
socket stats.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoman ip-link: Add description for 'help' command
vadimk [Sat, 29 Nov 2014 19:49:21 +0000 (21:49 +0200)]
man ip-link: Add description for 'help' command

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Refactor to use macro for define diag nl request
vadimk [Thu, 30 Oct 2014 16:49:25 +0000 (18:49 +0200)]
ss: Refactor to use macro for define diag nl request

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip link: Allow to filter devices by master dev
Vadim Kochan [Sat, 29 Nov 2014 19:27:41 +0000 (11:27 -0800)]
ip link: Allow to filter devices by master dev

Added 'master' option to 'ip link show' command
to filter devices by master dev.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoiproute2: Add support for babel protocol table entry
Dave Taht [Tue, 4 Nov 2014 22:23:47 +0000 (14:23 -0800)]
iproute2: Add support for babel protocol table entry

9 years agoss: Fixed broken output for Netlink 'Peer Address:Port' column
vadimk [Sat, 18 Oct 2014 17:46:29 +0000 (20:46 +0300)]
ss: Fixed broken output for Netlink 'Peer Address:Port' column

When output the netlink sockets:

    ss -A netlink state close

the layout is a little broken with a shifted 'Peer Address:Port'
stars and empty new lines. Fixed by making the port field to be
wider for 'Local Address:Port' column.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Remove checking SS_CLOSE state for packet and netlink
vadimk [Thu, 16 Oct 2014 08:19:29 +0000 (11:19 +0300)]
ss: Remove checking SS_CLOSE state for packet and netlink

I dont see a reason that packet and netlink states will be
printed only if SS_CLOSE state is set in filter, in that case
to print states of netlink or packet sockets it is needed to run:

    ss -A netlink state close

instead of:

    ss -A netlink

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip netns: Identify netns for the current process
vadimk [Fri, 7 Nov 2014 16:25:30 +0000 (18:25 +0200)]
ip netns: Identify netns for the current process

As 'ip' util will share the same netns from the caller
process then we can just look at /proc/self/.. to show
the netns of the current process by:

    ip netns id

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agotests: Move tc related tests to testsuite/tests/tc folder
vadimk [Fri, 31 Oct 2014 08:03:44 +0000 (10:03 +0200)]
tests: Move tc related tests to testsuite/tests/tc folder

With this change the results of tc tests will be recorded under:

    testsuite/results/tc/

The ip related tests can be added under:

    testsuite/tests/ip

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip monitor: Allow to filter events by dev
vadimk [Mon, 20 Oct 2014 09:25:17 +0000 (12:25 +0300)]
ip monitor: Allow to filter events by dev

Added 'dev' option to allow filtering events by device.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoss: Identify more netlink protocol names
vadimk [Thu, 30 Oct 2014 15:33:36 +0000 (17:33 +0200)]
ss: Identify more netlink protocol names

There were only few Netlink protocol names
which were printed on the screen:

    rtnl, fw, tcpdiag

So added the ability to identify Netlink proto name
from /etc/iproute/nl_protos or from static table.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agovxlan: Add support for enabling UDP checksums
Tom Herbert [Fri, 7 Nov 2014 16:05:34 +0000 (08:05 -0800)]
vxlan: Add support for enabling UDP checksums

Add udpcsum option to enable transmitting UDP checksums when doing
VXLAN/IPv4. Add udp6zerocsumtx, and udp6zerocsumrx options to enable
sending zero checksums and receiving zero checksums in VXLAN/IPv6.

Signed-off-by: Tom Herbert <therbert@google.com>
9 years agoip-link: Document IPoIB link type in the man page
Or Gerlitz [Sun, 16 Nov 2014 07:43:34 +0000 (09:43 +0200)]
ip-link: Document IPoIB link type in the man page

Add documentation on how to create devices of type IP-over-Infiniband
in the man page.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
9 years agoutils: relax strtoX checking in get_time_rtt
Florian Westphal [Tue, 11 Nov 2014 00:38:21 +0000 (01:38 +0100)]
utils: relax strtoX checking in get_time_rtt

ip route change dev tap0 192.168.7.0/24 rto_min 1ms
Error: argument "1ms" is wrong: "rto_min" value is invalid

get_time_rtt() checks for 's' or 'msec' and converts to milliseconds
if needed.

Fixes: 697ac63905 (utils: fix range checking for get_u32/get_u64 et all)
Signed-off-by: Florian Westphal <fw@strlen.de>
9 years agoiproute2: Man pages for fou and gue
Tom Herbert [Wed, 5 Nov 2014 18:06:28 +0000 (10:06 -0800)]
iproute2: Man pages for fou and gue

Man pages for Foo-over-UDP and Generic UDP Encapsulation receive
port configuration. gue man page links to fou one.

Signed-off-by: Tom Herbert <therbert@google.com>
9 years agoip link gre: Add support to configure FOU and GUE
Tom Herbert [Wed, 5 Nov 2014 18:06:26 +0000 (10:06 -0800)]
ip link gre: Add support to configure FOU and GUE

This patch adds support to configure foo-over-udp (FOU) and Generic
UDP Encapsulation for GRE tunnels. This configuration allows selection
of FOU or GUE for the tunnel, specification of the source and
destination ports for UDP tunnel, and enabling TX checksum. This
configuration only affects the transmit side of a tunnel.

Example:

ip link add name tun1 type gre remote 192.168.1.1 local 192.168.1.2 \
   ttl 225 encap fou encap-sport auto encap-dport 7777 encap-csum

This would create an GRE tunnel in GUE encapsulation where the source
port is automatically selected (based on hash of inner packet) and
checksums in the encapsulating UDP header are enabled.

Signed-off-by: Tom Herbert <therbert@google.com>
9 years agoip link ipip: Add support to configure FOU and GUE
Tom Herbert [Wed, 5 Nov 2014 18:06:25 +0000 (10:06 -0800)]
ip link ipip: Add support to configure FOU and GUE

This patch adds support to configure foo-over-udp (FOU) and Generic
UDP Encapsulation for IPIP and sit tunnels. This configuration allows
selection of FOU or GUE for the tunnel, specification of the source and
destination ports for UDP tunnel, and enabling TX checksum. This
configuration only affects the transmit side of a tunnel.

Example:

ip link add name tun1 type ipip remote 192.168.1.1 local 192.168.1.2 \
   ttl 225 encap gue encap-sport auto encap-dport 9999 encap-csum

This would create an IPIP tunnel in GUE encapsulation where the source
port is automatically selected (based on hash of inner packet) and
checksums in the encapsulating UDP header are enabled.

Signed-off-by: Tom Herbert <therbert@google.com>
9 years agoip fou: Support to configure foo-over-udp RX
Tom Herbert [Wed, 5 Nov 2014 18:06:24 +0000 (10:06 -0800)]
ip fou: Support to configure foo-over-udp RX

Added 'ip fou...' commands to enable/disable UDP ports for doing
foo-over-udp and Generic UDP Encapsulation variant. Arguments are port
number to bind to and IP protocol to map to port (for direct FOU).

Examples:

ip fou add port 7777 gue
ip fou add port 8888 ipproto 4

The first command creates a GUE port, the second creates a direct FOU
port for IPIP (receive payload is a assumed to be an IPv4 packet).

Signed-off-by: Tom Herbert <therbert@google.com>
9 years agoman: ip-link: fix a typo
Masatake YAMATO [Thu, 6 Nov 2014 18:57:05 +0000 (03:57 +0900)]
man: ip-link: fix a typo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoip-link: in human readable output use dynamic precision length
Christian Hesse [Tue, 4 Nov 2014 21:17:15 +0000 (22:17 +0100)]
ip-link: in human readable output use dynamic precision length

9 years agodoc ip-cref: Added missing ip options
vadimk [Tue, 4 Nov 2014 16:54:30 +0000 (18:54 +0200)]
doc ip-cref: Added missing ip options

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
9 years agoip-link: fix column alignment
Christian Hesse [Mon, 3 Nov 2014 07:21:11 +0000 (08:21 +0100)]
ip-link: fix column alignment

Width is the maximum number of characters used for the value, excluding a
field separator. So append a single whitespace.

9 years agoip: add iec formatted option and cleanup code
Stephen Hemminger [Sun, 2 Nov 2014 20:49:19 +0000 (12:49 -0800)]
ip: add iec formatted option and cleanup code

Add a new -iec option in addition to -human.
Cleanup code so the formatting of numbers is done in one function,
not 2 ways and 2 sizes.

9 years agoip-link: add switch to show human readable output
Christian Hesse [Fri, 31 Oct 2014 21:33:13 +0000 (22:33 +0100)]
ip-link: add switch to show human readable output

Byte and packet count can increase to really big numbers. This adds a
switch to show human readable output.

4: wl: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:de:ad:be:ee:ef brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    1523846973 3969051  0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    8710088361 6077735  0       0       0       0
4: wl: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:de:ad:be:ee:ef brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    1.5G       3.9M     0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    8.7G       6.0M     0       0       0       0

9 years agoiproute2: ip6_tunnel mode bugfixes: any,vti6
Alexey Andriyanov [Wed, 29 Oct 2014 06:19:30 +0000 (09:19 +0300)]
iproute2: ip6_tunnel mode bugfixes: any,vti6

- any ipv6 tunnel mode (proto == 0) could not be set
due to incomplete set of cases in do_add, do_del.
- vti6 logic was inverted: it was using "ip6_vti0" basedev
UNLESS mode is set to vti6.

We don't need a switch by p.proto in do_add()/do_del(): it
already exists in parse_args(). So if parse_args() call
was successful, no need to check tunnel mode again.

Signed-off-by: Alexey Andriyanov <alan@al-an.info>
9 years agoman: update doc after support of ESN and anti-replay window
Nicolas Dichtel [Thu, 30 Oct 2014 08:18:48 +0000 (01:18 -0700)]
man: update doc after support of ESN and anti-replay window

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