]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
5 years agobridge: make mcast_flood description consistent
Vivien Didelot [Wed, 20 Feb 2019 16:33:57 +0000 (11:33 -0500)]
bridge: make mcast_flood description consistent

This patch simply changes the description of the mcast_flood flag
with "flood" instead of "be flooded with" to avoid confusion, and be
consistent with the description of the flooding flag, which "Controls
whether a given port will *flood* unicast traffic for which there is
no FDB entry."

At the same time, fix the documentation for the "flood" flag which
is incorrectly described as "flooding on" or "flooding off".

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: relax dpipe table show dependency on resources
Jiri Pirko [Thu, 21 Feb 2019 10:55:56 +0000 (11:55 +0100)]
devlink: relax dpipe table show dependency on resources

Dpipe table show command has a depencency on getting resources.
If resource get command is not supported by the driver, dpipe table
show fails. However, resource is only additional information
in dpipe table show output. So relax the dependency and let
the dpipe tables be shown even if resources get command fails.

Fixes: ead180274caf ("devlink: Add support for resource/dpipe relation")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip-address: Use correct max attribute value in print_vf_stats64()
Phil Sutter [Thu, 21 Feb 2019 18:37:51 +0000 (19:37 +0100)]
ip-address: Use correct max attribute value in print_vf_stats64()

IFLA_VF_MAX is larger than the highest valid index in vf array.

Fixes: a1b99717c7cd7 ("Add displaying VF traffic statistics")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip-rule: fix json key "to_tbl" for unspecific rule action
Thomas Haller [Tue, 19 Feb 2019 20:50:19 +0000 (21:50 +0100)]
ip-rule: fix json key "to_tbl" for unspecific rule action

The key should not be called "to_tbl" because it is exactly
not a FR_ACT_TO_TBL action. Change it to "action".

    # ip rule add blackhole
    # ip -j rule | python -m json.tool
    ...
    {
        "priority": 0,
        "src": "all",
        "to_tbl": "blackhole"
    },

This is an API break of JSON output as it was added in v4.17.0.
Still change it as the API is relatively new and unstable.

Fixes: 0dd4ccc56c0e ("iprule: add json support")
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip route: get: allow zero-length subnet mask
Luca Boccassi [Thu, 14 Feb 2019 23:29:18 +0000 (23:29 +0000)]
ip route: get: allow zero-length subnet mask

A /0 subnet mask is theoretically valid, but ip route get doesn't allow
it:

$ ip route get 1.0.0.0/0
need at least a destination address

Change the check and remember whether we found an address or not, since
according to the documentation it's a mandatory parameter.

$ ip/ip route get 1.0.0.0/0
1.0.0.0 via 192.168.1.1 dev eth0 src 192.168.1.91 uid 1000
    cache

Reported-by: Clément Hertling <wxcafe@wxcafe.net>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiplink: document XDP subcommand to force the XDP mode.
Matteo Croce [Wed, 13 Feb 2019 14:40:30 +0000 (15:40 +0100)]
iplink: document XDP subcommand to force the XDP mode.

When attaching an eBPF program to a device, ip link can force the XDP mode
by using the xdp{generic,drv,offload} keyword instead of just 'xdp'.
Document this behaviour also in the help output.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Fixes: 14683814 ("bpf: add xdpdrv for requesting XDP driver mode")
Fixes: 1b5e8094 ("bpf: allow requesting XDP HW offload")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: add option --tos for requesting ipv4 tos and ipv6 tclass
Konstantin Khlebnikov [Wed, 13 Feb 2019 12:39:01 +0000 (15:39 +0300)]
ss: add option --tos for requesting ipv4 tos and ipv6 tclass

Also show socket class_id/priority used by classful qdisc.
Kernel report this together with tclass since commit
("inet_diag: fix reporting cgroup classid and fallback to priority")

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/libnetlink: ensure a minimum of 32KB for the buffer used in rtnl_recvmsg()
Eric Dumazet [Wed, 13 Feb 2019 01:58:41 +0000 (17:58 -0800)]
lib/libnetlink: ensure a minimum of 32KB for the buffer used in rtnl_recvmsg()

In the past, we tried to increase the buffer size up to 32 KB in order
to reduce number of syscalls per dump.

Commit 2d34851cd341 ("lib/libnetlink: re malloc buff if size is not enough")
brought the size back to 4KB because the kernel can not know the application
is ready to receive bigger requests.

See kernel commits 9063e21fb026 ("netlink: autosize skb lengthes") and
d35c99ff77ec ("netlink: do not enter direct reclaim from netlink_dump()")
for more details.

Fixes: 2d34851cd341 ("lib/libnetlink: re malloc buff if size is not enough")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: use bits not mbits/sec in rate percent
Marcos Antonio Moraes [Thu, 7 Feb 2019 15:29:54 +0000 (13:29 -0200)]
tc: use bits not mbits/sec in rate percent

As /sys/class/net/<iface>/speed indicates a value in Mbits/sec, the
conversion is necessary to create the correct limits.

This guarantees the same result for the following commands in an
1000Mbit/sec device:

tc class add ... htb rate 500Mbit
tc class add ... htb rate 50%

Fixes: 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
Signed-off-by: Marcos Antonio Moraes <marcos.antonio@digirati.com.br>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: avoid problems with hard coded rate string length
Stephen Hemminger [Wed, 6 Feb 2019 18:49:47 +0000 (10:49 -0800)]
tc: avoid problems with hard coded rate string length

The parse_percent_rate function assumed the buffer was 20 characters.
Better to pass length in case the size ever changes.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: fix memory leak in error path
Stephen Hemminger [Wed, 6 Feb 2019 18:41:58 +0000 (10:41 -0800)]
tc: fix memory leak in error path

If value passed to parse_percent was not valid, it would
leak the dynamic allocation from sscanf.

Fixes: 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobpf: add btf func and func_proto kind support
Yonghong Song [Fri, 25 Jan 2019 00:41:07 +0000 (16:41 -0800)]
bpf: add btf func and func_proto kind support

The issue is discovered for bpf selftest test_skb_cgroup.sh.
Currently we have,
  $ ./test_skb_cgroup_id.sh
  Wait for testing link-local IP to become available ... OK
  Object has unknown BTF type: 13!
  [PASS]

In the above the BTF type 13 refers to BTF kind
BTF_KIND_FUNC_PROTO.
This patch added support of BTF_KIND_FUNC_PROTO and
BTF_KIND_FUNC during type parsing.
With this patch, I got
  $ ./test_skb_cgroup_id.sh
  Wait for testing link-local IP to become available ... OK
  [PASS]

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: fdb: Fix FDB dump with strict checking disabled
Ido Schimmel [Fri, 25 Jan 2019 17:09:17 +0000 (17:09 +0000)]
bridge: fdb: Fix FDB dump with strict checking disabled

While iproute2 correctly uses ifinfomsg struct as the ancillary header
when requesting an FDB dump on old kernels, it sets the message type to
RTM_GETLINK. This results in wrong reply being returned.

Fix this by using RTM_GETNEIGH instead.

Before:
$ bridge fdb show brport dummy0
Not RTM_NEWNEIGH: 00000158 00000010 00000002

After:
$ bridge fdb show brport dummy0
2a:0b:41:1c:92:d3 vlan 1 master br0 permanent
2a:0b:41:1c:92:d3 master br0 permanent
33:33:00:00:00:01 self permanent
01:00:5e:00:00:01 self permanent

Fixes: 05880354c2cf ("bridge: fdb: Fix filtering with strict checking disabled")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: LiLiang <liali@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolibnetlink: linkdump_req: AF_PACKET family also expects ext_filter_mask
Chris Mi [Fri, 25 Jan 2019 10:37:07 +0000 (10:37 +0000)]
libnetlink: linkdump_req: AF_PACKET family also expects ext_filter_mask

Without this fix, the VF info can't be showed using command
"ip link".

146: ens1f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 24:8a:07:ad:78:52 brd ff:ff:ff:ff:ff:ff
    vf 0 MAC 02:25:d0:12:01:01, spoof checking off, link-state auto, trust off, query_rss off
    vf 1 MAC 02:25:d0:12:01:02, spoof checking off, link-state auto, trust off, query_rss off

Fixes: d97b16b2c906 ("libnetlink: linkdump_req: Only AF_UNSPEC family expects an ext_filter_mask")
Signed-off-by: Chris Mi <chrism@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agof_flower: fix build with musl libc
Hans Dedecker [Wed, 23 Jan 2019 21:02:31 +0000 (22:02 +0100)]
f_flower: fix build with musl libc

XATTR_SIZE_MAX requires the usage of linux/limits.h; let's include it

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiproute: Set ip/ip6 lwtunnel flags
wenxu [Wed, 2 Jan 2019 03:57:00 +0000 (11:57 +0800)]
iproute: Set ip/ip6 lwtunnel flags

ip l add dev tun type gretap external
ip r a 10.0.0.1 encap ip dst 192.168.152.171 id 1000 dev gretap

For gretap example when the command set the id but don't set the
TUNNEL_KEY flags. There is no key field in the send packet

User can set flags with key, csum, seq
ip r a 10.0.0.1 encap ip dst 192.168.152.171 id 1000 key csum dev gretap

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip route: get: only set RTM_F_LOOKUP_TABLE flag for IPv4
Jakub Kicinski [Sat, 12 Jan 2019 20:54:06 +0000 (12:54 -0800)]
ip route: get: only set RTM_F_LOOKUP_TABLE flag for IPv4

Kernel ignores the RTM_F_LOOKUP_TABLE flag for all families
but IPv4.  Don't set it, otherwise it may fall foul of
strict checking policies.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: m_tunnel_key: Allow key-less tunnels
Adi Nissim [Thu, 10 Jan 2019 13:03:50 +0000 (15:03 +0200)]
tc: m_tunnel_key: Allow key-less tunnels

Change the id parameter of the tunnel_key set action from mandatory to
optional.

Some tunneling protocols (e.g. GRE) specify the id as an optional field.

Signed-off-by: Adi Nissim <adin@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: in.h change
Stephen Hemminger [Tue, 22 Jan 2019 03:03:31 +0000 (16:03 +1300)]
uapi: in.h change

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMakefile: check manpages for syntax errors
Luca Boccassi [Sat, 12 Jan 2019 12:28:56 +0000 (12:28 +0000)]
Makefile: check manpages for syntax errors

Pass the same parameters Lintian uses in Debian.

$ make check
<...>
Checking manpages for syntax errors...
<standard input>:48: warning: macro `Q' not defined
Error in tc-taprio.8
Makefile:27: recipe for target 'check' failed

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: tc-taprio.8: fix syntax error
Luca Boccassi [Sat, 12 Jan 2019 12:28:55 +0000 (12:28 +0000)]
man: tc-taprio.8: fix syntax error

.Q does not exist so groff complains and the "queues" word is actually
not displayed.

Fixes: 579acb4bc52f ("taprio: Add manpage for tc-taprio(8)")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: ss.8: more line breaks
Luca Boccassi [Sat, 12 Jan 2019 12:28:54 +0000 (12:28 +0000)]
man: ss.8: more line breaks

groff stiff complains about unbreakable lines:
  96: warning [p 2, 3.0i]: can't break line

Indent it some more.

Fixes: 7f5047524c99 ("man: ss.8: break and indent long line")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoconfigure: fix typo in check_xt_old_internal_h
Dmitry V. Levin [Mon, 7 Jan 2019 22:37:15 +0000 (01:37 +0300)]
configure: fix typo in check_xt_old_internal_h

Fixes: 377a09902a57 ("configure: Minor code cleanup")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: update uapi headers
Stephen Hemminger [Mon, 7 Jan 2019 19:41:39 +0000 (11:41 -0800)]
rdma: update uapi headers

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update headers from 4.21-rc1
Stephen Hemminger [Mon, 7 Jan 2019 19:39:26 +0000 (11:39 -0800)]
uapi: update headers from 4.21-rc1

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoMerge ../iproute2-next
Stephen Hemminger [Mon, 7 Jan 2019 19:36:41 +0000 (11:36 -0800)]
Merge ../iproute2-next

5 years agov4.20.0
Stephen Hemminger [Mon, 7 Jan 2019 18:24:02 +0000 (10:24 -0800)]
v4.20.0

5 years agoipneigh: print dst for AF_BRIDGE
Tobias Jungel [Sat, 5 Jan 2019 12:36:43 +0000 (13:36 +0100)]
ipneigh: print dst for AF_BRIDGE

In case a neighbour message is of family AF_BRIDE the NDA_DST attribute
was not printed so far. With this patch the family is evaluated to pass
the correct family to format_host_rta.

Signed-off-by: Tobias Jungel <tobias.jungel@bisdn.de>
5 years agolibnetlink: linkdump_req is done for AF_BRIDGE as well
David Ahern [Mon, 7 Jan 2019 00:17:13 +0000 (16:17 -0800)]
libnetlink: linkdump_req is done for AF_BRIDGE as well

The bridge command 'vlan show' calls rtnl_linkdump_req_filter for
family AF_BRIDGE. Update rtnl_linkdump_req_filter to send the filter
for that family as well.

Fixes: d97b16b2c906 ("libnetlink: linkdump_req: Only AF_UNSPEC family expects an ext_filter_mask")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Fri, 4 Jan 2019 20:22:47 +0000 (12:22 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Conflicts:
ip/iprule.c

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'strict-updates' into iproute2-next
David Ahern [Fri, 4 Jan 2019 20:19:37 +0000 (12:19 -0800)]
Merge branch 'strict-updates' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobridge: fdb: Fix filtering with strict checking disabled
David Ahern [Thu, 3 Jan 2019 00:33:42 +0000 (16:33 -0800)]
bridge: fdb: Fix filtering with strict checking disabled

Older kernels expect an ifinfomsg struct as the ancillary header, and
after kernel commit bd961c9bc664 ("rtnetlink: fix rtnl_fdb_dump() for ndmsg
header") can handle either ifinfomsg or ndmsg. Strict data checking only
allows ndmsg.

Use the new RTNL_HANDLE_F_STRICT_CHK flag to know which header to send.

Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
5 years agolibnetlink: Add RTNL_HANDLE_F_STRICT_CHK flag
David Ahern [Thu, 3 Jan 2019 00:31:38 +0000 (16:31 -0800)]
libnetlink: Add RTNL_HANDLE_F_STRICT_CHK flag

Add RTNL_HANDLE_F_STRICT_CHK flag and set in rth flags to let know
commands know if the kernel supports strict checking.

Extracted from patch from Ido to fix filtering with strict checking
enabled.

Cc: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobridge: Update fdb show to use rtnl_neighdump_req
David Ahern [Mon, 31 Dec 2018 18:00:24 +0000 (10:00 -0800)]
bridge: Update fdb show to use rtnl_neighdump_req

Add fdb_dump_filter to set filter attributes in dump request
and convert fdb_show to use rtnl_neighdump_req.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip neigh: Convert do_show_or_flush to use rtnl_neighdump_req
David Ahern [Mon, 31 Dec 2018 17:55:45 +0000 (09:55 -0800)]
ip neigh: Convert do_show_or_flush to use rtnl_neighdump_req

Add ipneigh_dump_filter to add filter attributes to the neighbor
dump request and update do_show_or_flush to use rtnl_neighdump_req.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: Add filter function to rtnl_neighdump_req
David Ahern [Mon, 31 Dec 2018 17:54:47 +0000 (09:54 -0800)]
libnetlink: Add filter function to rtnl_neighdump_req

Add filter function to rtnl_neighdump_req and a buffer to the
request for the filter functions to append attributes.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Fix incorrectly handled NLA validation
Leon Romanovsky [Sun, 30 Dec 2018 13:34:09 +0000 (15:34 +0200)]
rdma: Fix incorrectly handled NLA validation

mnl_attr_type_valid() receives maximum attribute type, which means that
we were supposed to supply the latest valid netlink attribute and not
the number of attributes. Such coding mistake caused to failures while
NLA attributes were extended.

Fixes: 74bd75c2b68d ("rdma: Add basic infrastructure for RDMA tool")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: Add tun_id filed in the selector
wenxu [Mon, 24 Dec 2018 08:49:44 +0000 (16:49 +0800)]
iprule: Add tun_id filed in the selector

ip rule add from all iif gretap tun_id 2000 lookup 200

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agonstat: fix load_ugly_table() limits
Eric Dumazet [Sat, 22 Dec 2018 06:53:35 +0000 (22:53 -0800)]
nstat: fix load_ugly_table() limits

A recent change reduced max line length from 4096 to 2048 bytes,
but we already have lines above the 2048 threshold, and we keep
adding more SNMP counters in linux.

Switch to getline() and do not worry about future kernel changes.

Fixes: da8034a01904 ("misc: avoid snprintf warnings in ss and nstat")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: fdb: Use 'struct ndmsg' for FDB dumping
Ido Schimmel [Sun, 30 Dec 2018 17:14:54 +0000 (17:14 +0000)]
bridge: fdb: Use 'struct ndmsg' for FDB dumping

Since commit aea41afcfd6d ("ip bridge: Set NETLINK_GET_STRICT_CHK on
socket") iproute2 uses strict checking on kernels that support it. This
causes FDB dumping to fail [1], as iproute2 uses 'struct ifinfomsg'
whereas the kernel expects 'struct ndmsg'.

Note that with this change iproute2 continues to work on old kernels
that do not support strict checking, but contain the fix introduced in
kernel commit bd961c9bc664 ("rtnetlink: fix rtnl_fdb_dump() for ndmsg
header").

[1]
# bridge fdb show
[ 5365.137224] netlink: 4 bytes leftover after parsing attributes in process `bridge'.
Error: bytes leftover after parsing attributes.
Dump terminated

Fixes: aea41afcfd6d ("ip bridge: Set NETLINK_GET_STRICT_CHK on socket")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add print of link CapabilityMask2 flags
Michael Guralnik [Sun, 23 Dec 2018 11:24:19 +0000 (13:24 +0200)]
rdma: Add print of link CapabilityMask2 flags

CapabilityMask2 is defined in IBTA spec as a member of PortInfo.
Add translation to string of new CapabilityMask2 expansion of link caps.

The flags are concatenated to current caps print as seen in this example
printing EXT_INFO flag:

root@server-22 $ rdma -d link
1/1: mlx5_0/1: subnet_prefix fe80:0000:0000:0000 lid 2 sm_lid 2 lmc 0
state ACTIVE physical_state LINK_UP
caps: <SM, TRAP, SL_MAP, SYS_IMAGE_GUID, CABLE_INFO, EXTENDED_SPEEDS,
CAP_MASK2, CM, DEVICE_MGMT, VENDOR_CLASS, CAP_MASK_NOTICE,
CLIENT_REG, OTHER_LOCAL_CHANGES, MULT_PKER_TRAP, EXT_INFO>

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'strict-dumps' into iproute2-next
David Ahern [Thu, 27 Dec 2018 23:37:44 +0000 (15:37 -0800)]
Merge branch 'strict-dumps' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoneighbor: Add support for protocol attribute
David Ahern [Thu, 20 Dec 2018 01:07:19 +0000 (17:07 -0800)]
neighbor: Add support for protocol attribute

Add support to set protocol on neigh entries and to print the protocol
on dumps.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip route: Rename do_ipv6 to dump_family
David Ahern [Wed, 31 Oct 2018 19:29:45 +0000 (12:29 -0700)]
ip route: Rename do_ipv6 to dump_family

do_ipv6 is really the preferred dump family. Rename it to make
that apparent.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip bridge: Set NETLINK_GET_STRICT_CHK on socket
David Ahern [Fri, 5 Oct 2018 20:49:41 +0000 (13:49 -0700)]
ip bridge: Set NETLINK_GET_STRICT_CHK on socket

iproute2 has been updated for the new strict policy in the kernel. Add a
helper to call setsockopt to enable the feature. Add a call to ip.c and
bridge.c

The setsockopt fails on older kernels and the error can be safely ignored
- any new fields or attributes are ignored by the older kernel.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip address: Set device index in dump request
David Ahern [Wed, 19 Dec 2018 21:30:44 +0000 (13:30 -0800)]
ip address: Set device index in dump request

Add a filter function to rtnl_addrdump_req to set device index in the
address dump request if the user is filtering addresses by device. In
addition, add a new ipaddr_link_get to do a single RTM_GETLINK request
instead of a device dump yet still store the data in the linfo list.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip address: Split ip_linkaddr_list into link and addr functions
David Ahern [Wed, 19 Dec 2018 21:28:47 +0000 (13:28 -0800)]
ip address: Split ip_linkaddr_list into link and addr functions

Split ip_linkaddr_list into one function that generates a list of devices
and a second that generates the list of addresses.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agomroute: Add table id attribute for kernel side filtering
David Ahern [Mon, 15 Oct 2018 17:30:34 +0000 (10:30 -0700)]
mroute: Add table id attribute for kernel side filtering

Similar to 'ip route' add the table id to the dump request for
kernel side filtering if it is supported.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agomroute: fix up family handling
David Ahern [Wed, 19 Dec 2018 21:11:15 +0000 (13:11 -0800)]
mroute: fix up family handling

Only ipv4 and ipv6 have multicast routing. Set family
accordingly and just return for other cases.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip route: Add protocol, table id and device to dump request
David Ahern [Fri, 19 Oct 2018 22:41:39 +0000 (15:41 -0700)]
ip route: Add protocol, table id and device to dump request

Add protocol, table id and device to dump request if set in filter. If
kernel side filtering is supported it is used to reduce the amount of
data sent to userspace.

Older kernels do not parse attributes on a route dump request, so these
are silently ignored and ip will do the filtering in userspace.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip route: Remove rtnl_rtcache_request
David Ahern [Wed, 3 Oct 2018 02:08:15 +0000 (19:08 -0700)]
ip route: Remove rtnl_rtcache_request

Add a filter option to rtnl_routedump_req and use it to set rtm_flags
removing the need for rtnl_rtcache_request for dump requests.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: linkdump_req: Only AF_UNSPEC family expects an ext_filter_mask
David Ahern [Thu, 4 Oct 2018 21:12:39 +0000 (14:12 -0700)]
libnetlink: linkdump_req: Only AF_UNSPEC family expects an ext_filter_mask

Only AF_UNSPEC handled by rtnl_dump_ifinfo expects an ext_filter_mask
on a dump request. Update the linkdump request functions to only set
and send ext_filter_mask for AF_UNSPEC.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: Use NLMSG_LENGTH to set nlmsg_len
David Ahern [Fri, 19 Oct 2018 22:34:44 +0000 (15:34 -0700)]
libnetlink: Use NLMSG_LENGTH to set nlmsg_len

Change nlmsg_len from sizeof(req) to use NLMSG_LENGTH on the header.
2 of the inner headers are not 4-byte aligned, so add a 0-length buf
after the header with the __aligned(NLMSG_ALIGNTO) to ensure the size
of the request is large enough. Use NLMSG_ALIGN in NLMSG_LENGTH to set
nlmsg_len.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: dump extack string in done message
David Ahern [Thu, 4 Oct 2018 21:07:15 +0000 (14:07 -0700)]
libnetlink: dump extack string in done message

Print any extack message that has been appended to a NLMSG_DONE message.
To avoid duplication, move the existing print code to a new helper.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Sat, 22 Dec 2018 15:36:52 +0000 (07:36 -0800)]
Update kernel headers

Update kernel headers to commit
ce28bb445388 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotestsuite: Fix colorize
Petr Vorel [Tue, 18 Dec 2018 19:29:04 +0000 (20:29 +0100)]
testsuite: Fix colorize

bash and dash require for escape sequence to use 'echo -e' or printf
(but working on zsh). Choosing printf as it's implementation is IMHO
more portable than echo implementations.
dash also require to use \033[0; as escape sequence instead of \e[0;

NOTE: \e[0; kept in lib/color.c as it's not problematic for C code
(working when run ip on various shells).

Fixes: 7e2f71b4 ("testsuite: colorize test result output")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agouapi/iptunnel: make TUNNEL_FLAGS available
Stephen Hemminger [Thu, 20 Dec 2018 17:19:33 +0000 (09:19 -0800)]
uapi/iptunnel: make TUNNEL_FLAGS available

ip l add dev tun type gretap external
ip r a 10.0.0.1 encap ip dst 192.168.152.171 id 1000 dev gretap

For gretap Key example when the command set the id but don't set the
TUNNEL_KEY flags. There is no key field in the send packet

In the lwtunnel situation, some TUNNEL_FLAGS should can be set by
userspace

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi/netlink.h: rename NETLINK_DUMP_STRICT_CHK -> NETLINK_GET_STRICT_CHK
Stephen Hemminger [Thu, 20 Dec 2018 17:18:29 +0000 (09:18 -0800)]
uapi/netlink.h: rename NETLINK_DUMP_STRICT_CHK -> NETLINK_GET_STRICT_CHK

NETLINK_DUMP_STRICT_CHK can be used for all GET requests,
dumps as well as doit handlers.  Replace the DUMP in the
name with GET make that clearer.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi/in.h: Allow class-e address assignment
Stephen Hemminger [Thu, 20 Dec 2018 17:17:05 +0000 (09:17 -0800)]
uapi/in.h: Allow class-e address assignment

While most distributions long ago switched to the iproute2 suite
of utilities, which allow class-e (240.0.0.0/4) address assignment,
distributions relying on busybox, toybox and other forms of
ifconfig cannot assign class-e addresses without this kernel patch.

While CIDR has been obsolete for 2 decades, and a survey of all the
open source code in the world shows the IN_whatever macros are also
obsolete... rather than obsolete CIDR from this ioctl entirely, this
patch merely enables class-e assignment, sanely.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUpdate kernel headers
David Ahern [Wed, 19 Dec 2018 20:47:29 +0000 (12:47 -0800)]
Update kernel headers

Update kernel headers to commit
   055722716c39 ("tipc: fix uninitialized value for broadcast retransmission")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotestsuite: drop unrunnable test
Stephen Hemminger [Tue, 18 Dec 2018 18:11:10 +0000 (10:11 -0800)]
testsuite: drop unrunnable test

The classifier testbed test never worked and was always being
skipped. It depended on some files it tests/cls which never made
it into the iproute2 git repository.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodoc: remove trailing whitespace
Stephen Hemminger [Tue, 18 Dec 2018 15:57:20 +0000 (07:57 -0800)]
doc: remove trailing whitespace

Run whitespace scrubbing script to remove unnecessary trailing
blanks at end of line and end of file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Wed, 19 Dec 2018 20:02:17 +0000 (12:02 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoexamples: Remove cbq.init-v0.7.3
Petr Vorel [Sat, 15 Dec 2018 18:00:44 +0000 (19:00 +0100)]
examples: Remove cbq.init-v0.7.3

This script is obsolete.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoexamples: Remove dhcp-client-script
Petr Vorel [Sat, 15 Dec 2018 18:00:43 +0000 (19:00 +0100)]
examples: Remove dhcp-client-script

This script is obsolete.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoconfigure: Minor code cleanup
Petr Vorel [Sat, 15 Dec 2018 18:00:42 +0000 (19:00 +0100)]
configure: Minor code cleanup

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoconfigure: Remove non-posix shell expansion
Petr Vorel [Sat, 15 Dec 2018 18:00:41 +0000 (19:00 +0100)]
configure: Remove non-posix shell expansion

+ change shebang to /bin/sh

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoconfigure: Remove unused function check_prog()
Petr Vorel [Sat, 15 Dec 2018 18:00:40 +0000 (19:00 +0100)]
configure: Remove unused function check_prog()

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agotests: Use /bin/sh shebang
Petr Vorel [Sat, 15 Dec 2018 18:00:39 +0000 (19:00 +0100)]
tests: Use /bin/sh shebang

Bashisms for tests were removed in ecd44e68 ("tests: Remove
bashisms (s/source/.)"), so no need to use bash shebang.

+ remove trailing whitespace.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoman: rtpr: Rename s/bash/shell/
Petr Vorel [Sat, 15 Dec 2018 18:00:38 +0000 (19:00 +0100)]
man: rtpr: Rename s/bash/shell/

ip/rtpr mentioned in man as bash script is actually posix shell script
(doesn't require to use bash).

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agotestsuite: remove gre kmods if the test loads them
Luca Boccassi [Sun, 16 Dec 2018 20:55:40 +0000 (20:55 +0000)]
testsuite: remove gre kmods if the test loads them

The tunnel test leaves behind link devices created by the GRE kernel
modules:

$ ip -br link
...
gre0@NONE    DOWN 0.0.0.0 <NOARP>
gretap0@NONE DOWN 00:00:00:00:00:00 <BROADCAST,MULTICAST>
erspan0@NONE DOWN 00:00:00:00:00:00 <BROADCAST,MULTICAST>
ip6tnl0@NONE DOWN :: <NOARP>
ip6gre0@NONE DOWN 00:00:00:00:

$ lsmod | grep gre
ip6_gre      40960  0
ip6_tunnel   40960  1 ip6_gre
ip_gre       32768  0
ip_tunnel    24576  1 ip_gre
gre          16384  2 ip6_gre,ip_gre

Check beforehand if the gre kernel module is loaded, and if not unload
them all at the end of the test. This should avoid causing problems if
a user is already using GRE for other purposes.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agotestsuite: delete dummy interface after default route test
Luca Boccassi [Sun, 16 Dec 2018 20:55:39 +0000 (20:55 +0000)]
testsuite: delete dummy interface after default route test

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agotestsuite: declare dependency between $(TESTS) and generate_nlmsg
Luca Boccassi [Sun, 16 Dec 2018 20:55:38 +0000 (20:55 +0000)]
testsuite: declare dependency between $(TESTS) and generate_nlmsg

Parallel make from the top level directory fails since tests are at the
same time as generate_nlmsg:

$ make check -j4

...

cd testsuite && make && make alltests
echo "Entering iproute2" && cd iproute2 && make configure && cd ..;
Entering iproute2
make -C tools
Removing results dir ...
make[1]: ./tools/generate_nlmsg: Command not found
make[1]: ./tools/generate_nlmsg: Command not found
Makefile:64: recipe for target 'ip/netns/set_nsid_batch.t' failed
make[1]: *** [ip/netns/set_nsid_batch.t] Error 127
make[1]: ./tools/generate_nlmsg: Command not found
make[1]: *** Waiting for unfinished jobs....
Makefile:64: recipe for target 'ip/netns/set_nsid.t' failed
make[1]: *** [ip/netns/set_nsid.t] Error 127
Makefile:64: recipe for target 'ip/link/show_dev_wo_vf_rate.t' failed
make[1]: *** [ip/link/show_dev_wo_vf_rate.t] Error 127
    CC       generate_nlmsg
Makefile:123: recipe for target 'check' failed
make: *** [check] Error 2

Add an explicit dependency in testuite/Makefile's $(TESTS) rule so
that the tool correctly gets compiled before any test runs.

Fixes: 3537633dcf44 ("testsuite: Generate generate_nlmsg when needed")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoMakefile: have check target depend on all
Luca Boccassi [Sun, 16 Dec 2018 20:55:37 +0000 (20:55 +0000)]
Makefile: have check target depend on all

Otherwise it will simply fail immediately from a just-cleaned
workspace:

$ make check -j1
cd testsuite && make && make alltests
echo "Entering iproute2" && cd iproute2 && make configure && cd ..;
Entering iproute2
make -C tools
Makefile:3: ../../config.mk: No such file or directory
make[2]: *** No rule to make target '../../config.mk'.  Stop.

Fixes: 8804a8c0d387 ("Makefile: Add check target")
Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agoman: ss: fix typos about wscale
Masatake YAMATO [Mon, 17 Dec 2018 00:28:09 +0000 (09:28 +0900)]
man: ss: fix typos about wscale

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agodrop support for DECnet
Stephen Hemminger [Tue, 11 Dec 2018 16:40:09 +0000 (08:40 -0800)]
drop support for DECnet

DECnet belongs in the history museum of dead protocols along
with Appletalk and IPX.

Linux support has outlived its natural life and the time has
come to remove it from iproute2. Dead code is a source
of bugs and exploits.

If anyone actually has DECnet running on some old distribution
they can just keep to the old version of iproute2.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: fix xtables incorrect usage of LDFLAGS
Syrone Wong [Wed, 12 Dec 2018 11:35:08 +0000 (19:35 +0800)]
tc: fix xtables incorrect usage of LDFLAGS

The incorrect setting of LDFLAGS causes error below:

> em_ipt.o: In function `em_ipt_print_epot':
> em_ipt.c:(.text.em_ipt_print_epot+0x2e): undefined reference to
> `xtables_init_all'

em_ipt.c gets involved when TC_CONFIG_XT=y, which requires xtables,
while tc/Makefile doesn't pass flags correctly. It adds '-lxtables'
to LDFLAGS instead of LDLIBS.

Fixes: dd296215 ("tc: add em_ipt ematch for calling xtables matches from tc matching context")
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
Acked-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoremove redundant long int
Stephen Hemminger [Mon, 10 Dec 2018 17:21:17 +0000 (09:21 -0800)]
remove redundant long int

Using unsigned long is sufficient no need to be more
verbose and use unsigned long int.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: Fix broken 32-bit compilation
Leon Romanovsky [Tue, 11 Dec 2018 18:14:28 +0000 (20:14 +0200)]
rdma: Fix broken 32-bit compilation

Allow compilation of rdmatool on 32-bits platforms.

rdma
    CC       rdma.o
    CC       utils.o
    CC       dev.o
    CC       link.o
In file included from rdma.h:26:0,
                 from dev.c:12:
dev.c: In function 'dev_caps_tostr':
../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
 #define BIT(nr)                 (1UL << (nr))
                                      ^
rdma.h:32:61: note: in expansion of macro 'BIT'
 #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
                                                             ^~~

Fixes: 40df8263a0f0 ("rdma: Add dev object")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agofix print_0xhex on 32 bit
Stephen Hemminger [Mon, 10 Dec 2018 22:20:32 +0000 (14:20 -0800)]
fix print_0xhex on 32 bit

The argument to print_0xhex is converted to unsigned long long
so the format string give for normal printout has to be some
variant of %llx. Otherwise, bogus values will be printed on
32 bit platforms.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib/bpf: fix build warning if no elf
Stephen Hemminger [Mon, 10 Dec 2018 21:50:17 +0000 (13:50 -0800)]
lib/bpf: fix build warning if no elf

Function was not used unlesss HAVE_ELF causing:

bpf.c:105:13: warning: ‘bpf_map_offload_neutral’ defined but not used [-Wunused-function]

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipmacsec: fix warning on 32bit platform
Stephen Hemminger [Mon, 10 Dec 2018 21:47:58 +0000 (13:47 -0800)]
ipmacsec: fix warning on 32bit platform

On some 32 bit platforms, the printf was causing warning:
ipmacsec.c: In function ‘getattr_u64’:
ipmacsec.c:655:47: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
   fprintf(stderr, "invalid attribute length %lu\n",

Resolve by computing length as size_t first.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update bpf header
Stephen Hemminger [Mon, 10 Dec 2018 17:22:23 +0000 (09:22 -0800)]
uapi: update bpf header

Changes from 4.20-rc6

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Fri, 7 Dec 2018 21:02:08 +0000 (13:02 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add support for 'fw_load_policy' generic parameter
Shalom Toledo [Tue, 4 Dec 2018 10:14:08 +0000 (10:14 +0000)]
devlink: Add support for 'fw_load_policy' generic parameter

Add string to uint conversion for 'fw_load_policy' generic parameter.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Add string to uint{8,16,32} conversion for generic parameters
Shalom Toledo [Tue, 4 Dec 2018 10:14:07 +0000 (10:14 +0000)]
devlink: Add string to uint{8,16,32} conversion for generic parameters

Allow setting u{8,16,32} generic parameters as a well defined strings in
devlink user space tool.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: align uapi headers with 4.20-rc5
Stephen Hemminger [Fri, 7 Dec 2018 17:25:59 +0000 (09:25 -0800)]
rdma: align uapi headers with 4.20-rc5

Upstream headers were updated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotipc: fix misalignment printout in non-JSON output
Hoang Le [Thu, 6 Dec 2018 01:40:06 +0000 (08:40 +0700)]
tipc: fix misalignment printout in non-JSON output

In the commit 1304f50a5be0ed ("tipc: JSON support for showing nametable"),
introduced misalignment in the columns of the printout in non-JSON mode
compare to the list header. Add one space per column to make alignment
with the list header.

before:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1         1         1         node    4071367628

after:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1          1          1          node     4071367628

Reported-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: iplink_can.c: fix json formatting
Martin Jeřábek [Wed, 5 Dec 2018 15:39:20 +0000 (16:39 +0100)]
ip: iplink_can.c: fix json formatting

Previously the CAN state was always printed in human-readable txt format,
resulting in invalid JSON.

Signed-off-by: Martin Jeřábek <martin.jerabek01@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotestsuite: Add a test for batch processing
Petr Machata [Tue, 4 Dec 2018 16:07:42 +0000 (16:07 +0000)]
testsuite: Add a test for batch processing

Test that when a second or following command in a batch fails, tc
reports it correctly. This is a test for the previous patch.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolibnetlink: Process further iovs on no error
Petr Machata [Tue, 4 Dec 2018 16:07:41 +0000 (16:07 +0000)]
libnetlink: Process further iovs on no error

When no error is reported in the first iov, do not prematurely return,
but process further iovs. This fixes batch processing.

Fixes: c60389e4f9ea ("libnetlink: fix leak and using unused memory on error")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiproute2: Installation errors without libmnl
Emeric Dupont [Mon, 3 Dec 2018 11:13:06 +0000 (12:13 +0100)]
iproute2: Installation errors without libmnl

When performing make install in iproute2 (current git master),
     if $(HAVE_MNL) is not selected, some Makefiles try to call
     install with an empty target, which causes a non-critical make error.

Signed-off-by: Emeric Dupont <emeric.dupont@zii.aero>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: don't need to call pkg-config twice
Stephen Hemminger [Tue, 4 Dec 2018 22:19:33 +0000 (14:19 -0800)]
devlink: don't need to call pkg-config twice

pkg-config for libmnl is already done in config.mk

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: flower: Classify packets based port ranges
Amritha Nambiar [Tue, 27 Nov 2018 22:40:03 +0000 (14:40 -0800)]
tc: flower: Classify packets based port ranges

Added support for filtering based on port ranges.
UAPI changes have been accepted into net-next.

Example:
1. Match on a port range:
-------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower ip_proto tcp dst_port 20-30 skip_hw\
  action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port 20-30
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 85 sec used 3 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff:\
  prio 1 flower dst_ip 192.168.1.1 ip_proto tcp dst_port 100-200\
  skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 1 flower chain 0 handle 0x2
  eth_type ipv4
  ip_proto tcp
  dst_ip 192.168.1.1
  dst_port 100-200
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 58 sec used 2 sec
        Action statistics:
        Sent 920 bytes 20 pkt (dropped 20, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

v6:
Modified to change json output format as object for sport/dport.

 "dst_port":{
           "start":2000,
           "end":6000
 },
 "src_port":{
           "start":50,
           "end":60
 }

v5:
Simplified some code and used 'sscanf' for parsing. Removed
space in output format.

v4:
Added man updates explaining filtering based on port ranges.
Removed 'range' keyword.

v3:
Modified flower_port_range_attr_type calls.

v2:
Addressed Jiri's comment to sync output format with input

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoRevert "tc: flower: Classify packets based port ranges"
David Ahern [Tue, 4 Dec 2018 00:01:07 +0000 (16:01 -0800)]
Revert "tc: flower: Classify packets based port ranges"

This reverts commit e20e50b0c1643d371dc6597dfc38355d235c84a0.

Inadvertently pushed v3 of this patch.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into iproute2-next
David Ahern [Mon, 3 Dec 2018 23:39:29 +0000 (15:39 -0800)]
Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agol2tp: Fix printing of cookie and peer_cookie values
Andrea Claudi [Fri, 30 Nov 2018 14:34:24 +0000 (15:34 +0100)]
l2tp: Fix printing of cookie and peer_cookie values

print_cookie() invocations miss %s format specifier.
While at it, align printout to the previous lines.

Fixes: 98453b65800f7 ("ip/l2tp: add JSON support")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: add a missing space between rate estimator and backlog
Eric Dumazet [Fri, 30 Nov 2018 13:57:02 +0000 (05:57 -0800)]
tc: add a missing space between rate estimator and backlog

When a rate estimator is active, "tc -s qd" displays
something like :

rate 12616bit 11ppsbacklog 0b 0p requeues 2

instead of :

rate 12616bit 11pps backlog 0b 0p requeues 2

Fixes: 4fcec7f3665b ("tc: jsonify stats2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agossfilter: Fix for inverted last expression
Phil Sutter [Thu, 29 Nov 2018 12:20:37 +0000 (13:20 +0100)]
ssfilter: Fix for inverted last expression

When fixing for shift/reduce conflicts, possibility to invert the last
expression by prefixing with '!' or 'not' was accidentally removed.

Fix this by allowing for expr to be an inverted expr so that any
reference to it in exprlist accepts the inverted prefix.

Reported-by: Eric Dumazet <edumazet@google.com>
Fixes: b2038cc0b2403 ("ssfilter: Eliminate shift/reduce conflicts")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoss: add support for bytes_sent, bytes_retrans, dsack_dups and reord_seen
Eric Dumazet [Thu, 29 Nov 2018 10:27:54 +0000 (02:27 -0800)]
ss: add support for bytes_sent, bytes_retrans, dsack_dups and reord_seen

Wei Wang added these fields in linux-4.19

Tested:

ss -ti ...

ts sack cubic wscale:8,8 rto:7 rtt:2.678/0.267 mss:1428 pmtu:1500
    rcvmss:536 advmss:1428 cwnd:91 ssthresh:65
(*) bytes_sent:17470606104 bytes_retrans:2856
    bytes_acked:17470483297
    segs_out:12234320 segs_in:622983
    data_segs_out:12234318 send 388.2Mbps lastrcv:986784 lastack:1
    pacing_rate 465.8Mbps delivery_rate 162.7Mbps
    delivered:12234235 delivered_ce:3669056
    busy:986784ms unacked:84 retrans:0/2
(*) dsack_dups:2
    rcv_space:14280 rcv_ssthresh:65535 notsent:2016336 minrtt:0.183

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wei Wang <weiwan@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>