aboutsummaryrefslogtreecommitdiff
path: root/misc
AgeCommit message (Collapse)Author
2021-06-01Enable Async MTE in iproute2.android-12.0.0_r32android-12.0.0_r29android-12.0.0_r28android-12.0.0_r27android-12.0.0_r26android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android-12.0.0_r16android12-qpr1-releaseandroid12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-releaseandroid12-devEvgenii Stepanov
This change enables Async mode ARM MTE in iproute2 utils on compatible hardware and has no effect otherwise. Bug: 181603044 Test: atest under system/netd/tests Change-Id: I94f169ec8e5ee8bd67e1561cdacd3d9bcddba4c2 Merged-In: I94f169ec8e5ee8bd67e1561cdacd3d9bcddba4c2 (cherry picked from commit 722d9b16de024e5184547a17d432d5598da6f41a)
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to external/iproute2Bob Badour
Added SPDX-license-identifier-BSD SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-GPL-3.0 SPDX-license-identifier-LGPL to: tc/Android.bp Added SPDX-license-identifier-BSD SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-GPL-3.0 SPDX-license-identifier-LGPL legacy_unencumbered to: Android.bp Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 to: misc/Android.bp Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL to: lib/Android.bp Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL legacy_unencumbered to: ip/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I22cbc120a859b4fe62607cd43d8c6b4931e95518
2018-11-18Convert to Android.bpDan Willemsen
See build/soong/README.md for more information ss was added to PRODUCT_PACKAGES_DEBUG in base_system.mk, as module tagging is not supported in Soong. Test: cd external/iproute2; mma Change-Id: I8b44e240d998e47b8ffc60e951451d570a8ae025
2018-04-09Compile ss(8) with HAVE_SELINUX.Robert Sesek
This allow seeing the security label associated with sockets. Test: `adb shell ss -Z` shows SELinux labels on sockets Change-Id: Ic1c9ae46d435110e4ab469b265baa4b832162713
2017-11-22Always use the bionic UAPI includes for iproute2.Lorenzo Colitti
On some products, the system include patch lists vendor-specific include directories (e.g., hardware/qcom/msm8996) before the bionic include paths. This causes us to pick up versions of critical include files, such as <linux/netlink.h>, which are too old to build iproute2. Fix the iproute2 makefiles to explicitly list the bionic UAPI include directory first. Test: aosp_walleye-eng builds Test: aosp_marlin-eng builds Change-Id: Id0db30f6aed0dd64b6d26a6e88d84798a78c6ab9
2017-11-17Update to iproute v4.14Lorenzo Colitti
This merges upstream commit 212b52299e90a369373b9e38924b9492df695559 Change-Id: I42c1ebfa155829de826df415a5d3c2fea606fe26
2017-11-12lib: make resolve_hosts variable commonIvan Vecera
Any iproute utility that uses any function from lib/utils.c needs to declare its own resolve_hosts variable instance although it does not need/use hostname resolving functionality (currently only 'ip' and 'ss' commands uses this). The patch declares single common instance of resolve_hosts directly in utils.c so the existing ones can be removed (the same approach that is used for timestamp_short). Cc: Jiri Pirko <jiri@mellanox.com> Cc: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2017-11-01ss: Fix width calculations when Netid or State columns are missingStefano Brivio
If Netid or State columns are missing, we must not subtract one for each of these two columns from the remaining screen width, while distributing available space to columns. This one character corresponding to one delimiting space has to be subtracted only if the columns are actually printed. Further, in the existing implementation, if the screen width is an odd number, one additional character is added to the width of one of the two columns. But if both are not printed, this filling character needs to be added somewhere else, in order to have the right spacing allowing us to fill lines completely. Address and port fields are printed in pairs (local and remote), so we can't distribute the space to any of them, because it would be doubled. Instead, print this additional space to the right of the Send-Q column, to keep code changes to a minimum. This is particularly visible with 'ss -f netlink -Z'. Before this patch, with an 80 column terminal, we have: $ ss -f netlink -Z|head -n3 Recv-Q Send-Q Local Address:Port Peer Address:Port 0 0 rtnl:evolution-calen/2049 * pr oc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 0 0 rtnl:clock-applet/1944 * pr oc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 and with an 81 column terminal: $ ss -f netlink -Z|head -n3 Recv-Q Send-Q Local Address:Port Peer Address:Port 0 0 rtnl:evolution-calen/2049 * pro c_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 0 0 rtnl:clock-applet/1944 * pro c_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 After this patch, in both cases, the output is: $ ss -f netlink -Z|head -n3 Recv-Q Send-Q Local Address:Port Peer Address:Port 0 0 rtnl:evolution-calen/2049 * proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 0 0 rtnl:clock-applet/1944 * proc_ctx=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2017-11-01ss: Streamline process context printing in netlink_show_one()Stefano Brivio
There's no need to check 'pid_context' before calling free(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2017-11-01ss: Remove useless width specifier in process context printStefano Brivio
Both local address and service, and remote address and service fields are already printed out in netlink_show_one() before we start printing process context, by calling sock_addr_print() twice. At this point, sock_addr_print() has already forced the remote service field to be 'serv_width' wide -- that is, 'serv_width' width has already been consumed, before we print process context. Hence, it makes no sense to force the display width of process context to be 'serv_width' wide again: previous prints have filled up the line already. Remove the width specifier and prefix with a space instead, to keep this consistent with fields which are displayed after the first output line. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2017-10-23ss: initialize 'fackets' member of tcpstat structureRoman Mashak
'fackets' has never been initialized with kernel extracted information, thus never really printed. Signed-off-by: Roman Mashak <mrv@mojatatu.com>
2017-10-21ss: Detect IPPROTO_ICMPV6 socketsPhil Sutter
Prefix IPPROTO_ICMPV6 sockets with 'icmp6' instead of '???'. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-10-21ss: Distinguish between IPv4 and IPv6 wildcard socketsPhil Sutter
Commit aba9c23a6e1cb ("ss: enclose IPv6 address in brackets") unified display of wildcard sockets in IPv4 and IPv6 to print the unspecified address as '*'. Users then complained that they can't distinguish between address families anymore, so change this again to what Stephen Hemminger suggested: | *:80 << both IPV6 and IPV4 | [::]:80 << IPV6_ONLY | 0.0.0.0:80 << IPV4_ONLY Note that on older kernels which don't support INET_DIAG_SKV6ONLY attribute, pure IPv6 sockets will still show as '*'. Cc: Humberto Alves <hjalves@live.com> Cc: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-10-11ss: print MD5 signature keys configured on TCP socketsIvan Delalande
These keys are reported by kernel 4.14 and later under the INET_DIAG_MD5SIG attribute, when INET_DIAG_INFO is requested (ss -i) and we have CAP_NET_ADMIN. The additional output looks like: md5keys:fe80::/64=signing_key,10.1.2.0/24=foobar,::1/128=Test Signed-off-by: Ivan Delalande <colona@arista.com>
2017-10-02Check user supplied interface name lengthsPhil Sutter
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>
2017-09-01Merge branch 'master' into net-nextStephen Hemminger
Needed to add JSON support to tclass.
2017-09-01lnstat_util: Make sure buffer is NUL-terminatedPhil Sutter
Can't use strlcpy() here since lnstat is not linked against libutil. While being at it, fix coding style in that chunk as well. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-09-01Convert the obvious cases to strlcpy()Phil Sutter
This converts the typical idiom of manually terminating the buffer after a call to strncpy(). Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-30Merge branch 'master' into net-nextStephen Hemminger
2017-08-30ss: Fix for added diag support checkPhil Sutter
Commit 9f66764e308e9 ("libnetlink: Add test for error code returned from netlink reply") changed rtnl_dump_filter_l() to return an error in case NLMSG_DONE would contain one, even if it was ENOENT. This in turn breaks ss when it tries to dump DCCP sockets on a system without support for it: The function tcp_show(), which is shared between TCP and DCCP, will start parsing /proc since inet_show_netlink() returns an error - yet it parses /proc/net/tcp which doesn't make sense for DCCP sockets at all. On my system, a call to 'ss' without further arguments prints the list of connected TCP sockets twice. Fix this by introducing a dedicated function dccp_show() which does not have a fallback to /proc, just like sctp_show(). And since tcp_show() is no longer "multi-purpose", drop it's socktype parameter. Fixes: 9f66764e308e9 ("libnetlink: Add test for error code returned from netlink reply") Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-24Merge branch 'master' into net-nextStephen Hemminger
2017-08-24ss: Make sure scanned index value to unix_state_map is sanePhil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-24ss: Make struct tcpstat fields 'timer' and 'timeout' unsignedPhil Sutter
Both 'timer' and 'timeout' variables of struct tcpstat are either scanned as unsigned values from /proc/net/tcp{,6} or copied from 'idiag_timer' and 'idiag_expries' fields of struct inet_diag_msg, which itself are unsigned. Therefore they may be unsigned as well, which eliminates the need to check for negative values. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-24lnstat_util: Simplify alloc_and_open() a bitPhil Sutter
Relying upon callers and using unsafe strcpy() is probably not the best idea. Aside from that, using snprintf() allows to format the string for lf->path in one go. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-24ifstat, nstat: Check fdopen() return valuePhil Sutter
Prevent passing NULL FILE pointer to fgets() later. Fix both tools in a single patch since the code changes are basically identical. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-24ss: fix help/man TCP-STATE description for listeningAndreas Henriksson
There's some misleading information in --help and ss(8) manpage about TCP-STATE named 'listen'. ss doesn't know such a state, but it knows 'listening' state. $ ss -tua state listen ss: wrong state name: listen $ ss -tua state listening [...] Addresses: https://bugs.debian.org/872990 Reported-by: Pavel Lyulchenko <p.lyulchenko@gmail.com> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2017-08-23config: put CFLAGS/LDLIBS in config.mkStephen Hemminger
This renames Config to config.mk and includes more Make input. Now configure generates all the required CFLAGS and LDLIBS for the optional libraries. Also, use pkg-config to test for libelf, rather than using a test program. This makes it consistent with other libraries. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-08-21ss: Use C99 initializer in netlink_show_one()Phil Sutter
This has the additional benefit of initializing st.ino to zero which is used later in is_sctp_assoc() function. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-21ss: Drop useless assignmentPhil Sutter
After '*b = *a', 'b->next' already has the same value as 'a->next'. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-21ss: Skip useless check in parse_hostcond()Phil Sutter
The passed 'addr' parameter is dereferenced by caller before and in parse_hostcond() multiple times before this check, so assume it is always true. Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-18ss: Fix potential memleak in unix_stats_print()Phil Sutter
Fixes: 2d0e538f3e1cd ("ss: Drop list traversal from unix_stats_print()") Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-18ifstat: Fix memleak in dump_kern_db() for json outputPhil Sutter
Looks like this was forgotten when converting to common json output formatter. Fixes: fcc16c2287bf8 ("provide common json output formatter") Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-18ifstat: Fix memleak in error casePhil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-18ss: Don't leak fd in tcp_show_netlink_file()Phil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-08-09change how Config is used in Makefile'sStephen Hemminger
The recent LIBMNL changes was made more difficult to debug because of how Config is handle in clean make. The Config file is generated by top level make, but since it is not recursive, the values generated would not be visible on a clean make. The change is to not include Config in top level make, and move all the conditionals down into sub makefiles. Not ideal, but beter than going full autoconf route. Or forcing separate configure step. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-08-07lib: fix extended ack with and without libmnlStephen Hemminger
The code was always building without libmnl support, so it was doing nothing. Fixes: b6432e68ac2f ("iproute: Add support for extended ack to rtnl_talk") Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-08-04ss: enclose IPv6 address in bracketsStephen Hemminger
Based on patch by Lehner Florian <dev@der-flo.net> Adds support for RFC2732 IPv6 address format with brackets. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-07-25Remove LOCAL_CLANGLennart Wieboldt
clang is the default compiler since Android nouga Change-Id: I9af9c2b47b33a0650bfd5dca4470953fbe95d131 Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-02-24netlink route attribute cleanupStephen Hemminger
Use the new helper functions rta_getattr_u* instead of direct cast of RTA_DATA(). Where RTA_DATA() is a structure, then remove the unnecessary cast since RTA_DATA() is void * Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-02-06ss: print tcpi_rcv_mss and tcpi_advmssEric Dumazet
tcpi_rcv_mss and tcpi_advmss tcp info fields were not yet reported by ss. While adding GRO support to packetdrill, I found this was useful. Signed-off-by: Eric Dumazet <edumazet@google.com>
2017-02-03ifstat: Add "sw only" extended statistics to ifstatNogah Frankel
Add support for extended statistics of SW only type, for counting only the packets that went via the cpu. (useful for systems with forward offloading). It reads it from filter type IFLA_STATS_LINK_OFFLOAD_XSTATS and sub type IFLA_OFFLOAD_XSTATS_CPU_HIT. It is under the name 'cpu_hits' (or any shorten of it as 'cpu' or simply 'c') For example: ifstat -x c Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
2017-02-03ifstat: Add extended statistics to ifstatNogah Frankel
Extended stats are part of the RTM_GETSTATS method. This patch adds them to ifstat. While extended stats can come in many forms, we support only the rtnl_link_stats64 struct for them (which is the 64 bits version of struct rtnl_link_stats). We support stats in the main nesting level, or one lower. The extension can be called by its name or any shorten of it. If there is more than one matched, the first one will be picked. To get the extended stats the flag -x <stats type> is used. Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
2017-02-03ifstat: Includes reorderNogah Frankel
Reorder the includes in misc/ifstat.c to match convention. Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
2016-12-02Merge branch 'master' into net-nextStephen Hemminger
2016-12-02ss: initialise variables outside of for loopSimon Horman
Initialise for loops outside of for loops. GCC flags this as being out of spec unless C99 or C11 mode is used. With this change the entire tree appears to compile cleanly with -Wall. $ gcc --version gcc (Debian 4.9.2-10) 4.9.2 ... $ make ... ss.c: In function ‘unix_show_sock’: ss.c:3128:4: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode ... Signed-off-by: Simon Horman <simon.horman@netronome.com>
2016-12-02ss: unix_show: No need to initialize members of calloc'ed structsPhil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-12-02ss: Make sstate_namel local to scan_state()Phil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-12-02ss: Make sstate_name local to sock_state_print()Phil Sutter
Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-12-02ss: Make unix_state_map local to unix_show()Phil Sutter
Also make it const, since there won't be any write access happening. Signed-off-by: Phil Sutter <phil@nwl.cc>
2016-12-02ss: Get rid of single-fielded struct snmpstatPhil Sutter
A struct with only a single field does not make much sense. Besides that, it was used by print_summary() only. Signed-off-by: Phil Sutter <phil@nwl.cc>