Commit Graph

917 Commits

Author SHA1 Message Date
Stephen Hemminger
738aebe52b 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>
2018-12-13 12:50:01 -08:00
Stephen Hemminger
3a1f602ade 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>
2018-12-13 11:36:59 -08:00
Stephen Hemminger
028766aed2 uapi: update bpf header
Changes from 4.20-rc6

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-12-10 09:22:23 -08:00
Shalom Toledo
a463fd4fa4 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>
2018-12-07 13:00:40 -08:00
Stephen Hemminger
ce5071eda6 drop support for IPX
IPX has been depracted then removed from upstream kernels.
Drop support from ip route as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-11-24 07:27:56 -08:00
Jakub Kicinski
b640e85d2d json: add %hhu helpers
Add helpers for printing char-size values.

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>
2018-11-24 07:09:53 -08:00
David Ahern
0868c8ab07 Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-11-24 07:06:11 -08:00
David Ahern
8d42678dfb Update kernel headers
Update kernel headers to
  b1a200484143 ("net-next/hinic: fix a bug in rx data flow")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-11-20 14:33:09 -08:00
Stephen Hemminger
babc56b68c tc: drop unused name_to_id function
Not used in current code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-19 11:42:44 -08:00
Stephen Hemminger
1d2fac4145 libnetlnk: unused and local functions cleanup
rntl_talk_extack and parse_rtattr_index not used in current code.
rtnl_dump_filter_l is only used in this file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-19 11:42:44 -08:00
Stephen Hemminger
cc5b7e37ac lib/ll_map: make local function static
ll_idx_a2n is only used in ll_map.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-19 11:42:44 -08:00
Stephen Hemminger
f7bf88dfd5 lib/color: make local functions static
color_enable etc, only used here.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-19 11:42:44 -08:00
Stephen Hemminger
b8795a3208 lib/utils: make local functions static
Some of the print/parsing is only used internally.
Drop unused get_s8/get_s16.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-19 11:42:44 -08:00
Stefano Brivio
64dbd03ea1 iplink_geneve: Add DF configuration
Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

v2:
- Indicate in the man page what DF refers to, using RFC 791 wording
  (David Ahern)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-11-09 08:51:47 -08:00
Stefano Brivio
3d98eba4fe iplink_vxlan: Add DF configuration
Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

v2:
- Indicate in the man page what DF refers to, using RFC 791 wording
  (David Ahern)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-11-09 08:51:12 -08:00
Stephen Hemminger
9abb69f8a0 uapi: sctp header change
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-09 08:18:26 -08:00
Luca Boccassi
6d2fd4a53f Include bsd/string.h only in include/utils.h
This is simpler and cleaner, and avoids having to include the header
from every file where the functions are used. The prototypes of the
internal implementation are in this header, so utils.h will have to be
included anyway for those.

Fixes: 508f3c231e ("Use libbsd for strlcpy if available")

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-05 08:38:32 -08:00
Stephen Hemminger
39776a8665 uapi: update headers to 4.20-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-05 08:37:41 -08:00
Peter Korsgaard
f900a21611 utils.h: provide fallback CLOCK_TAI definition
q_{etf,taprio}.c uses CLOCK_TAI, which isn't exposed by glibc < 2.21 or
uClibc, breaking the build. Provide a fallback definition like it is done
for IPPROTO_MPLS and others.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-29 09:54:52 -07:00
David Ahern
6e221408e6 Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-23 10:55:09 -07:00
Stephen Hemminger
2808241af5 v4.19.0 2018-10-23 10:14:57 -07:00
David Ahern
cd554f2c2f Tree wide: Drop sockaddr_nl arg
No function, filter, or print function uses the sockaddr_nl arg,
so just drop it.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-22 09:43:48 -07:00
David Ahern
9d16a1de1f Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-22 09:43:33 -07:00
Lorenzo Bianconi
9e030e77f2 uapi: add snmp header file
Introduce snmp header file. It will be used in subsequent patch in
order to parse device statistics reported in
IFLA_INET6_STATS/IFLA_INET6_ICMP6STATS netlink attributes

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-15 09:37:42 -07:00
Sabrina Dubroca
45ec4771d4 json: make 0xhex handle u64
Stephen converted macsec's sci to use 0xhex, but 0xhex handles
unsigned int's, not 64 bits ints. Thus, the output of the "ip macsec
show" command is mangled, with half of the SCI replaced with 0s:

# ip macsec show
11: macsec0: [...]
    cipher suite: GCM-AES-128, using ICV length 16
    TXSC: 0000000001560001 on SA 0

# ip -d link show macsec0
11: macsec0@ens3: [...]
    link/ether 52:54:00:12:01:56 brd ff:ff:ff:ff:ff:ff promiscuity 0
    macsec sci 5254001201560001 [...]

where TXSC and sci should match.

Fixes: c0b904de62 ("macsec: support JSON")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-15 09:32:18 -07:00
Jesus Sanchez-Palencia
d791f3ad86 libnetlink: Add helper for getting a __s32 from netlink msgs
This function retrieves a signed 32-bit integer from a netlink message
and returns it.

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-07 10:31:35 -07:00
Vinicius Costa Gomes
de63cd9044 include: Add helper to retrieve a __s64 from a netlink msg
This allows signed 64-bit integers to be retrieved from a netlink
message.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-07 10:30:30 -07:00
Vinicius Costa Gomes
a066bac8a2 utils: Implement get_s64()
Add this helper to read signed 64-bit integers from a string.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-07 10:30:28 -07:00
David Ahern
720a44a751 Update kernel headers
update kernel headers to commit:
72438f8cef4e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-07 10:29:25 -07:00
David Ahern
56eeeda978 libnetlink: Rename rtnl_wilddump_stats_req_filter to rtnl_statsdump_req_filter
rtnl_wilddump_stats_req_filter only takes RTM_GETSTATS as the type argument
so rename to rtnl_statsdump_req_filter for consistency with other request
functions and hardcode the type argument.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:39:36 -07:00
David Ahern
31ae2912f7 libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_*
Rename rtnl_wilddump_req_filter to rtnl_linkdump_req_filter,
rtnl_wilddump_request to rtnl_linkdump_req and
rtnl_wilddump_req_filter_fn to rtnl_linkdump_req_filter_fn.

In all cases drop the type argument which at this point is only
RTM_GETLINK and hardcode in the functions.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:39:08 -07:00
David Ahern
efb0b383d9 libnetlink: Convert GETNSID dumps to use rtnl_nsiddump_req
Add rtnl_nsiddump_req for namespace id dumps using the proper rtgenmsg
as the header. Convert existing RTM_GETNSID dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:39:04 -07:00
David Ahern
ff41db8a75 libnetlink: Convert GETNEIGHTBL dumps to use rtnl_neightbldump_req
Add rtnl_neightbldump_req for neighbor table dumps using the proper ndtmsg
as the header. Convert existing RTM_GETNEIGHTBL dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:39:02 -07:00
David Ahern
9e0ab19c4d libnetlink: Convert GETNEIGH dumps to use rtnl_neighdump_req
Add rtnl_neighdump_req for neighbor dumps using the proper ndmsg
as the header. Convert existing rtnl_wilddump_request for RTM_GETNEIGH
to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:59 -07:00
David Ahern
b05d9a3d58 libnetlink: Convert GETRULE dumps to use rtnl_ruledump_req
Add rtnl_ruledump_req for fib fule dumps using the proper fib_rule_hdr
as the header. Convert existing RTM_GETRULE dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:56 -07:00
David Ahern
ddee16bc96 libnetlink: Convert GETNETCONF dumps to use rtnl_netconfdump_req
Add rtnl_netconfdump_req for netconf dumps using the proper netconfmsg
as the header. Convert existing RTM_GETNETCONF dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:34 -07:00
David Ahern
9dbe6df411 libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
Add rtnl_mdbdump_req for mdb dumps using the proper br_port_msg as
the header. Convert existing RTM_GETMDB dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:31 -07:00
David Ahern
393600231a libnetlink: Convert GETADDRLABEL dumps to use rtnl_addrlbldump_req
Add rtnl_addrlbldump_req for address label dumps using the proper
ifaddrlblmsg as the header. Convert existing RTM_GETADDRALBEL dumps
to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:29 -07:00
David Ahern
bfb27dfaac libnetlink: Convert GETROUTE dumps to use rtnl_routedump_req
Add rtnl_routedump_req for route dumps using the proper rtmsg
as the header. Convert existing RTM_GETROUTE dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:27 -07:00
David Ahern
46917d0895 libnetlink: Convert GETADDR dumps to use rtnl_addrdump_req
Add rtnl_addrdump_req for address dumps using the proper ifaddrmsg
as the header. Convert existing RTM_GETADDR dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-10-02 18:38:21 -07:00
David Ahern
d9c0be4e97 Update kernel headers
Update kernel headers to commit
a804e5e218754 ("selftests: forwarding: test for bridge sticky flag")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-09-28 10:51:15 -07:00
David Ahern
34212c73b7 Merge branch 'iproute2-master' into iproute2-next
Conflicts:
	ip/iproute_lwtunnel.c

In addition to merge conflict between bd59e5b151 and 94a8722f2f,
updated the code added by the latter commit based on the change of the
former (ie., added ret = to the new rta_addattr_l).

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-09-20 17:53:27 -07:00
Stephen Hemminger
b85076cd74 lib: introduce print_nl
Common pattern in iproute commands is to print a line seperator
in non-json mode. Make that a simple function.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-09-11 08:29:33 -07:00
Stephen Hemminger
ae775666cf genl: remove unnecessary extern
extern not necessary on function prototype.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-09-10 11:53:07 -07:00
Dave Taht
abf70ef494 tc: support conversions to or from 64 bit nanosecond-based time
Using a 32 bit field to represent time in nanoseconds results in a
maximum value of about 4.3 seconds, which is well below many observed
delays in WiFi and LTE, and barely in the ballpark for a trip past the
Earth's moon, Luna.

Using 64 bit time fields in nanoseconds allows us to simulate
network diameters of several hundred light-years. However, only
conversions to and from ns, us, ms, and seconds are provided.

The iproute2 64 bit api uses signed values for time. Being able to
represent positive or negative time allows us to calculate +/- deltas
between, for example, the CLOCK_TAI and CLOCK_REALTIME clocks.

Time related utility functions in tc_util.c are moved to lib/utils.c.

Signed-off-by: Yousuk Seung <ysseung@google.com>
Signed-off-by: Dave Taht <dave.taht@gmail.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-08-30 11:04:38 -07:00
Mahesh Bandewar
5d5586b058 iproute: make clang happy
These are primarily fixes for "string is not string literal" warnings
/ errors (with -Werror -Wformat-nonliteral). This should be a no-op
change. I had to replace couple of print helper functions with the
code they call as it was becoming harder to eliminate these warnings,
however these helpers were used only at couple of places, so no
major change as such.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-08-30 07:58:09 -07:00
Stephen Hemminger
0ebb420929 uapi: update bpf headers
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-08-30 07:55:49 -07:00
Phil Sutter
515a766cd2 lib: Make check_enable_color() return boolean
As suggested, turn return code into true/false although it's not checked
anywhere yet.

Fixes: 4d82962ccc ("Merge common code for conditionally colored output")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-08-20 08:55:16 -07:00
Phil Sutter
ff1ab8edf8 Make colored output configurable
Allow for -color={never,auto,always} to have colored output disabled,
enabled only if stdout is a terminal or enabled regardless of stdout
state.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-08-20 08:54:06 -07:00
David Ahern
ea9f9b910e Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-08-15 09:56:30 -07:00
Phil Sutter
4d82962ccc Merge common code for conditionally colored output
Instead of calling enable_color() conditionally with identical check in
three places, introduce check_enable_color() which does it in one place.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-08-15 09:55:27 -07:00
Stephen Hemminger
31ad498a01 v4.18.0 2018-08-13 12:11:32 -07:00
David Ahern
74eb09ad56 Update kernel headers
Update kernel headers to commit
78cbac647e61 (Merge branch 'ip-faster-in-order-IP-fragments'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-08-12 14:23:31 -07:00
David Ahern
8b099da560 Update kernel headers
Update kernel headers to commit
aea5f654e6b7 ("net/sched: add skbprio scheduler")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-25 09:58:00 -07:00
Stephen Hemminger
7c16a8da6b uapi: fix tcp.h repair
Upstream define for TCP_REPAIR changed.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-07-23 13:47:22 -07:00
David Ahern
204db84eb8 Update kernel headers
Update kernel headers to
a3eed83a1895 ("Merge branch 'qed-Add-support-for-phy-module-query'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-20 08:57:23 -07:00
Daniel Borkmann
f823f36012 bpf: implement btf handling and map annotation
Implement loading of .BTF section from object file and build up
internal table for retrieving key/value id related to maps in
the BPF program. Latter is done by setting up struct btf_type
table.

One of the issues is that there's a disconnect between the data
types used in the map and struct bpf_elf_map, meaning the underlying
types are unknown from the map description. One way to overcome
this is to add a annotation such that the loader will recognize
the relation to both. BPF_ANNOTATE_KV_PAIR(map_foo, struct key,
struct val); has been added to the API that programs can use.

The loader will then pick the corresponding key/value type ids and
attach it to the maps for creation. This can later on be dumped via
bpftool for introspection.

Example with test_xdp_noinline.o from kernel selftests:

  [...]

  struct ctl_value {
        union {
                __u64 value;
                __u32 ifindex;
                __u8 mac[6];
        };
  };

  struct bpf_map_def __attribute__ ((section("maps"), used)) ctl_array = {
        .type		= BPF_MAP_TYPE_ARRAY,
        .key_size	= sizeof(__u32),
        .value_size	= sizeof(struct ctl_value),
        .max_entries	= 16,
        .map_flags	= 0,
  };
  BPF_ANNOTATE_KV_PAIR(ctl_array, __u32, struct ctl_value);

  [...]

Above could also further be wrapped in a macro. Compiling through LLVM and
converting to BTF:

  # llc --version
  LLVM (http://llvm.org/):
    LLVM version 7.0.0svn
    Optimized build.
    Default target: x86_64-unknown-linux-gnu
    Host CPU: skylake

    Registered Targets:
      bpf    - BPF (host endian)
      bpfeb  - BPF (big endian)
      bpfel  - BPF (little endian)
  [...]

  # clang [...] -O2 -target bpf -g -emit-llvm -c test_xdp_noinline.c -o - |
    llc -march=bpf -mcpu=probe -mattr=dwarfris -filetype=obj -o test_xdp_noinline.o
  # pahole -J test_xdp_noinline.o

Checking pahole dump of BPF object file:

  # file test_xdp_noinline.o
  test_xdp_noinline.o: ELF 64-bit LSB relocatable, *unknown arch 0xf7* version 1 (SYSV), with debug_info, not stripped
  # pahole test_xdp_noinline.o
  [...]
  struct ctl_value {
	union {
		__u64              value;                /*     0     8 */
		__u32              ifindex;              /*     0     4 */
		__u8               mac[0];               /*     0     0 */
	};                                               /*     0     8 */

	/* size: 8, cachelines: 1, members: 1 */
	/* last cacheline: 8 bytes */
  };

Now loading into kernel and dumping the map via bpftool:

  # ip -force link set dev lo xdp obj test_xdp_noinline.o sec xdp-test
  # ip a
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 xdpgeneric/id:227 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
      inet6 ::1/128 scope host
         valid_lft forever preferred_lft forever
  [...]
  # bpftool prog show id 227
  227: xdp  tag a85e060c275c5616  gpl
      loaded_at 2018-07-17T14:41:29+0000  uid 0
      xlated 8152B  not jited  memlock 12288B  map_ids 381,385,386,382,384,383
  # bpftool map dump id 386
   [{
        "key": 0,
        "value": {
            "": {
                "value": 0,
                "ifindex": 0,
                "mac": []
            }
        }
    },{
        "key": 1,
        "value": {
            "": {
                "value": 0,
                "ifindex": 0,
                "mac": []
            }
        }
    },{
  [...]

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-17 19:38:44 -07:00
David Ahern
5081979176 Import btf.h from kernel headers
Import btf.h from kernel headers at commit
    2aa4a3378ad0 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")
which is the last sync point.

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-17 19:37:50 -07:00
David Ahern
3eebc1d4f4 Update kernel headers
Update kernel headers to commit
2aa4a3378ad0 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-15 13:02:51 -07:00
Stephen Hemminger
dc3ef235f3 uapi: update bpf.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-07-07 09:56:27 -07:00
David Ahern
22ddbd8204 Update kernel headers
Update kernel headers to commit
ab8565af68001 ("Merge branch 'IP-listification-follow-ups'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-07-06 08:42:22 -07:00
Stephen Hemminger
776f1813b5 uapi: update headers from linux-net
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-06-08 10:27:13 -07:00
Stephen Hemminger
17678d3059 Merge ../iproute2-next 2018-06-08 10:27:04 -07:00
Stephen Hemminger
2d3dd6f6c1 v4.17.0 2018-06-08 10:11:50 -07:00
Stephen Hemminger
4be85d574e uapi: update bpf.h to include padding
Last minute upstream 4.17 change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-06-08 10:09:21 -07:00
David Ahern
45c0dd7286 Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-06-01 08:17:23 -07:00
David Ahern
57ac202c78 Update kernel headers
Update kernel headers to commit
ae40832e53c3 ("bpfilter: fix a build err")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-05-30 08:06:19 -07:00
Pavel Maltsev
e2f5ceccda Allow to configure /var/run/netns directory
Currently NETNS_RUN_DIR is hardcoded and refers to /var/run/netns.
However, some systems (e.g. Android) doesn't have /var
which results in error attempts to create network namespaces on these
systems.  This change makes NETNS_RUN_DIR configurable at build time
by allowing to pass environment variable to make command.
Also, this change makes /etc/netns directory configurable through
NETNS_ETC_DIR environment variable.

For example: ./configure && NETNS_RUN_DIR=/mnt/vendor/netns make

Tested: verified that iproute2 with configuration mentioned above
creates namespaces in /mnt/vendor/netns

Signed-off-by: Pavel Maltsev <pavelm@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-05-23 15:16:53 -07:00
David Ahern
c2a569e63c Update kernel headers
Update kernel headers to commit
e89e59c08d1b ("Merge branch 'net-sfp-small-improvements'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-05-23 12:58:34 -07:00
David Ahern
4276e65290 Update kernel headers
Update kernel headers to commit
64a2658b58ab ("net: mscc: Add SPDX identifier")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-05-18 09:05:07 -07:00
David Ahern
fd95ec0e8e Update kernel headers
Update kernel headers to commit 53a7bdfb2a27
("dt-bindings: dsa: Remove unnecessary #address/#size-cells")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-05-09 20:52:52 -07:00
David Ahern
7732148d1d Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-05-05 11:07:47 -07:00
Toke Høiland-Jørgensen
4db2ff0db4 json_print: Fix hidden 64-bit type promotion
print_uint() will silently promote its variable type to uint64_t, but there
is nothing that ensures that the format string specifier passed along with
it fits (and the function name suggest to pass "%u").

Fix this by changing print_uint() to use a native 'unsigned int' type, and
introduce a separate print_u64() function for printing 64-bit values. All
call sites that were actually printing 64-bit values using print_uint() are
converted to use print_u64() instead.

Since print_int() was already using native int types, just add a
print_s64() to match, but don't convert any call sites. For symmetry,
also add a print_luint() method (with no users).

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-25 11:08:55 -07:00
David Ahern
075bf62a70 Update kernel headers
Update kernel headers to commit 292eba02dbb4
("net-next/hinic: add arm64 support")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-04-19 11:10:27 -07:00
Stephen Hemminger
811ee8943c uapi/sctp: update header from 4.17-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-10 10:50:00 -07:00
Stephen Hemminger
b7d3a4f009 uapi/tipc: update header from 4.17-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-10 10:49:41 -07:00
Stephen Hemminger
dcf7997bcd uapi/bpf: update kernel header from 4.17-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-10 10:48:56 -07:00
David Ahern
2c62a64d60 Merge branch 'iproute2-master' into iproute2-next
Conflicts:
	bridge/mdb.c
	misc/ss.c
	tc/tc.c

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-04-02 10:47:34 -07:00
Stephen Hemminger
4b6c4177ee v4.16.0 2018-04-02 10:06:08 -07:00
Stephen Hemminger
200e9d1961 uapi/if_ether: add definition of ether type field
Part of upstream commit
4bbb3e0e8239 ("net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-02 09:19:08 -07:00
Steve Wise
8958a15c04 rdma: Add MR resource tracking information
Sample output:

Without CAP_NET_ADMIN:

$ rdma resource show mr mrlen 65536
dev mlx4_0 mrlen 65536 pid 0 comm [nvme_rdma]
dev cxgb4_0 mrlen 65536 pid 0 comm [nvme_rdma]

With CAP_NET_ADMIN:

# rdma resource show mr mrlen 65536
dev mlx4_0 rkey 0x12702 lkey 0x12702 iova 0x85724a000 mrlen 65536 pid 0 comm [nvme_rdma]
dev cxgb4_0 rkey 0x68fe4e9 lkey 0x68fe4e9 iova 0x835b91000 mrlen 65536 pid 0 comm [nvme_rdma]

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-04-01 08:18:56 -07:00
David Ahern
9effc146b7 Update kernel headers
Update kernel headers to commit 5d22d47b9ed9
("Merge branch 'sfc-filter-locking'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-28 20:26:25 -07:00
David Ahern
54eae5f76d Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-27 12:33:02 -07:00
Luca Boccassi
ba2fc55b99 Drop capabilities if not running ip exec vrf with libcap
ip vrf exec requires root or CAP_NET_ADMIN, CAP_SYS_ADMIN and
CAP_DAC_OVERRIDE. It is not possible to run unprivileged commands like
ping as non-root or non-cap-enabled due to this requirement.
To allow users and administrators to safely add the required
capabilities to the binary, drop all capabilities on start if not
invoked with "vrf exec".
Update the manpage with the requirements.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-03-27 11:48:23 -07:00
Leon Romanovsky
2c6962cfaf rdma: Move RDMA UAPI header file to be under RDMA responsibility
In iproute2 package, the updates of UAPIs files are performed
after the needed feature lands in kernel's net-next tree.

Such development flow created delays to the rdma tool developers,
who uses rdma-next tree as a basis for their work.

Move RDMA UAPI file to be under rdma/ folder, so whole responsibility
of syncing this file will be on them.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-26 07:02:19 -07:00
David Ahern
4de0a06b34 Update kernel headers
Update kernel headers to commit a870a02cc963
("pktgen: use dynamic allocation for debug print buffer")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-13 17:59:59 -07:00
David Ahern
e9625d6aea Merge branch 'iproute2-master' into iproute2-next
Conflicts:
	bridge/mdb.c

Updated bridge/bridge.c per removal of check_if_color_enabled by commit
1ca4341d2c ("color: disable color when json output is requested")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-13 17:48:10 -07:00
Serhey Popovych
fe99adbca4 utils: Introduce and use nodev() helper routine
There is a couple of places where we report error in case of no network
device is found. In all of them we output message in the same format to
stderr and either return -1 or 1 to the caller or exit with -1.

Introduce new helper function nodev() that takes name of the network
device caused error and returns -1 to it's caller. Either call exit()
or return to the caller to preserve behaviour before change.

Use -nodev() in traffic control (tc) code to return 1.

Simplify expression for checking for argument being 0/NULL in @if
statement.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
2018-03-11 17:58:36 -07:00
David Ahern
8c278ecad0 Update kernel headers to 4.16.0-rc4+
Update kernel headers to commit 08a24239cd46
("Merge branch 'hns3-next'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-03-08 09:34:05 -08:00
Stephen Hemminger
d9d8c8393e json_writer: add SPDX Identifier (GPL-2/BSD-2)
I wrote this code so put SPDX License on it and intentionally
allow use in BSD code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-03-06 14:39:19 -08:00
David Ahern
cb4ade6e38 Import tc_em_ipt.h from kernel at commit 08009a760213
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-27 09:42:23 -08:00
David Ahern
02ffee14ae Update kernel headers to 08009a760213
Update kernel headers to commit 08009a760213
("net: make kmem caches as __ro_after_init")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-26 13:24:38 -08:00
Arkadi Sharshevsky
8cd6440958 devlink: Add support for devlink resource abstraction
Add support for devlink resource abstraction. The resources are
represented by a tree based structure and are identified by a name and
a size. Some resources can present their real time occupancy.

First the resources exposed by the driver can be observed, for example:

$devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
  name kvd size 245760 unit entry
    resources:
      name linear size 98304 occ 0 unit entry size_min 0 size_max 147456 size_gran 128
      name hash_double size 60416 unit entry size_min 32768 size_max 180224 size_gran 128
      name hash_single size 87040 unit entry size_min 65536 size_max 212992 size_gran 128

Some resource's size can be changed. Examples:

$devlink resource set pci/0000:03:00.0 path /kvd/hash_single size 73088
$devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 74368

The changes do not apply immediately, this can be validate by the 'size_new'
attribute, which represents the pending changed size. For example

$devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
  name kvd size 245760 unit entry size_valid false
  resources:
    name linear size 98304 size_new 147456 occ 0 unit entry size_min 0 size_max 147456 size_gran 128
    name hash_double size 60416 unit entry size_min 32768 size_max 180224 size_gran 128
    name hash_single size 87040 unit entry size_min 65536 size_max 212992 size_gran 128

In case of a pending change the nested resources present an indication
for a valid configuration of its children (sum of its children sizes
doesn't exceed the parent's size).

In order for the changes to take place hot reload is needed. The hot
reload through devlink will be introduced in the following patch.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-23 08:36:05 -08:00
Arkadi Sharshevsky
049c58539f devlink: mnlg: Add support for extended ack
Add support for extended ack.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-23 08:36:05 -08:00
Vincent Bernat
1ca4341d2c color: disable color when json output is requested
Instead of declaring -color and -json exclusive, ignore -color when
-json is provided. The rationale is to allow to put -color in an alias
for ip while still being able to use -json. -color is merely a
presentation suggestion and we can assume there is nothing to color in
the JSON output.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-23 08:18:33 -08:00
Stephen Hemminger
4328b687b4 ip: always print interface name in color
Even in brief mode the interface name should be printed
in color if desired. This makes output consistent across
regular and brief mode.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-21 08:42:04 -08:00
Stephen Hemminger
a8beadb5f6 uapi: update if_ether compat headers
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-20 10:48:32 -08:00
David Ahern
07ed8df604 Update kernel headers to 4.16.0-rc2+
Update kernel headers to commit f5c0c6f4299f
("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-19 20:06:04 -08:00
Serhey Popovych
f5b50a18ae utils: Introduce and use print_name_and_link() to print name@link
There is at least three places implementing same things: two in
ipaddress.c print_linkinfo() & print_linkinfo_brief() and one in
bridge/link.c.

They are diverge from each other very little: bridge/link.c does not
support JSON output at the moment and print_linkinfo_brief() does not
handle IFLA_LINK_NETNS case.

Introduce and use print_name_and_link() routine to handle name@link
output in all possible variations; respect IFLA_LINK_NETNS attribute to
handle case when link is in different namespace; use ll_idx_n2a() for
interface name instead of "<nil>" to share logic with other code (e.g.
ll_name_to_index() and ll_index_to_name()) supporting such template.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-16 08:14:22 -08:00
Serhey Popovych
fcac966526 utils: Introduce and use get_ifname_rta()
Be consistent in handling of IFLA_IFNAME attribute in all places: if
there is no attribute report bug to stderr and use ll_idx_n2a() as
last measure to get name in "if%u" format instead of "<nil>".

Use check_ifname() to validate network device name: this catches both
unexpected return from kernel and ll_idx_n2a().

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-16 08:14:20 -08:00
Serhey Popovych
fe269b6e7c utils: Reimplement ll_idx_n2a() and introduce ll_idx_a2n()
Now all users of ll_idx_n2a() replaced with ll_index_to_name() we can
move it's functionality to ll_index_to_name() and implement index to
name conversion using snprintf() and "if%u".

Use %u specifier in "if%..." template consistently: network device
indexes are always greather than zero.

Also introduce ll_idx_n2a() conterpart: ll_idx_a2n() that is used
to translate name of the "if%u" form to index using sscanf().

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-16 08:14:13 -08:00
Serhey Popovych
5433656705 ip: Use single variable to represent -pretty
After commit a233caa0aa ("json: make pretty printing optional") I get
following build failure:

    LINK     rtmon
    ../lib/libutil.a(json_print.o): In function `new_json_obj':
    json_print.c:(.text+0x35): undefined reference to `show_pretty'
    collect2: error: ld returned 1 exit status
    make[1]: *** [rtmon] Error 1
    make: *** [all] Error 2

It is caused by missing show_pretty variable in rtmon.

On the other hand tc/tc.c there are two distinct variables and single
matches() call that handles -pretty option thus setting show_pretty
will never happen. Note that since commit 44dcfe8201 ("Change
formatting of u32 back to default") show_pretty is used in tc/f_u32.c
so this is first place where -pretty introduced.

Furthermore other utilities like misc/ifstat.c and misc/nstat.c define
pretty variable, however only for their own purposes. They both support
JSON output and thus depend show_pretty in new_json_obj().

Assuming above use common variable to represent -pretty option, define
it in utils.c and declare in utils.h that is commonly used. Replace
show_pretty with pretty.

Fixes: a233caa0aa ("json: make pretty printing optional")
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-16 08:13:36 -08:00
Serhey Popovych
9cc173d485 utils: Introduce and use inet_prefix_reset()
Initializing @inet_prefix using C initializers or memset() seems
inefficient and unnecessary: only small part of ->data[] field will be
used to store address corresponding to ->family.

Instead initialize ->flags with zero and assume no other fields accessed
before checking corresponding bits in ->flags. For example special
helpers (e.g. is_addrtype_*()) can be used to ensure that @inet_prefix
contains valid ip or ipv6 address.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-14 09:00:26 -08:00
Stephen Hemminger
766fa4ac33 include: update rdma header from 4.16-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-13 16:42:00 -08:00
Stephen Hemminger
663c3cb231 iproute: implement JSON and color output
Add JSON and color output formatting to ip route command.
Similar to existing address and link output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-10 08:20:39 -08:00
Stephen Hemminger
a233caa0aa json: make pretty printing optional
Since JSON is intended for programmatic consumption, it makes
sense for the default output format to be concise as possible.

For programmer and other uses, it is helpful to keep the pretty
whitespace format; therefore enable it with -p flag.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-10 08:15:08 -08:00
Serhey Popovych
9a7bd5442b ip: Introduce get_rtnl_link_stats_rta() to get link statistics
Assume all statistics in ip(8) represented either by IFLA_STATS64 or
IFLA_STATS is 64 bit. It is clean that we can store __u32 counters of
@struct rtnl_link_stats in __u64 counters in @struct rtnl_link_stats64.

New get_rtnl_link_stats_rta() follows __print_link_stats() behaviour on
handling of stats attribute: copy no more than size of data structure
and no less than attribute length zeroing rest.

Drop print_link_stats32() as it's functionality can be handled by 64bit
variant. Move code from __print_link_stats() to print_link_stats64() and
finally rename print_link_stats64() to __print_link_stats().

More users of introduced function will come in future.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-07 16:15:28 -08:00
Stephen Hemminger
c30c7b6e35 include: update UAPI types.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-05 17:21:27 -08:00
Stephen Hemminger
25226777b8 include: update interface UAPI from 4.15-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-05 17:21:01 -08:00
Stephen Hemminger
a0fc63ed68 include: update rdma uapi from 4.15-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-05 17:20:14 -08:00
Stephen Hemminger
d707207f4d include: update netfilter headers from 4.15-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-05 17:19:32 -08:00
Stephen Hemminger
d857a7fd4b include: update uapi with BPF from 4.15-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-05 17:18:53 -08:00
Serhey Popovych
f7af0dc580 ip: Consolidate ip, xdp and lwtunnel parse/dump prototypes in ip_common.h
Having iplink_parse() and @struct iplink_req in include/utils.h does not
reflect it's IP nature: move to ip/ip_common.h.

Move contents of ip/iplink_xdp.h and ip/iproute_lwtunnel.h to
ip/ip_common.h since they are small (i.e. only two function prototypes):
ip/iplink_bridge.c and ip/iplink_vrf.c prototypes already there.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-02-02 14:55:12 -08:00
David Ahern
1e24e773f1 Merge branch 'iproute2-master' into iproute2-next
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-29 08:24:57 -08:00
Stephen Hemminger
50b8a842e8 v4.15.0 2018-01-29 08:08:52 -08:00
Jakub Kicinski
097415d510 tc: red: JSON-ify RED output
Make JSON output work with RED Qdiscs.  Float/double printing
helpers have to be added/uncommented to print the probability.
Since TC stats in general are not split out to a separate object
the xstats printed by this patch are not separated either.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-26 12:59:55 -08:00
Serhey Popovych
27c523e209 utils: Introduce get_addr_rta() and inet_addr_match_rta()
First is used to get address from netlink attribute to
inet_prefix data structure. Use memcpy() with constant
value to let complier optimize by replacing a call by
inlining load/store instructions.

Second is used to match address in given netlink attribute
with one given as reference. It matches successfully if
no attribute is given (@rta is NULL), reference address
family is AF_UNSPEC or it's length isn't given; fails if
get_attr_rta() can't get attribute or it's family does
not match reference; calls inet_addr_match() to get final
verdict.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-25 09:31:16 -08:00
Serhey Popovych
6caad8f505 ip: Get rid of inet_get_addr()
Both geneve and vxlan modules are converted to
use get_addr() we can replace inet_get_addr()
in less problematic places and finally get
rid of inet_get_addr().

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-21 09:38:26 -08:00
Serhey Popovych
7bf5e876d0 utils: Fast inet address classification after get_addr()
It looks very useful to receive additional information
from get_addr_1() and get_addr() about address to simplify
caller and get rid of code duplications.

For now following information can be returned:

  1) address is unspecified (zero)
  2) address is multicast
  3) address is internet: family is either AF_INET or
     AF_INET6.

More information can be added in the future.

Introduce inline helpers to make code using this new
address classification interface more self explaining:

  bool is_addrtype_inet(inet_prefix *addr)
    true if @addr is inet address

  bool is_addrtype_inet_unspec(inet_prefix *addr)
    true if @addr is unspecified inet address

  bool is_addrtype_inet_multi(inet_prefix *addr)
    true if @addr is multicast inet address

  bool is_addrtype_inet_not_unspec(inet_prefix *addr)
    true if @addr is not unspecified inet address
    false if @addr is not inet or unspecified inet

  bool is_addrtype_inet_not_multi(inet_prefix *addr)
    true if @addr is not multicast inet address
    false if @addr is not inet or multicast inet

Last two are useful for case when we need inet address
that is not unspecified or multicast.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-21 09:38:21 -08:00
David Ahern
c0788a09d4 Update kernel headers to 4.15-rc8
Update kernel headers to commit 30c3e9d47035
("l2tp: remove switch block in l2tp_nl_cmd_session_create()")

Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-19 12:33:41 -08:00
Chris Mi
72a2ff3916 lib/libnetlink: Add a new function rtnl_talk_iov
rtnl_talk can only send a single message to kernel. Add a new function
rtnl_talk_iov that can send multiple messages to kernel.
rtnl_talk_iov takes struct iovec * and iovlen as arguments.

Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2018-01-14 09:03:33 -08:00
Stephen Hemminger
a366508913 include: update ethernet headers
Incorporate upstream changes to fix compliation with MUSL.
See commit 6926e041a892
 ("uapi/if_ether.h: prevent redefinition of struct ethhdr")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-01-09 08:08:03 -08:00
David Ahern
f82517f80d Update headers from 4.15-rc3
Update kernel headers to commit f39a5c01c3d2 ("Merge branch
'nfp-flower-add-Geneve-tunnel-support'")

Signed-off-by: David Ahern <dsahern@gmail.com>
2017-12-20 15:17:59 -08:00
Stephen Hemminger
2c6aaad949 include: qdisc offload defines
UAPI changes from upstream:
	net: sched: Add TCA_HW_OFFLOAD
	pkt_sched: Remove TC_RED_OFFLOADED from uapi

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-12-16 10:00:43 -08:00
Stephen Hemminger
4b072e9b49 uapi: tun add eBPF based queue selection method
Upstream commit 96f84061620c6325a2ca9a9a05b410e6461d03c3
    tun: add eBPF based queue selection method

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-12-11 16:03:27 -08:00
Stephen Hemminger
b7f5fd3698 uapi: add access to snd_cwnd and other sock_ops
From upstream kernel commit f19397a5c65665d66e3866b42056f1f58b7a366b
    bpf: Add access to snd_cwnd and others in sock_ops

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-12-11 16:01:17 -08:00
Stephen Hemminger
39be47fb5e update headers from 4.15-rc2
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-12-05 17:30:29 -08:00
Jakub Kicinski
65fdae3d18 bpf: allow loading programs for a specific ifindex
For BPF offload we need to specify the ifindex when program is
loaded now.  Extend the bpf common code to accommodate that.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
4a847fcb51 bpf: expose bpf_parse_common() and bpf_load_common()
Expose bpf_parse_common() and bpf_load_common() functions
for those users who may want to modify the parameters to
load after parsing is done.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
399db8392b bpf: rename bpf_parse_common() to bpf_parse_and_load_common()
bpf_parse_common() parses and loads the program.  Rename it
accordingly.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
3f0b9e620c bpf: split parse from program loading
Parsing command line is currently done together with potentially
loading a new eBPF program.  This makes it more difficult to
provide additional parameters for loading (which may come after
the eBPF program info on the command line).

Split the two (only internally for now).  Verbose parameter
has to be saved in struct bpf_cfg_in to be carried between
the stages.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
51be754690 bpf: allocate opcode table in struct bpf_cfg_in
struct bpf_cfg_in already carries a pointer to sock_filter ops.
It's currently set to a local variable in bpf_parse_opt_tbl(),
shared between parsing and loading stages.  Move the array
entirely to struct bpf_cfg_in, this will allow us to split
parsing and loading.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
f20ff2f195 bpf: keep parsed program mode in struct bpf_cfg_in
bpf_parse() will parse command line arguments to find out the
program mode.  This mode will later be needed at loading time.
Instead of keeping it locally add it to struct bpf_cfg_in,
this will allow splitting parsing and loading stages.

enum bpf_mode has to be moved to the header file, because C
doesn't allow forward declaration of enums.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Jakub Kicinski
658cfebc27 bpf: pass program type in struct bpf_cfg_in
Program type is needed both for parsing and loading of
the program.  Parsing may also induce the type based on
signatures from __bpf_prog_meta.  Instead of passing
the type around keep it in struct bpf_cfg_in.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-11-26 11:57:57 -08:00
Stephen Hemminger
6054c1ebf7 SPDX license identifiers
For all files in iproute2 which do not have an obvious license
identification, mark them with SPDK GPL-2

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-24 12:21:35 -08:00
Nishanth Devarajan
927e3cfb52 tc: B.W limits can now be specified in %.
This patch adapts the tc command line interface to allow bandwidth limits
to be specified as a percentage of the interface's capacity.

Adding this functionality requires passing the specified device string to
each class/qdisc which changes the prototype for a couple of functions: the
.parse_qopt and .parse_copt interfaces. The device string is a required
parameter for tc-qdisc and tc-class, and when not specified, the kernel
returns ENODEV. In this patch, if the user tries to specify a bandwidth
percentage without naming the device, we return an error from userspace.

Signed-off-by: Nishanth Devarajan<ndev2021@gmail.com>
2017-11-24 11:22:13 -08:00
Stephen Hemminger
7b8c436c30 update headers from 4.15-rc1
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-24 09:07:42 -08:00
Lorenzo Colitti
05b3b344b2 iproute2: fixes to compile on some systems.
1. Put the declarations of strlcpy and strlcat inside
   an #ifdef NEED_STRLCPY. Their declarations were already in a
   similar #ifdef.
2. In bpf_scm.h, include sys/un.h for struct sockaddr_un.
3. In utils.h, include time.h for struct timeval.

Tested: builds on ubuntu 14.04 with "make clean distclean; ./configure && make -j64"
Tested: 4.14.1 builds on Android with Android-specific #ifndefs for missing library code
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
2017-11-20 10:38:58 -08:00
Stephen Hemminger
a60742aaf4 Merge branch 'master' into net-next 2017-11-13 10:35:17 -08:00
Stephen Hemminger
212b52299e v4.14.1 2017-11-13 10:09:57 -08:00
Stephen Hemminger
9edf7016e8 Merge branch 'master' into net-next 2017-11-12 16:30:14 -08:00
Stephen Hemminger
7d14d00795 v4.14.0 2017-11-12 16:29:43 -08:00
Stephen Hemminger
cd458a7764 update kernel headers from 4.14 net-next
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-12 15:58:11 -08:00
Stephen Hemminger
840d95d348 update kernel headers
To 4.14 final kernel version
Note: SPDX tag added by upstream

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-12 15:55:49 -08:00
Stephen Hemminger
ba914908eb Update kernel headers with new SPDK identifier
The kernel header sanitizisation process now puts SPDK GPLv2
license comment on files.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-07 11:02:41 +09:00
Stephen Hemminger
665ef5a5c0 Update kernel headers from 4.14-rc8 nete-next
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-11-07 11:02:08 +09:00
Stephen Hemminger
fe388b9e0c update kernel headers from 4.14-rc7 net-next 2017-11-01 22:15:50 +01:00
Stephen Hemminger
0ac0017a1a Update kernel headers from net-next (4.14-rc6)
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-10-31 18:04:13 +01:00
Stephen Hemminger
c1606c44b3 Merge branch 'master' into net-next 2017-10-31 18:03:12 +01:00
Stephen Hemminger
e348889289 Update kernel headers based on 4.14-rc7
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-10-31 18:01:51 +01:00