aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* iproute2: fixes to compile on some systems.Lorenzo Colitti2017-11-212-0/+4
| | | | | | | | | | | | | | | 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. [Cherry-pick of upstream 05b3b344b2498d600ca2ad482778b64891fe6bf7] 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> Change-Id: If21f95e2e8d87c7d42f8493d5ae70a12b634d065
* v4.14.1Stephen Hemminger2017-11-131-1/+1
|
* v4.14.0Stephen Hemminger2017-11-121-1/+1
|
* update kernel headersStephen Hemminger2017-11-12110-1/+110
| | | | | | | To 4.14 final kernel version Note: SPDX tag added by upstream Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Update kernel headers based on 4.14-rc7Stephen Hemminger2017-10-312-5/+5
| | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* color: Rename enumPetr Vorel2017-10-162-2/+2
| | | | | | COLOR_NONE is more descriptive than COLOR_CLEAR. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* color: Fix another ip segfault when using --color switchPetr Vorel2017-10-161-1/+0
| | | | | | | | | | | | | Commit 959f1428 ("color: add new COLOR_NONE and disable_color function") introducing color enum COLOR_NONE, which is not only duplicite of COLOR_CLEAR, but also caused segfault, when running ip with --color switch, as 'attr + 8' in color_fprintf() access array item out of bounds. Thus removing it and restoring "magic" offset + 7. Reproduce with: $ ip -c a Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* color: Fix ip segfault when using --color switchPetr Vorel2017-10-161-1/+1
| | | | | | | | | | | | | | | | | | Commit d0e72011 ("ip: ipaddress.c: add support for json output") introduced passing -1 as enum color_attr. This is not only wrong as no color_attr has value -1, but also causes another segfault in color_fprintf() on this setup as there is no item with index -1 in array of enum attr_colors[]. Using COLOR_CLEAR is valid option. Reproduce with: $ COLORFGBG='0;15' ip -c a NOTE: COLORFGBG is environmental variable used for defining whether user has light or dark background. COLORFGBG="0;15" is used to ask for color set suitable for light background, COLORFGBG="15;0" is used to ask for color set suitable for dark background. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* utils: add print_escape_buf to format and print arbitrary bytesIvan Delalande2017-10-111-0/+2
| | | | | | | | | Keep it as simple as possible for now: just escape anything that is not isprint-able, is among the "escape" parameter or '\' as an octal escape sequence. This should be pretty easy to extend if any other user needs something more complex in the future. Signed-off-by: Ivan Delalande <colona@arista.com>
* rdma: move headers to uapiStephen Hemminger2017-10-111-3/+3
| | | | | | And update with version from upstream. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* iproute: build more easily on AndroidLorenzo Colitti2017-10-11110-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iproute2 contains a bunch of kernel headers, including uapi ones. Android's libc uses uapi headers almost directly, and uses a script to fix kernel types that don't match what userspace expects. For example: https://issuetracker.google.com/36987220 reports that our struct ip_mreq_source contains "__be32 imr_multiaddr" rather than "struct in_addr imr_multiaddr". The script addresses this by replacing the uapi struct definition with a #include <bits/ip_mreq.h> which contains the traditional userspace definition. Unfortunately, when we compile iproute2, this definition conflicts with the one in iproute2's linux/in.h. Historically we've just solved this problem by running "git rm" on all the iproute2 include/linux headers that break Android's libc. However, deleting the files in this way makes it harder to keep up with upstream, because every upstream change to an include file causes a merge conflict with the delete. This patch fixes the problem by moving the iproute2 linux headers from include/linux to include/uapi/linux. Tested: compiles on ubuntu trusty (glibc) Signed-off-by: Elliott Hughes <enh@google.com> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
* Check user supplied interface name lengthsPhil Sutter2017-10-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The original problem was that something like: | strncpy(ifr.ifr_name, *argv, IFNAMSIZ); might leave ifr.ifr_name unterminated if length of *argv exceeds IFNAMSIZ. In order to fix this, I thought about replacing all those cases with (equivalent) calls to snprintf() or even introducing strlcpy(). But as Ulrich Drepper correctly pointed out when rejecting the latter from being added to glibc, truncating a string without notifying the user is not to be considered good practice. So let's excercise what he suggested and reject empty, overlong or otherwise invalid interface names right from the start - this way calls to strncpy() like shown above become safe and the user has a chance to reconsider what he was trying to do. Note that this doesn't add calls to check_ifname() to all places where user supplied interface name is parsed. In many cases, the interface must exist already and is therefore looked up using ll_name_to_index(), so if_nametoindex() will perform the necessary checks already. Signed-off-by: Phil Sutter <phil@nwl.cc>
* lib: json_print: rework 'new_json_obj' drop FILE* argumentJulien Fortin2017-09-291-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Stephen Hemminger mentioned on the last submission the new_json_obj function is always called with fp == stdout, so right now, there's no need of this extra argument. The background for the rework is the following: The ip monitor didn't call `new_json_obj` (even for in non json context), so the static FILE* _fp variable wasn't initialized, thus raising a SIGSEGV in ipaddress.c. This patch should fix this issue for good, new paths won't have to call `new_json_obj`. How to reproduce: $ ip -t mon label link (gdb) bt .#0 _IO_vfprintf_internal (s=s@entry=0x0, format=format@entry=0x45460d “%d: “, ap=ap@entry=0x7fffffff7f18) at vfprintf.c:1278 .#1 0x0000000000451310 in color_fprintf (fp=0x0, attr=<optimized out>, fmt=0x45460d “%d: “) at color.c:108 .#2 0x000000000044a856 in print_color_int (t=t@entry=PRINT_ANY, color=color@entry=4294967295, key=key@entry=0x4545fc “ifindex”, fmt=fmt@entry=0x45460d “%d: “, value=<optimized out>) at ip_print.c:132 .#3 0x000000000040ccd2 in print_int (value=<optimized out>, fmt=0x45460d “%d: “, key=0x4545fc “ifindex”, t=PRINT_ANY) at ip_common.h:189 .#4 print_linkinfo (who=<optimized out>, n=0x7fffffffa380, arg=0x7ffff77a82a0 <_IO_2_1_stdout_>) at ipaddress.c:1107 .#5 0x0000000000422e13 in accept_msg (who=0x7fffffff8320, ctrl=0x7fffffff8310, n=0x7fffffffa380, arg=0x7ffff77a82a0 <_IO_2_1_stdout_>) at ipmonitor.c:89 .#6 0x000000000044c58f in rtnl_listen (rtnl=0x672160 <rth>, handler=handler@entry=0x422c70 <accept_msg>, jarg=0x7ffff77a82a0 <_IO_2_1_stdout_>) at libnetlink.c:761 .#7 0x00000000004233db in do_ipmonitor (argc=<optimized out>, argv=0x7fffffffe5a0) at ipmonitor.c:310 .#8 0x0000000000408f74 in do_cmd (argv0=0x7fffffffe7f5 “mon”, argc=3, argv=0x7fffffffe588) at ip.c:116 .#9 0x0000000000408a94 in main (argc=4, argv=0x7fffffffe580) at ip.c:311 Fixes: 6377572f ("ip: ip_print: add new API to print JSON or regular format output") Reported-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
* json: move json printer to common libraryDaniel Borkmann2017-09-221-0/+71
| | | | | | | | | | | Move the json printer which is based on json writer into the iproute2 library, so it can be used by library code and tools other than ip. Should probably have been done from the beginning like that given json writer is in the library already anyway. No functional changes. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Julien Fortin <julien@cumulusnetworks.com>
* BPF: update headers from 4.14-rc1Stephen Hemminger2017-09-201-2/+2
| | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge branch 'net-next'Stephen Hemminger2017-09-0518-199/+621
|\
| * update headers from 4.14 mergeStephen Hemminger2017-09-057-0/+24
| | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * Merge branch 'master' into net-nextStephen Hemminger2017-09-051-1/+1
| |\
| * \ Merge branch 'master' into net-nextStephen Hemminger2017-09-011-0/+3
| |\ \ | | | | | | | | | | | | Needed to add JSON support to tclass.
| * | | update headers from net-nextStephen Hemminger2017-08-303-9/+6
| | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | devlink: header updateStephen Hemminger2017-08-241-0/+13
| | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | add ERSPAN headersStephen Hemminger2017-08-232-0/+2
| | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | Merge branch 'master' into net-nextStephen Hemminger2017-08-212-0/+309
| |\ \ \
| * | | | update kernel headers from net-nextStephen Hemminger2017-08-213-2/+53
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | json_writer: add new json handlers (null, float with format, lluint, hu)Julien Fortin2017-08-171-0/+9
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
| * | | | ip: add new command line argument -json (mutually exclusive with -color)Julien Fortin2017-08-171-0/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
| * | | | color: add new COLOR_NONE and disable_color functionJulien Fortin2017-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
| * | | | include: add pfkeyv2.h drop ipv6.hStephen Hemminger2017-08-152-192/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pfkeyv2.h is include by ipsec. linux/ipv6.h is not included by any code in current tree. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | seg6: add include/linux/seg6_local.hStephen Hemminger2017-08-151-0/+68
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | more BPF headers updateStephen Hemminger2017-08-101-0/+5
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | include: update headers from net-nextStephen Hemminger2017-08-092-5/+12
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | Merge branch 'master' into net-nextStephen Hemminger2017-08-041-0/+6
| |\ \ \ \
| * | | | | update headers from 4.13 net-nextStephen Hemminger2017-08-033-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * | | | | Merge branch 'master' into net-nextStephen Hemminger2017-07-182-0/+4
| |\ \ \ \ \
| * | | | | | update kernel headers from net-nextStephen Hemminger2017-07-173-1/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just as net-next merge window opens. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | | | | | | v4.13.0Stephen Hemminger2017-09-051-1/+1
| |_|_|_|_|/ |/| | | | |
* | | | | | bpf: consolidate dumps to use bpf_dump_prog_infoDaniel Borkmann2017-09-051-1/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consolidate dump of prog info to use bpf_dump_prog_info() when possible. Moving forward, we want to have a consistent output for BPF progs when being dumped. E.g. in cls/act case we used to dump tag as a separate netlink attribute before we had BPF_OBJ_GET_INFO_BY_FD bpf(2) command. Move dumping tag into bpf_dump_prog_info() as well, and only dump the netlink attribute for older kernels. Also, reuse bpf_dump_prog_info() for XDP case, so we can dump tag and whether program was jited, which we currently don't show. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
* | | | | utils: Implement strlcpy() and strlcat()Phil Sutter2017-09-011-0/+3
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | By making use of strncpy(), both implementations are really simple so there is no need to add libbsd as additional dependency. Signed-off-by: Phil Sutter <phil@nwl.cc>
* | | | rdma: Add basic infrastructure for RDMA toolLeon Romanovsky2017-08-211-0/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RDMA devices are cross-functional devices from one side, but very tailored for the specific markets from another. Such diversity caused to spread of RDMA related configuration across various tools, e.g. devlink, ip, ethtool, ib specific and vendor specific solutions. This patch adds ability to fill device and port information by reading RDMA netlink. Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
* | | | utils: Move BIT macro to common headerLeon Romanovsky2017-08-211-0/+2
| |_|/ |/| | | | | | | | | | | | | | | | | | | | BIT() macro was implemented and used by devlink for now, but following patches of rdmatool will reuse the same macro, so put it in common header file. Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
* | | iproute: Add support for extended ack to rtnl_talkStephen Hemminger2017-08-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for extended ack error reporting via libmnl. Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel. If iproute2 is built without libmnl, it will still work but extended error reports from kernel will not be available. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | | update headers from 4.13-rc4Stephen Hemminger2017-08-033-47/+3
| | | | | | | | | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | | Update headers from net-nextStephen Hemminger2017-07-313-3/+47
| |/ |/| | | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | bpf: dump id/jited info for cls/act programsDaniel Borkmann2017-07-181-0/+2
| | | | | | | | | | | | | | | | | | Make use of TCA_BPF_ID/TCA_ACT_BPF_ID that we exposed and print the ID of the programs loaded and use the new BPF_OBJ_GET_INFO_BY_FD command for dumping further information about the program, currently whether the attached program is jited. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
* | bpf: support loading map in map from objDaniel Borkmann2017-07-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for map in map in the loader and add a small example program. The outer map uses inner_id to reference a bpf_elf_map with a given ID as the inner type. Loading maps is done in three passes, i) all non-map in map maps are loaded, ii) all map in map maps are loaded based on the inner_id map spec of a non-map in map with corresponding id, and iii) related inner maps are attached to the map in map with given inner_idx key. Pinned objetcs are assumed to be managed externally, so they are only retrieved from BPF fs. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
* | update headers to 4.13-rc1Stephen Hemminger2017-07-183-1/+90
|/ | | | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge branch 'master' into net-nextStephen Hemminger2017-07-051-1/+1
|\
| * v4.12.0Stephen Hemminger2017-07-051-1/+1
| |
* | Merge branch 'master' into net-nextStephen Hemminger2017-07-051-0/+3
|\|
| * iptunnel: add support for mpls/ip to sit tunnelsKrister Johansen2017-07-051-0/+3
| | | | | | | | | | Original-Author: Simon Horman <simon.horman@netronome.com> Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>