]> git.proxmox.com Git - mirror_iproute2.git/log
mirror_iproute2.git
5 years agoUpdate kernel headers
David Ahern [Fri, 28 Jun 2019 23:14:25 +0000 (16:14 -0700)]
Update kernel headers

Update kernel headers to commit:
    5cdda5f1d6ad ("ipv4: enable route flushing in network namespaces")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoutils: move parse_percent() to tc_util
Andrea Claudi [Fri, 28 Jun 2019 16:03:45 +0000 (18:03 +0200)]
utils: move parse_percent() to tc_util

As parse_percent() is used only in tc.

This reduces ip, bridge and genl binaries size:

$ bloat-o-meter -t bridge/bridge bridge/bridge.new
add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109)
Total: Before=50973, After=50864, chg -0.21%

$ bloat-o-meter -t genl/genl genl/genl.new
add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109)
Total: Before=30298, After=30189, chg -0.36%

$ bloat-o-meter ip/ip ip/ip.new
add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109)
Total: Before=674164, After=674055, chg -0.02%

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotipc: support interface name when activating UDP bearer
Hoang Le [Tue, 25 Jun 2019 04:34:39 +0000 (11:34 +0700)]
tipc: support interface name when activating UDP bearer

Support for indicating interface name has an ip address in parallel
with specifying ip address when activating UDP bearer.
This liberates the user from keeping track of the current ip address
for each device.

Old command syntax:
$tipc bearer enable media udp name NAME localip IP

New command syntax:
$tipc bearer enable media udp name NAME [localip IP|dev DEVICE]

v2:
    - Removed initial value for fd
    - Fixed the returning value for cmd_bearer_validate_and_get_addr
      to make its consistent with using: zero or non-zero
v3: - Switch to use helper 'get_ifname' to retrieve interface name
v4: - Replace legacy SIOCGIFADDR by netlink
v5: - Fix leaky rtnl_handle

Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'master' into next
David Ahern [Fri, 21 Jun 2019 22:59:24 +0000 (15:59 -0700)]
Merge branch 'master' into next

Conflicts:
include/uapi/linux/snmp.h

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: q_netem: JSON-ify the output
Jakub Kicinski [Tue, 18 Jun 2019 00:49:29 +0000 (17:49 -0700)]
tc: q_netem: JSON-ify the output

Add JSON output support to q_netem.

The normal output is untouched.

In JSON output always use seconds as the base of time units,
and non-percentage numbers (0.01 instead of 1%). Try to always
report the fields, even if they are zero.
All this should make the output more machine-friendly.

v2: less macroes

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip monitor: display interfaces from all groups
Nicolas Dichtel [Fri, 21 Jun 2019 09:21:32 +0000 (11:21 +0200)]
ip monitor: display interfaces from all groups

Only interface from group 0 were displayed.

ip monitor calls ipaddr_reset_filter() and there is no reason to not reset
the filter group in this function.

Fixes: c4fdf75d3def ("ip link: fix display of interface groups")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agonetns: make netns_{save,restore} static
Matteo Croce [Tue, 18 Jun 2019 14:49:35 +0000 (16:49 +0200)]
netns: make netns_{save,restore} static

The netns_{save,restore} functions are only used in ipnetns.c now, since
the restore is not needed anymore after the netns exec command.
Move them in ipnetns.c, and make them static.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip vrf: use hook to change VRF in the child
Matteo Croce [Tue, 18 Jun 2019 14:49:34 +0000 (16:49 +0200)]
ip vrf: use hook to change VRF in the child

On vrf exec, reset the VRF associations in the child process, via the
new hook added to cmd_exec(). In this way, the parent doesn't have to
reset the VRF associations before spawning other processes.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agonetns: switch netns in the child when executing commands
Matteo Croce [Tue, 18 Jun 2019 14:49:33 +0000 (16:49 +0200)]
netns: switch netns in the child when executing commands

'ip netns exec' changes the current netns just before executing a child
process, and restores it after forking. This is needed if we're running
in batch or do_all mode.
Some cleanups must be done both in the parent and in the child: the
parent must restore the previous netns, while the child must reset any
VRF association.
Unfortunately, if do_all is set, the VRF are not reset in the child, and
the spawned processes are started with the wrong VRF context. This can
be triggered with this script:

# ip -b - <<-'EOF'
link add type vrf table 100
link set vrf0 up
link add type dummy
link set dummy0 vrf vrf0 up
netns add ns1
EOF
# ip -all -b - <<-'EOF'
vrf exec vrf0 true
netns exec setsid -f sleep 1h
EOF
# ip vrf pids vrf0
  314  sleep
# ps 314
  PID TTY      STAT   TIME COMMAND
  314 ?        Ss     0:00 sleep 1h

Refactor cmd_exec() and pass to it a function pointer which is called in
the child before the final exec. In the netns exec case the function just
resets the VRF and switches netns.

Doing it in the child is less error prone and safer, because the parent
environment is always kept unaltered.

After this refactor some utility functions became unused, so remove them.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoAdd support for configuring MACsec gcm-aes-256 cipher type.
Pete Morici [Fri, 14 Jun 2019 17:24:59 +0000 (13:24 -0400)]
Add support for configuring MACsec gcm-aes-256 cipher type.

Signed-off-by: Pete Morici <pmorici@dev295.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMakefile: use make -C
Andrea Claudi [Thu, 13 Jun 2019 17:47:02 +0000 (19:47 +0200)]
Makefile: use make -C

make provides a handy -C option to change directory before reading
the makefiles or doing anything else.

Use that instead of the "cd dir && make && cd .." pattern, thus
simplifying sintax for some makefiles.

Changes from v1:
- Drop an obviously wrong leftover on testsuite/iproute2/Makefile

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update headers and add if_link.h and if_infiniband.h
Stephen Hemminger [Tue, 18 Jun 2019 16:46:33 +0000 (09:46 -0700)]
uapi: update headers and add if_link.h and if_infiniband.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipmroute: Prevent overlapping storage of `filter` global
Michael Forney [Sun, 16 Jun 2019 21:46:02 +0000 (14:46 -0700)]
ipmroute: Prevent overlapping storage of `filter` global

This variable has the same name as `struct xfrm_filter filter` in
ip/ipxfrm.c, but overrides that definition since `struct rtfilter`
is larger.

This is visible when built with -Wl,--warn-common in LDFLAGS:

/usr/bin/ld: ipxfrm.o: warning: common of `filter' overridden by larger common from ipmroute.o

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: add a new parameter -Numeric
Hangbin Liu [Wed, 12 Jun 2019 09:21:15 +0000 (17:21 +0800)]
ip: add a new parameter -Numeric

Add a new parameter '-Numeric' to show the number of protocol, scope,
dsfield, etc directly instead of converting it to human readable name.
Do the same on tc and ss.

This patch is based on David Ahern's previous patch.

Suggested-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'master' into next
David Ahern [Fri, 14 Jun 2019 14:29:40 +0000 (07:29 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotools: Fix include path for generate_nlmsg
David Ahern [Fri, 14 Jun 2019 13:50:55 +0000 (06:50 -0700)]
tools: Fix include path for generate_nlmsg

Compile of tools directory fails with:

make -C tools
    CC       generate_nlmsg
../../lib/libnetlink.c:28:27: fatal error: linux/nexthop.h: No such file or directory
 #include <linux/nexthop.h>
                           ^
compilation terminated.

Add local uapi to build path.

Fixes: 74829ca7dd60 ("libnetlink: Add helper to create nexthop dump request")
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMakefile: use make -C to change directory
Andrea Claudi [Thu, 13 Jun 2019 17:59:29 +0000 (19:59 +0200)]
Makefile: use make -C to change directory

make provides a handy -C option to change directory before reading
the makefiles or doing anything else.

Use that instead of the "cd dir && make && cd .." pattern, thus
simplifying sintax for some makefiles.

Changes from v1:
- Drop an obviously wrong leftover in testsuite/iproute2/Makefile

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Reviewed-and-tested-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotestsuite: intent if/else in Makefile
Stephen Hemminger [Wed, 12 Jun 2019 15:48:33 +0000 (08:48 -0700)]
testsuite: intent if/else in Makefile

Indent both arms of if/else equally.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: mnlg: Catch returned error value of dumpit commands
Moshe Shemesh [Tue, 11 Jun 2019 16:11:09 +0000 (19:11 +0300)]
devlink: mnlg: Catch returned error value of dumpit commands

Devlink commands which implements the dumpit callback may return error.
The netlink function netlink_dump() sends the errno value as the payload
of the message, while answering user space with NLMSG_DONE.
To enable receiving errno value for dumpit commands we have to check for
it in the message. If it is a negative value then the dump returned an
error so we should set errno accordingly and check for ext_ack in case
it was set.

Fixes: 049c58539f5d ("devlink: mnlg: Add support for extended ack")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'nexthop-objects' into next
David Ahern [Tue, 11 Jun 2019 17:32:07 +0000 (10:32 -0700)]
Merge branch 'nexthop-objects' into next

David Ahern  says:

====================

This set adds support for nexthop objects to the ip command. The syntax
for nexthop objects is identical to the current 'ip route .. nexthop ...'
syntax making it easy to convert existing use cases.

v2
- Fixed header use in rtnl_nexthopdump_req as noted by roopa
- made rth_del static per Stephen's request and fixed coding style
- removed print_nh_gateway and exported print_rta_gateway to reuse
  the iproute.c code (keeps consistency in output)
- added examples to commit message
- fixed monitor use when specific groups requested
- fixed usage in 'ip nexthop'
- added manpage

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoipmonitor: Add nexthop option to monitor
David Ahern [Fri, 7 Jun 2019 22:38:16 +0000 (15:38 -0700)]
ipmonitor: Add nexthop option to monitor

Add capability to ip-monitor to listen and dump nexthop messages.
Since the nexthop group = 32 which exceeds the max groups bit
field, 2 separate flags are needed - one that defaults on to indicate
nexthop group is joined by default and a second that indicates a
specific selection by the user (e.g, ip mon nexthop route).

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip route: Add option to use nexthop objects
David Ahern [Fri, 7 Jun 2019 22:38:15 +0000 (15:38 -0700)]
ip route: Add option to use nexthop objects

Add nhid option for routes to use nexthop objects by id.

Example:
  $ ip nexthop add id 1 via 10.99.1.2 dev veth1
  $ ip route add 10.100.1.0/24 nhid 1
  $ ip route ls
  ...
  10.100.1.0/24 nhid 1 via 10.99.1.2 dev veth1

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip: Add man page for nexthop command
David Ahern [Fri, 7 Jun 2019 22:38:14 +0000 (15:38 -0700)]
ip: Add man page for nexthop command

Document 'ip nexthop' options in a man page with a few examples.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoAdd support for nexthop objects
David Ahern [Fri, 7 Jun 2019 22:38:13 +0000 (15:38 -0700)]
Add support for nexthop objects

Add nexthop subcommand to ip. Implement basic commands for creating,
deleting and dumping nexthop objects. Syntax follows 'nexthop' syntax
from existing 'ip route' command.

Examples:
1. Single path
    $ ip nexthop add id 1 via 10.99.1.2 dev veth1
    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link

2. ECMP
    $ ip nexthop add id 2 via 10.99.3.2 dev veth3
    $ ip nexthop add id 1001 group 1/2
      --> creates a nexthop group with 2 component nexthops:
          id 1 and id 2 both the same weight

    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link
    id 2 via 10.99.3.2 src 10.99.3.1 dev veth3 scope link
    id 1001 group 1/2

3. Weighted multipath
    $ ip nexthop add id 1002 group 1,10/2,20
      --> creates a nexthop group with 2 component nexthops:
          id 1 with a weight of 10 and id 2 with a weight of 20

    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link
    id 2 via 10.99.3.2 src 10.99.3.1 dev veth3 scope link
    id 1001 group 1/2
    id 1002 group 1,10/2,20

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip route: Export print_rt_flags, print_rta_if and print_rta_gateway
David Ahern [Fri, 7 Jun 2019 22:38:12 +0000 (15:38 -0700)]
ip route: Export print_rt_flags, print_rta_if and print_rta_gateway

Export print_rt_flags and print_rta_if for use by the nexthop
command.

Change print_rta_gateway to take the family versus rtmsg struct and
export for use by the nexthop command.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: Add helper to create nexthop dump request
David Ahern [Fri, 7 Jun 2019 22:38:11 +0000 (15:38 -0700)]
libnetlink: Add helper to create nexthop dump request

Add rtnl_nexthopdump_req to initiate a dump request of nexthop objects.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: Import nexthop object API
David Ahern [Fri, 7 Jun 2019 22:38:10 +0000 (15:38 -0700)]
uapi: Import nexthop object API

Add nexthop.h from kernel with the uapi for nexthop objects.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: Add helper to add a group via setsockopt
David Ahern [Fri, 7 Jun 2019 22:38:09 +0000 (15:38 -0700)]
libnetlink: Add helper to add a group via setsockopt

groups > 31 have to be joined using the setsockopt. Since the nexthop
group is 32, add a helper to allow 'ip monitor' to listen for nexthop
messages.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolwtunnel: Pass encap and encap_type attributes to lwt_parse_encap
David Ahern [Fri, 7 Jun 2019 22:38:08 +0000 (15:38 -0700)]
lwtunnel: Pass encap and encap_type attributes to lwt_parse_encap

lwt_parse_encap currently assumes the encap attribute is RTA_ENCAP
and the type is RTA_ENCAP_TYPE. Change lwt_parse_encap to take these
as input arguments for reuse by nexthop code which has the attributes
as NHA_ENCAP and NHA_ENCAP_TYPE.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agolibnetlink: Set NLA_F_NESTED in rta_nest
David Ahern [Fri, 7 Jun 2019 22:38:07 +0000 (15:38 -0700)]
libnetlink: Set NLA_F_NESTED in rta_nest

Kernel now requires NLA_F_NESTED to be set on new nested
attributes. Set NLA_F_NESTED in rta_nest.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip6tunnel: fix 'ip -6 {show|change} dev <name>' cmds
Mahesh Bandewar [Thu, 6 Jun 2019 23:44:26 +0000 (16:44 -0700)]
ip6tunnel: fix 'ip -6 {show|change} dev <name>' cmds

Inclusion of 'dev' is allowed by the syntax but not handled
correctly by the command. It produces no output for show
command and falsely successful for change command but does
not make any changes.

can be verified with the following steps
  # ip -6 tunnel add ip6tnl1 mode ip6gre local fd::1 remote fd::2 tos inherit ttl 127 encaplimit none
  # ip -6 tunnel show ip6tnl1
  <correct output>
  # ip -6 tunnel show dev ip6tnl1
  <no output but correct output after this change>
  # ip -6 tunnel change dev ip6tnl1 local 2001:1234::1 remote 2001:1234::2 encaplimit none ttl 127 tos inherit allow-localremote
  # echo $?
  0
  # ip -6 tunnel show ip6tnl1
  <no changes applied, but changes are correctly applied after this change>

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: reset netns after each command in batch mode
Matteo Croce [Fri, 7 Jun 2019 20:41:22 +0000 (22:41 +0200)]
ip: reset netns after each command in batch mode

When creating a new netns or executing a program into an existing one,
the unshare() or setns() calls will change the current netns.
In batch mode, this can run commands on the wrong interfaces, as the
ifindex value is meaningful only in the current netns. For example, this
command fails because veth-c doesn't exists in the init netns:

    # ip -b - <<-'EOF'
        netns add client
        link add name veth-c type veth peer veth-s netns client
        addr add 192.168.2.1/24 dev veth-c
    EOF
    Cannot find device "veth-c"
    Command failed -:7

But if there are two devices with the same name in the init and new netns,
ip will build a wrong ll_map with indexes belonging to the new netns,
and will execute actions in the init netns using this wrong mapping.
This script will flush all eth0 addresses and bring it down, as it has
the same ifindex of veth0 in the new netns:

    # ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.76/24 brd 192.168.122.255 scope global dynamic eth0
           valid_lft 3598sec preferred_lft 3598sec

    # ip -b - <<-'EOF'
        netns add client
        link add name veth0 type veth peer name veth1
        link add name veth-ns type veth peer name veth0 netns client
        link set veth0 down
        address flush veth0
    EOF

    # ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    3: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether c2:db:d0:34:13:4a brd ff:ff:ff:ff:ff:ff
    4: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether ca:9d:6b:5f:5f:8f brd ff:ff:ff:ff:ff:ff
    5: veth-ns@if2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 32:ef:22:df:51:0a brd ff:ff:ff:ff:ff:ff link-netns client

The same issue can be triggered by the netns exec subcommand with a
sligthy different script:

    # ip netns add client
    # ip -b - <<-'EOF'
        netns exec client true
        link add name veth0 type veth peer name veth1
        link add name veth-ns type veth peer name veth0 netns client
        link set veth0 down
        address flush veth0
    EOF

Fix this by adding two netns_{save,reset} functions, which are used
to get a file descriptor for the init netns, and restore it after
each batch command.
netns_save() is called before the unshare() or setns(),
while netns_restore() is called after each command.

Fixes: 0dc34c7713bb ("iproute2: Add processless network namespace support")
Reviewed-and-tested-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'master' into next
David Ahern [Mon, 10 Jun 2019 17:32:07 +0000 (10:32 -0700)]
Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: add support for action act_ctinfo
Kevin Darbyshire-Bryant [Tue, 4 Jun 2019 13:52:09 +0000 (14:52 +0100)]
tc: add support for action act_ctinfo

ctinfo is a tc action restoring data stored in conntrack marks to
various fields.  At present it has two independent modes of operation,
restoration of DSCP into IPv4/v6 diffserv and restoration of conntrack
marks into packet skb marks.

It understands a number of parameters specific to this action in
additional to the usual action syntax.  Each operating mode is
independent of the other so all options are optional, however not
specifying at least one mode is a bit pointless.

Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
  [CONTROL] [index <INDEX>]

DSCP mode

dscp enables copying of a DSCP stored in the conntrack mark into the
ipv4/v6 diffserv field.  The mask is a 32bit field and specifies where
in the conntrack mark the DSCP value is located.  It must be 6
contiguous bits long. eg. 0xfc000000 would restore the DSCP from the
upper 6 bits of the conntrack mark.

The DSCP copying may be optionally controlled by a statemask.  The
statemask is a 32bit field, usually with a single bit set and must not
overlap the dscp mask.  The DSCP restore operation will only take place
if the corresponding bit/s in conntrack mark ANDed with the statemask
yield a non zero result.

eg. dscp 0xfc000000 0x01000000 would retrieve the DSCP from the top 6
bits, whilst using bit 25 as a flag to do so.  Bit 26 is unused in this
example.

CPMARK mode

cpmark enables copying of the conntrack mark to the packet skb mark.  In
this mode it is completely equivalent to the existing act_connmark
action.  Additional functionality is provided by the optional mask
parameter, whereby the stored conntrack mark is logically ANDed with the
cpmark mask before being stored into skb mark.  This allows shared usage
of the conntrack mark between applications.

eg. cpmark 0x00ffffff would restore only the lower 24 bits of the
conntrack mark, thus may be useful in the event that the upper 8 bits
are used by the DSCP function.

Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
  [CONTROL] [index <INDEX>]
where :
dscp MASK is the bitmask to restore DSCP
     STATEMASK is the bitmask to determine conditional restoring
cpmark MASK mask applied to restored packet mark
ZONE is the conntrack zone
CONTROL := reclassify | pipe | drop | continue | ok |
   goto chain <CHAIN_INDEX>

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: Import tc_ctinfo uapi
David Ahern [Mon, 10 Jun 2019 17:23:32 +0000 (10:23 -0700)]
uapi: Import tc_ctinfo uapi

Add tc_ctinfo.h uapi file from kernel.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Mon, 10 Jun 2019 16:39:08 +0000 (09:39 -0700)]
Update kernel headers

Update kernel headers to commit:
    ad3a9ee0b623 ("ocelot: remove unused variable 'rc' in vcap_cmd()")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: simple: don't hardcode the control action
Davide Caratti [Tue, 4 Jun 2019 22:30:16 +0000 (00:30 +0200)]
tc: simple: don't hardcode the control action

the following TDC test case:

 b776 - Replace simple action with invalid goto chain control

checks if the kernel correctly validates the 'goto chain' control action,
when it is specified in 'act_simple' rules. The test systematically fails
because the control action is hardcoded in parse_simple(), i.e. it is not
parsed by command line arguments, so its value is constantly TC_ACT_PIPE.
Because of that, the following command:

 # tc action add action simple sdata "test" drop index 7

installs an 'act_simple' rule that never drops packets, and whose 'index'
is the first IDR available, plus an 'act_gact' rule with 'index' equal to
7, that drops packets.

Use parse_action_control_dflt(), like we did on many other TC actions, to
make the control action configurable also with 'act_simple'. The expected
results of test b776 are summarized below:

 iproute2
   v       kernel->| 5.1-rc2 (and previous)  | 5.1-rc3 (and subsequent)
 ------------------+-------------------------+-------------------------
 5.1.0             | FAIL (bad IDR)          | FAIL (bad IDR)
 5.1.0(patched)    | FAIL (no rule/bad sdata)| PASS

Changes since v1:
 - reword commit message, thanks Stephen Hemminger

Fixes: 087f46ee4ebd ("tc: introduce simple action")
CC: Andrea Claudi <aclaudi@redhat.com>
CC: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotc: Fix binding of gact action by index.
Roman Mashak [Thu, 6 Jun 2019 21:32:09 +0000 (17:32 -0400)]
tc: Fix binding of gact action by index.

The following operation fails:
% sudo tc actions add action pipe index 1
% sudo tc filter add dev lo parent ffff: \
       protocol ip pref 10 u32 match ip src 127.0.0.2 \
       flowid 1:10 action gact index 1

Bad action type index
Usage: ... gact <ACTION> [RAND] [INDEX]
Where:  ACTION := reclassify | drop | continue | pass | pipe |
                  goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
        RAND := random <RANDTYPE> <ACTION> <VAL>
        RANDTYPE := netrand | determ
        VAL : = value not exceeding 10000
        JUMP_COUNT := Absolute jump from start of action list
        INDEX := index value used

However, passing a control action of gact rule during filter binding works:

% sudo tc filter add dev lo parent ffff: \
       protocol ip pref 10 u32 match ip src 127.0.0.2 \
       flowid 1:10 action gact pipe index 1

Binding by reference, i.e. by index, has to consistently work with
any tc action.

Since tc is sensitive to the order of keywords passed on the command line,
we can teach gact to skip parsing arguments as soon as it sees 'gact'
followed by 'index' keyword.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: Increase bus, device buffer size to 64 bytes
Parav Pandit [Thu, 6 Jun 2019 11:49:19 +0000 (06:49 -0500)]
devlink: Increase bus, device buffer size to 64 bytes

Device name on mdev bus is 36 characters long which follow standard uuid
RFC 4122.
This is probably the longest name that a kernel will return for a
device.

Hence increase the buffer size to 64 bytes.

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: tc-skbedit.8: document 'inheritdsfield'
Davide Caratti [Fri, 31 May 2019 12:12:15 +0000 (14:12 +0200)]
man: tc-skbedit.8: document 'inheritdsfield'

while at it, fix missing square bracket near 'ptype' and a typo in the
action description (it's -> its).

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'rdma-net-namespace' into next
David Ahern [Fri, 31 May 2019 22:10:55 +0000 (15:10 -0700)]
Merge branch 'rdma-net-namespace' into next

Parav Pandit  says:

====================

RDMA subsystem can be running in either of the modes.
(a) Sharing RDMA devices among multiple net namespaces or
(b) Exclusive mode where RDMA device is bound to single net namespace

This patch series adds
(1) query command to query rdma subsystem sharing mode
(2) set command to change rdma subsystem sharing mode
(3) assign rdma device to a net namespace

rdma tool examples:
(a) Query current rdma subsys net namespace sharing mode
$ rdma sys show
netns shared

(b) Change rdma subsys mode to exclusive mode
$ rdma sys set netns exclusive

$ rdma sys show
netns exclusive

(c) Assign rdma device to a specific newly created net namespace
$ ip netns add foo
$ rdma dev set mlx5_1 netns foo

====================

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add man page for rdma dev set netns command
Parav Pandit [Fri, 31 May 2019 03:11:17 +0000 (22:11 -0500)]
rdma: Add man page for rdma dev set netns command

Add man page to describe additional set netns command
for rdma device.

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add an option to set net namespace of rdma device
Parav Pandit [Fri, 31 May 2019 03:11:16 +0000 (22:11 -0500)]
rdma: Add an option to set net namespace of rdma device

Enrich rdmatool with an option to set network namespace of RDMA
device. After successful execution of it, rdma device will
be accessible only in assigned network namespace.

rdma tool command examples and output.

First set netns mode to exclusive.

$ rdma system set netns exclusive

Now create network namespace and assign RDMA device to this
network namespace.

$ ip netns add foo
$ rdma dev set mlx5_1 netns foo

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add man pages for rdma system commands
Parav Pandit [Fri, 31 May 2019 03:11:15 +0000 (22:11 -0500)]
rdma: Add man pages for rdma system commands

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: Add an option to query,set net namespace sharing sys parameter
Parav Pandit [Fri, 31 May 2019 03:11:14 +0000 (22:11 -0500)]
rdma: Add an option to query,set net namespace sharing sys parameter

Enrich rdmatool with an option to query rdma subsystem parameter
whether rdma devices are shared among multiple network namespaces
or exclusive to single network namespace.

rdma tool command examples and output.

$ rdma system show
netns shared

$ rdma system set netns exclusive

$ rdma system show
netns exclusive

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink: don't try to get ll addr len when creating an iface
Nicolas Dichtel [Wed, 29 May 2019 14:42:10 +0000 (16:42 +0200)]
iplink: don't try to get ll addr len when creating an iface

It will obviously fail. This is a follow up of the
commit 757837230a65 ("lib: suppress error msg when filling the cache").

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: mdb: restore text output format
Nikolay Aleksandrov [Wed, 29 May 2019 17:52:42 +0000 (20:52 +0300)]
bridge: mdb: restore text output format

While I fixed the mdb json output, I did overlook the text output.
This patch returns the original text output format:
 dev <bridge> port <port> grp <mcast group> <temp|permanent> <flags> <timer>
Example (old format, restored by this patch):
 dev br0 port eth8 grp 239.1.1.11 temp

Example (changed format after the commit below):
 23: br0  eth8  239.1.1.11  temp

We had some reports of failing scripts which were parsing the output.
Also the old format matches the bridge mdb command syntax which makes
it easier to build commands out of the output.

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUpdate kernel headers
David Ahern [Wed, 29 May 2019 19:36:58 +0000 (12:36 -0700)]
Update kernel headers

Update kernel headers to commit:
    1167187f2759 ("Merge branch 'qed-Fix-inifinite-spinning-of-PTP-poll-thread'")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: flower: fix port value truncation
Lukasz Czapnik [Mon, 27 May 2019 21:03:49 +0000 (23:03 +0200)]
tc: flower: fix port value truncation

sscanf truncates read port values silently without any error. As sscanf
man says:
(...) sscanf() conform to C89 and C99 and POSIX.1-2001. These standards
do not specify the ERANGE error.

Replace sscanf with safer get_be16 that returns error when value is out
of range.

Example:
tc filter add dev eth0 protocol ip parent ffff: prio 1 flower ip_proto
tcp dst_port 70000 hw_tc 1

Would result in filter for port 4464 without any warning.

Fixes: 8930840e678b ("tc: flower: Classify packets based port ranges")
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agolib: suppress error msg when filling the cache
Nicolas Dichtel [Fri, 24 May 2019 08:59:10 +0000 (10:59 +0200)]
lib: suppress error msg when filling the cache

Before the patch:
$ ip netns add foo
$ ip link add name veth1 address 2a:a5:5c:b9:52:89 type veth peer name veth2 address 2a:a5:5c:b9:53:90 netns foo
RTNETLINK answers: No such device
RTNETLINK answers: No such device

But the command was successful. This may break script. Let's remove those
error messages.

Fixes: 55870dfe7f8b ("Improve batch and dump times by caching link lookups")
Reported-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: minor upstream btf.h header change
Stephen Hemminger [Fri, 24 May 2019 22:51:06 +0000 (15:51 -0700)]
uapi: minor upstream btf.h header change

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agom_mirred: don't bail if the control action is missing
Paolo Abeni [Mon, 20 May 2019 09:56:52 +0000 (11:56 +0200)]
m_mirred: don't bail if the control action is missing

The mirred act admits an optional control action, defaulting
to TC_ACT_PIPE. The parsing code currently emits an error message
if the control action is not provided on the command line, even
if the command itself completes with no error.

This change shuts down the error message, using the appropriate
parsing helper.

Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoman: fix macaddr section of ip-link
Stephen Hemminger [Tue, 21 May 2019 18:27:14 +0000 (11:27 -0700)]
man: fix macaddr section of ip-link

The formatting of setting mac address was confusing.
Break lines and fix highlighting.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotreewide: refactor help messages
Matteo Croce [Fri, 17 May 2019 13:38:28 +0000 (15:38 +0200)]
treewide: refactor help messages

Every tool in the iproute2 package have one or more function to show
an help message to the user. Some of these functions print the help
line by line with a series of printf call, e.g. ip/xfrm_state.c does
60 fprintf calls.
If we group all the calls to a single one and just concatenate strings,
we save a lot of libc calls and thus object size. The size difference
of the compiled binaries calculated with bloat-o-meter is:

        ip/ip:
        add/remove: 0/0 grow/shrink: 5/15 up/down: 103/-4796 (-4693)
        Total: Before=672591, After=667898, chg -0.70%
        ip/rtmon:
        add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-54 (-54)
        Total: Before=48879, After=48825, chg -0.11%
        tc/tc:
        add/remove: 0/2 grow/shrink: 31/10 up/down: 882/-6133 (-5251)
        Total: Before=351912, After=346661, chg -1.49%
        bridge/bridge:
        add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-459 (-459)
        Total: Before=70502, After=70043, chg -0.65%
        misc/lnstat:
        add/remove: 0/1 grow/shrink: 1/0 up/down: 48/-486 (-438)
        Total: Before=9960, After=9522, chg -4.40%
        tipc/tipc:
        add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-62 (-44)
        Total: Before=79182, After=79138, chg -0.06%

While at it, indent some strings which were starting at column 0,
and use tabs where possible, to have a consistent style across helps.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Mon, 20 May 2019 21:34:26 +0000 (14:34 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agordma: update uapi headers
Stephen Hemminger [Sat, 18 May 2019 13:37:58 +0000 (06:37 -0700)]
rdma: update uapi headers

Based on 5.2-rc
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agordma: Update node type strings
Gal Pressman [Wed, 15 May 2019 06:58:36 +0000 (09:58 +0300)]
rdma: Update node type strings

Fix typo in usnic_udp node type and add a string for the unspecified
node type.

Signed-off-by: Gal Pressman <galpress@amazon.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: merge bpf.h from 5.2
Stephen Hemminger [Wed, 15 May 2019 16:53:07 +0000 (09:53 -0700)]
uapi: merge bpf.h from 5.2

Upstream commit to fix spelling errors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: add sockios.h
Stephen Hemminger [Wed, 15 May 2019 16:51:15 +0000 (09:51 -0700)]
uapi: add sockios.h

Forgot to add this to earlier commit.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agomailmap: map David's mail address
Stephen Hemminger [Wed, 15 May 2019 16:31:55 +0000 (09:31 -0700)]
mailmap: map David's mail address

Cleans up multiple mail addresses in shortlog output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agomailmap: add myself
Stephen Hemminger [Wed, 15 May 2019 16:30:47 +0000 (09:30 -0700)]
mailmap: add myself

Put entries in for past commit mail addresses

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: update headers to import asm-generic/sockios.h
Stephen Hemminger [Mon, 13 May 2019 21:56:15 +0000 (14:56 -0700)]
uapi: update headers to import asm-generic/sockios.h

import asm-generic/sockios.h to fix the compile errors from the
movement of timestamp macros.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agouapi: add include/linux/net.h
Stephen Hemminger [Mon, 13 May 2019 21:54:26 +0000 (14:54 -0700)]
uapi: add include/linux/net.h

All kernel headers must come from this repo,
and ss is including linux/net.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Fri, 10 May 2019 19:01:01 +0000 (12:01 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers and add asm-generic/sockios.h
David Ahern [Fri, 10 May 2019 17:06:41 +0000 (10:06 -0700)]
Update kernel headers and add asm-generic/sockios.h

Update kernel headers to commit
    b970afcfcabd ("Merge tag 'powerpc-5.2-1'")

and import asm-generic/sockios.h to fix the compile errors from the
movement of timestamp macros.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: update to elf-em header
Stephen Hemminger [Fri, 10 May 2019 15:56:52 +0000 (08:56 -0700)]
uapi: update to elf-em header

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoMerge ../iproute2-next
Stephen Hemminger [Fri, 10 May 2019 15:55:11 +0000 (08:55 -0700)]
Merge ../iproute2-next

5 years agov5.1.0
Stephen Hemminger [Fri, 10 May 2019 15:45:14 +0000 (08:45 -0700)]
v5.1.0

5 years agoip-xfrm: Respect family in deleteall and list commands
Phil Sutter [Mon, 6 May 2019 17:09:56 +0000 (19:09 +0200)]
ip-xfrm: Respect family in deleteall and list commands

Allow to limit 'ip xfrm {state|policy} list' output to a certain address
family and to delete all states/policies by family.

Although preferred_family was already set in filters, the filter
function ignored it. To enable filtering despite the lack of other
selectors, filter.use has to be set if family is not AF_UNSPEC.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoipnetns: use-after-free problem in get_netnsid_from_name func
Zhiqiang Liu [Sun, 5 May 2019 01:59:51 +0000 (09:59 +0800)]
ipnetns: use-after-free problem in get_netnsid_from_name func

Follow the following steps:
 # ip netns add net1
 # export MALLOC_MMAP_THRESHOLD_=0
 # ip netns list
then Segmentation fault (core dumped) will occur.

In get_netnsid_from_name func, answer is freed before
rta_getattr_u32(tb[NETNSA_NSID]), where tb[] refers to answer`s
content. If we set MALLOC_MMAP_THRESHOLD_=0, mmap will be adoped to
malloc memory, which will be freed immediately after calling free
func.  So reading tb[NETNSA_NSID] will access the released memory
after free(answer).

Here, we will call get_netnsid_from_name(tb[NETNSA_NSID]) before free(answer).

Fixes: 86bf43c7c2f ("lib/libnetlink: update rtnl_talk to support malloc buff at run time")
Reported-by: Huiying Kou <kouhuiying@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agodevlink: Fix monitor command
Ido Schimmel [Sun, 5 May 2019 14:12:43 +0000 (17:12 +0300)]
devlink: Fix monitor command

The command is supposed to allow users to filter events related to
certain objects, but returns an error when an object is specified:

# devlink mon dev
Command "dev" not found

Fix this by allowing the command to process the specified objects.

Example:

# devlink/devlink mon dev &
# echo "10 1" > /sys/bus/netdevsim/new_device
[dev,new] netdevsim/netdevsim10

# devlink/devlink mon port &
# echo "11 1" > /sys/bus/netdevsim/new_device
[port,new] netdevsim/netdevsim11/0: type notset flavour physical
[port,new] netdevsim/netdevsim11/0: type eth netdev eth1 flavour physical

# devlink/devlink mon &
# echo "12 1" > /sys/bus/netdevsim/new_device
[dev,new] netdevsim/netdevsim12
[port,new] netdevsim/netdevsim12/0: type notset flavour physical
[port,new] netdevsim/netdevsim12/0: type eth netdev eth2 flavour physical

Fixes: a3c4b484a1ed ("add devlink tool")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agotaprio: Add support for cycle_time and cycle_time_extension
Vinicius Costa Gomes [Mon, 29 Apr 2019 22:52:19 +0000 (15:52 -0700)]
taprio: Add support for cycle_time and cycle_time_extension

This allows a cycle-time and a cycle-time-extension to be specified.

Specifying a cycle-time will truncate that cycle, so when that instant
is reached, the cycle will start from its beginning.

A cycle-time-extension may cause the last entry of a cycle, just
before the start of a new schedule (the base-time of the "admin"
schedule) to be extended by at maximum "cycle-time-extension"
nanoseconds. The idea of this feauture, as described by the IEEE
802.1Q, is too avoid too narrow gate states.

Example:

tc qdisc change dev IFACE parent root handle 100 taprio \
      sched-entry S 0x1 1000000 \
      sched-entry S 0x0 2000000 \
      sched-entry S 0x1 3000000 \
      sched-entry S 0x0 4000000 \
      cycle-time-extension 100000 \
      cycle-time 9000000 \
      base-time 12345678900000000

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotaprio: Add support for changing schedules
Vinicius Costa Gomes [Mon, 29 Apr 2019 22:52:18 +0000 (15:52 -0700)]
taprio: Add support for changing schedules

This allows for a new schedule to be specified during runtime, without
removing the current one.

For that, the semantics of the 'tc qdisc change' operation in the
context of taprio is that if "change" is called and there is a running
schedule, a new schedule is created and the base-time (let's call it
X) of this new schedule is used so at instant X, it becomes the
"current" schedule. So, in short, "change" doesn't change the current
schedule, it creates a new one and sets it up to it becomes the
current one at some point.

In IEEE 802.1Q terms, it means that we have support for the
"Oper" (current and read-only) and "Admin" (future and mutable)
schedules.

Example of creating the first schedule, then adding a new one:

(1)
tc qdisc add dev IFACE parent root handle 100 taprio \
             num_tc 1 \
      map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
      queues 1@0 \
      sched-entry S 0x1 1000000 \
      sched-entry S 0x0 2000000 \
      sched-entry S 0x1 3000000 \
      sched-entry S 0x0 4000000 \
      base-time 100000000 \
      clockid CLOCK_TAI

(2)
tc qdisc change dev IFACE parent root handle 100 taprio \
      base-time 7500000000000 \
      sched-entry S 0x0 5000000 \
              sched-entry S 0x1 5000000 \

It was necessary to fix a bug, so the clockid doesn't need to be
specified when changing the schedule.

Most of the changes are related to make it easier to reuse the same
function for printing the "admin" and "oper" schedules.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc: add support for plug qdisc
Paolo Abeni [Tue, 30 Apr 2019 16:53:57 +0000 (18:53 +0200)]
tc: add support for plug qdisc

sch_plug can be used to perform functional qdisc unit tests
controlling explicitly the queuing behaviour from user-space.

Plug support lacks since its introduction in 2012. This change
introduces basic support, to control the tc status.

v1 -> v2:
 - use the SPDX identifier

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Sat, 4 May 2019 16:13:26 +0000 (09:13 -0700)]
Update kernel headers

Update kernel headers to commit
   a734d1f4c2fc ("net: openvswitch: return an error instead of doing BUG_ON()")

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agouapi: wrap SIOCGSTAMP and SIOCGSTAMPNS in ifndef
David Ahern [Thu, 2 May 2019 23:13:21 +0000 (16:13 -0700)]
uapi: wrap SIOCGSTAMP and SIOCGSTAMPNS in ifndef

These warnings:
    ../include/uapi/linux/sockios.h:42:0: warning: "SIOCGSTAMP" redefined
    ../include/uapi/linux/sockios.h:43:0: warning: "SIOCGSTAMPNS" redefined

are from kernel commit 0768e17073dc5 ("net: socket: implement 64-bit
timestamps"). This commit moved the definitions of SIOCGSTAMP and
SIOCGSTAMPNS from include/asm-generic/sockios.h to
include/uapi/linux/sockios.h. Older OS'es already define them in
/usr/include/asm-generic/sockios.h resulting in ugly compile errors now:

In file included from ll_types.c:24:0:
../include/uapi/linux/sockios.h:42:0: warning: "SIOCGSTAMP" redefined
 #define SIOCGSTAMP SIOCGSTAMP_OLD

In file included from /usr/include/x86_64-linux-gnu/asm/sockios.h:1:0,
                 from /usr/include/asm-generic/socket.h:5,
                 from /usr/include/x86_64-linux-gnu/asm/socket.h:1,
                 from /usr/include/x86_64-linux-gnu/bits/socket.h:368,
                 from /usr/include/x86_64-linux-gnu/sys/socket.h:38,
                 from ll_types.c:17:
/usr/include/asm-generic/sockios.h:11:0: note: this is the location of the previous definition
 #define SIOCGSTAMP 0x8906  /* Get stamp (timeval) */

so wrap them in #ifndef.

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoss: add option to print socket information on one line
Josh Hunt [Wed, 1 May 2019 01:38:38 +0000 (21:38 -0400)]
ss: add option to print socket information on one line

Multi-line output in ss makes it difficult to search for things with
grep. This new option will make it easier to find sockets matching
certain criteria with simple grep commands.

Example without option:
$ ss -emoitn
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port
ESTAB      0      0      127.0.0.1:13265              127.0.0.1:36743               uid:1974 ino:48271 sk:1 <->
 skmem:(r0,rb2227595,t0,tb2626560,f0,w0,o0,bl0,d0) ts sack reno wscale:7,7 rto:211 rtt:10.245/16.616 ato:40 mss:65483 cwnd:10 bytes_acked:41865496 bytes_received:21580440 segs_out:242496 segs_in:351446 data_segs_out:242495 data_segs_in:242495 send 511.3Mbps lastsnd:2383 lastrcv:2383 lastack:2342 pacing_rate 1022.6Mbps rcv_rtt:92427.6 rcv_space:43725 minrtt:0.007

Example with new option:
$ ss -emoitnO
State    Recv-Q Send-Q          Local Address:Port            Peer Address:Port
ESTAB    0      0                   127.0.0.1:13265              127.0.0.1:36743 uid:1974 ino:48271 sk:1 <-> skmem:(r0,rb2227595,t0,tb2626560,f0,w0,o0,bl0,d0) ts sack reno wscale:7,7 rto:211 rtt:10.067/16.429 ato:40 mss:65483 pmtu:65535 rcvmss:536 advmss:65483 cwnd:10 bytes_sent:41868244 bytes_acked:41868244 bytes_received:21581866 segs_out:242512 segs_in:351469 data_segs_out:242511 data_segs_in:242511 send 520.4Mbps lastsnd:14355 lastrcv:14355 lastack:14314 pacing_rate 1040.7Mbps delivery_rate 74837.7Mbps delivered:242512 app_limited busy:1861946ms rcv_rtt:92427.6 rcv_space:43725 rcv_ssthresh:43690 minrtt:0.007

Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agodevlink: Increase column size for larger shared buffers
Ido Schimmel [Tue, 30 Apr 2019 08:42:08 +0000 (11:42 +0300)]
devlink: Increase column size for larger shared buffers

With current number of spaces the output is mangled if the shared buffer
is congested.

Before:

# devlink sb occupancy show swp25
swp25:
  pool: 0:    33384960/39344256 1:          0/0       2:          0/0       3:          0/0
        4:          0/720     5:          0/0       6:          0/0       7:          0/0
        8:          0/288     9:          0/0      10:          0/0
  itc:  0(0): 33272064/39344256 1(0):       0/0       2(0):       0/0       3(0):       0/0
        4(0):       0/0       5(0):       0/0       6(0):       0/0       7(0):       0/0
  etc:  0(4):       0/720     1(4):       0/0       2(4):       0/0       3(4):       0/0
        4(4):       0/0       5(4):       0/0       6(4):       0/0       7(4):       0/0
        8(8):       0/288     9(8):       0/0      10(8):       0/0      11(8):       0/0
       12(8):       0/0      13(8):       0/0      14(8):       0/0      15(8):       0/0

After:

# devlink sb occupancy show swp25
swp25:
  pool: 0:      39070080/39344256   1:             0/0          2:             0/0          3:             0/0
        4:             0/720        5:             0/0          6:             0/0          7:             0/0
        8:             0/288        9:             0/0         10:             0/0
  itc:  0(0):   39062016/39344256   1(0):          0/0          2(0):          0/0          3(0):          0/0
        4(0):          0/0          5(0):          0/0          6(0):          0/0          7(0):          0/0
  etc:  0(4):          0/720        1(4):          0/0          2(4):          0/0          3(4):          0/0
        4(4):          0/0          5(4):          0/0          6(4):          0/0          7(4):          0/0
        8(8):          0/288        9(8):          0/0         10(8):          0/0         11(8):          0/0
       12(8):          0/0         13(8):          0/0         14(8):          0/0         15(8):          0/0

v2:
* Increase number of spaces to make the change more future-proof

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip: mroute: add fflush to print_mroute
Nikolay Aleksandrov [Fri, 26 Apr 2019 10:54:21 +0000 (13:54 +0300)]
ip: mroute: add fflush to print_mroute

Similar to other print functions we need to flush buffered data
in order to work with pipes and output redirects.

After this patch ip monitor mroute &>log works properly.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUpdate tc-bpf.8 man page examples
Lucas Siba 2019-04-20 11:40 UTC [Sat, 20 Apr 2019 19:06:18 +0000 (12:06 -0700)]
Update tc-bpf.8 man page examples

This patch updates the tc-bpf.8 example application for changes to the
struct bpf_elf_map definition. In it's current form, things compile, but
the resulting object file is rejected by the verifier when attempting to
load it through tc.

Signed-off-by: Lucas Siba <lucas.siba@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
[ dropped the unnecessary flags initialization on commit ]

5 years agoMerge branch 'iproute2-master' into next
David Ahern [Fri, 26 Apr 2019 18:13:54 +0000 (11:13 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink_vlan: add support for VLAN bridge binding flag
Mike Manning [Sat, 20 Apr 2019 10:45:37 +0000 (11:45 +0100)]
iplink_vlan: add support for VLAN bridge binding flag

This patch adds support for the VLAN bridge binding flag that is
provided in net-next kernel by the series merged by 1ab839281cf7
("net-support-binding-vlan-dev-link-state-to-vlan-member-bridge-ports")

Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoUpdate kernel headers
David Ahern [Fri, 26 Apr 2019 18:02:36 +0000 (11:02 -0700)]
Update kernel headers

Update kernel headers to commit
    148f025d41a8 ("Merge branch 'hns3-next'")

Note, these warnings:
../include/uapi/linux/sockios.h:42:0: warning: "SIOCGSTAMP" redefined
../include/uapi/linux/sockios.h:43:0: warning: "SIOCGSTAMPNS" redefined

are due to kernel commit
    0768e17073dc5 ("net: socket: implement 64-bit timestamps")

which moved the definitions from include/asm-generic/sockios.h
to include/uapi/linux/sockios.h

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agotc/ematch: fix deprecated yacc warning
Stephen Hemminger [Wed, 24 Apr 2019 22:08:31 +0000 (15:08 -0700)]
tc/ematch: fix deprecated yacc warning

Newer versions of Bison deprecated some directives.

    YACC     emp_ematch.yacc.c
emp_ematch.y:11.1-14: warning: deprecated directive, use ‘%define parse.error verbose’ [-Wdeprecated]
 %error-verbose
 ^~~~~~~~~~~~~~
emp_ematch.y:12.1-22: warning: deprecated directive, use ‘%define api.prefix {ematch_}’ [-Wdeprecated]
 %name-prefix "ematch_"

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: always print realms keyword for rule
Thomas Haller [Tue, 23 Apr 2019 07:16:15 +0000 (09:16 +0200)]
iprule: always print realms keyword for rule

# rule add priority 10 realms 1/0xF
    # rule add priority 10 realms 0/0xF
    # ip rule
    10:     from all lookup main 15
    10:     from all lookup main realms 1/15

The previous behavior was there since the beginning.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: refactor print_rule() to use leading space before printing attribute
Thomas Haller [Tue, 23 Apr 2019 07:16:14 +0000 (09:16 +0200)]
iprule: refactor print_rule() to use leading space before printing attribute

When printing the actions, we avoid adding the trailing space after the
attribute. Possibly because we expect the action to be the last output
on the line and not end with a space.

But for FR_ACT_TO_TBL nothing is printed. That means, we add double
spaces if a protocol is printed as well:

    # ip rule add priority 10 protocol 10 type 1

will be printed as

    10:     from all lookup 1  proto mrt

The only visible effect of the patch is to avoid the double-space and
avoid a trailing space if the action is FR_ACT_TO_TBL.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: avoid trailing space in print_rule() after printing protocol
Thomas Haller [Tue, 23 Apr 2019 07:16:13 +0000 (09:16 +0200)]
iprule: avoid trailing space in print_rule() after printing protocol

It seems print_rule() tries to avoid a trailing space at the end
of the line. At least, when printing details about the actions,
they no longer append the space. Probably expecting to be the
last attribute that will be printed.

Don't let the protocol add the trailing space. The space at the end
of the line should be printed consistently (or not).

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoiprule: avoid printing extra space after gateway for nat action
Thomas Haller [Tue, 23 Apr 2019 07:16:12 +0000 (09:16 +0200)]
iprule: avoid printing extra space after gateway for nat action

For all other actions we avoid the trailing space, so do it here
as well.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip fou: Support binding FOU ports
Kristian Evensen [Mon, 22 Apr 2019 15:27:41 +0000 (17:27 +0200)]
ip fou: Support binding FOU ports

This patch adds support for binding FOU ports using iproute2.
Kernel-support was added in 1713cb37bf67 ("fou: Support binding FoU
socket").

The parse function now handles new arguments for setting the
binding-related attributes, while the print function writes the new
attributes if they are set. Also, the man page has been updated.

v2->v3:
* Remove redundant ll_init_map()-calls (thanks David Ahern).

v1->v2 (all changes suggested by David Ahern):
* Fix reverse Christmas tree ordering.
* Remove redundant peer_port_set-variable, it is enough to check
peer_port.
* Add proper error handling of invalid local/peer addresses.
* Use interface name and not index.
* Remove updating fou-header file, it is already done.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoiplink: bridge: add support for vlan_stats_per_port
Nikolay Aleksandrov [Tue, 16 Apr 2019 13:19:10 +0000 (16:19 +0300)]
iplink: bridge: add support for vlan_stats_per_port

Add support for manipulating and showing the vlan_stats_per_port bridge
option which can be toggled only when there are no port VLANs
configured. Also update the man page with the new option.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoipneigh: Print neighbour offload indication
Ido Schimmel [Thu, 18 Apr 2019 06:44:05 +0000 (06:44 +0000)]
ipneigh: Print neighbour offload indication

Print the offload indication in case it is set on the neighbour.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agobridge: vlan: fix standard stats output
Nikolay Aleksandrov [Tue, 16 Apr 2019 15:30:12 +0000 (18:30 +0300)]
bridge: vlan: fix standard stats output

Each of the commits below broke the vlan stats output in a different
way:
45fca4ed9412 ("bridge: fix vlan show stats formatting")
 Added a second print of an interface name (e.g. eth4eth4)
c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
 Broke normal vlan stats output by not printing a new line after them
 Also printed interfaces without any vlans when printing stats

This fix is not pretty but it brings back the previous behaviour.

Before this fix:
$ bridge -s vlan show
port             vlan id
br0br0              1 PVID Egress Untagged
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets 4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packetseth4eth4             4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packetsroot@debian:~/

After this fix:
$ bridge -s vlan show
port             vlan id
br0              1 PVID Egress Untagged
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets
                 4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets
eth4             4
                   RX: 0 bytes 0 packets
                   TX: 0 bytes 0 packets

Fixes: 45fca4ed9412 ("bridge: fix vlan show stats formatting")
Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobridge: mdb: restore valid json output
Nikolay Aleksandrov [Fri, 12 Apr 2019 15:30:55 +0000 (18:30 +0300)]
bridge: mdb: restore valid json output

Since the commit below mdb's json output has been invalid and also with
changed format. Restore it to a valid json like the previous format.
Also takes care of a double "Deleted" print when monitoring for changes.

Example bridge -p -d -j mdb show:
 [ {
        "mdb": [ {
                "index": 4,
                "dev": "virbr0",
                "port": "vnet2",
                "grp": "ff02::202",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 4,
                "dev": "virbr0",
                "port": "vnet2",
                "grp": "ff02::1:fffb:1939",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 6,
                "dev": "virbr1",
                "port": "vnet7",
                "grp": "ff02::202",
                "state": "temp",
                "flags": [ ]
            },{
                "index": 6,
                "dev": "virbr1",
                "port": "vnet7",
                "grp": "ff02::1:ffd0:f61f",
                "state": "temp",
                "flags": [ ]
            } ],
        "router": {
            "virbr0": [ {
                    "port": "vnet1"
                },{
                    "port": "vnet0"
                } ],
            "virbr1": [ {
                    "port": "vnet5"
                } ]
        }
    } ]

Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: add missing space after 'external' in detailed mode
Beniamino Galvani [Tue, 16 Apr 2019 14:04:39 +0000 (16:04 +0200)]
ip: add missing space after 'external' in detailed mode

Add a missing space after the 'external' keyword in the detailed mode
of tunnel links output:

 # ip -d link
 79: geneve1: <BROADCAST,MULTICAST> mtu 65465 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether da:e9:e4:2b:f9:d4 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65465
     geneve externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 80: vxlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether 7a:a8:19:07:da:01 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65535
     vxlan externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 84: gre1@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/none 00:00:00:00 brd 00:00:00:00 promiscuity 0 minmtu 0 maxmtu 0
     gre externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 87: ip6gre1@NONE: <NOARP> mtu 1448 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/gre6 :: brd :: promiscuity 0 minmtu 0 maxmtu 0
     ip6gre externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 88: ip6tnl1@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/tunnel6 :: brd :: promiscuity 0 minmtu 68 maxmtu 65407
     ip6tnl externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
 90: ipip1@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ipip 0.0.0.0 brd 0.0.0.0 promiscuity 0 minmtu 0 maxmtu 0
     ipip externaladdrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Fixes: 00ff4b8e31af ("ip/tunnel: Be consistent when printing tunnel collect metadata")
Reviewed-and-tested-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoUpdate kernel headers
David Ahern [Wed, 17 Apr 2019 21:07:48 +0000 (14:07 -0700)]
Update kernel headers

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

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoMerge branch 'iproute2-master' into next
David Ahern [Wed, 17 Apr 2019 20:59:44 +0000 (13:59 -0700)]
Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
5 years agoip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies
Eyal Birger [Thu, 4 Apr 2019 16:07:38 +0000 (19:07 +0300)]
ip xfrm: support setting/printing XFRMA_IF_ID attribute in states/policies

The XFRMA_IF_ID attribute is set in policies/states for them to be
associated with an XFRM interface (4.19+).

Add support for setting / displaying this attribute.

Note that 0 is a valid value therefore set XFRMA_IF_ID if any value
was provided in command line.

Tested-by: Antony Antony <antony@phenome.org>
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: display netrom link type
Ralf Baechle [Thu, 4 Apr 2019 10:21:54 +0000 (12:21 +0200)]
ip: display netrom link type

For a NETROM "ip link show dev nr0" will show

4: nr0: <NOARP,UP,LOWER_UP> mtu 236 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/generic 88:98:6a:a4:84:40:0a brd 00:00:00:00:00:00:00

But rather link/netrom is expected to be displayed.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoip: support for xfrm interfaces
Matt Ellison [Thu, 4 Apr 2019 14:08:45 +0000 (10:08 -0400)]
ip: support for xfrm interfaces

Interfaces take a 'if_id' which is an interface id which can be set on
an xfrm policy as its interface lookup key (XFRMA_IF_ID).

Signed-off-by: Matt Ellison <matt@arroyo.io>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agoq_cake: Add support for setting the fwmark option
Toke Høiland-Jørgensen [Thu, 4 Apr 2019 13:09:10 +0000 (15:09 +0200)]
q_cake: Add support for setting the fwmark option

This adds support for the newly added fwmark option to CAKE, which allows
overriding the tin selection from the per-packet firewall marks. The fwmark
field is a bitmask that is applied to the fwmark to select the tin.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>