summaryrefslogtreecommitdiff
path: root/misc/ss.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: use SPDXStephen Hemminger2023-01-141-5/+1
| | | | | | Use SPDX tag instead of GPL boilerplate. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: re-add TIPC query supportMatthieu Baerts2022-10-201-0/+1
| | | | | | | | | | | | | | | | | TIPC support has been introduced in 'iproute-master' (not -next) in commit 5caf79a0 ("ss: Add support for TIPC socket diag in ss tool"), at the same time a refactoring introducing filter_db_parse() was done, see commit 67d5fd55 ("ss: Put filter DB parsing into a separate function") from iproute2-next. When the two commits got merged, the support for TIPC has been apparently accidentally dropped. This simply adds the missing entry for TIPC. Fixes: 2c62a64d ("Merge branch 'iproute2-master' into iproute2-next") Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: usage: add missing parametersMatthieu Baerts2022-10-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | These query entries were in the man page but not in 'ss -h': - packet_raw - packet_dgram - dccp - sctp - xdp (+ the --xdp option) I only created one commit with all: this fixes multiple commits but all on the same line. The only exception is with '--xdp' parameter which is linked to commit 2abc3d76 ("ss: add AF_XDP support"). Fixes: aba5acdf ("(Logical change 1.3)") # packet raw/dgram Fixes: 351efcde ("Update header files to 2.6.14") # dccp Fixes: f89d46ad ("ss: Add support for SCTP protocol") # sctp Fixes: 2abc3d76 ("ss: add AF_XDP support") # xdp Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: fix duplicate includeStephen Hemminger2022-10-041-1/+0
| | | | | | | No need to include rt_names.h twice. Fixes: 31f45088c9c8 ("build: fix build failure with -fno-common") Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: Shorter display format for TLS zerocopy sendfileMaxim Mikityanskiy2022-06-121-2/+3
| | | | | | | | | | | | | | | Commit 21c07b45688f ("ss: Show zerocopy sendfile status of TLS sockets") started displaying the activation status of zerocopy sendfile on TLS sockets, exposed via sock_diag. This commit makes the format more compact: the flag's name is shorter and is printed only when the feature is active, similar to other flag options. The flag's name is also generalized ("sendfile" -> "tx") to embrace possible future optimizations, and includes an explicit indication that the underlying data must not be modified during transfer ("ro"). Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Introduce -T, --threads optionPeilin Ye2022-05-301-29/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -p, -Z and -z options only show process (thread group leader) information. For example, if the thread group leader has exited, but another thread in the group is still using a socket, ss -[pZz] does not show it. Add a new option, -T (--threads), to show thread information. It implies the -p option. For example, imagine process A and thread B (in the same group) using the same socket. ss -p only shows A: $ ss -ltp "sport = 1234" State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 100 0.0.0.0:1234 0.0.0.0:* users:(("test",pid=2932547,fd=3)) ss -T shows A and B: $ ss -ltT "sport = 1234" State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 100 0.0.0.0:1234 0.0.0.0:* users:(("test",pid=2932547,tid=2932548,fd=3),("test",pid=2932547,tid=2932547,fd=3)) If -T is used, -Z and -z also show SELinux contexts for threads. Rename some variables (from "process" to "task", for example) since we use them for both processes and threads. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Factor out fd iterating logic from user_ent_hash_build()Peilin Ye2022-05-301-65/+79
| | | | | | | | | | | | We are planning to add a thread version of the -p, --process option. Move the logic iterating $PROC_ROOT/$PID/fd/ into a new function, user_ent_hash_build_task(), to make it easier. Since we will use this function for both processes and threads, rename local variables as such (e.g. from "process" to "task"). Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Fix coding style issues in user_ent_hash_build()Peilin Ye2022-05-301-10/+12
| | | | | | | Make checkpatch.pl --strict happy about user_ent_hash_build(). Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Delete unnecessary call to snprintf() in user_ent_hash_build()Peilin Ye2022-05-301-4/+1
| | | | | | | | 'name' is already $PROC_ROOT/$PID/fd/$FD there, no need to rebuild the string. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Do not call user_ent_hash_build() more than oncePeilin Ye2022-05-301-9/+3
| | | | | | | | Call user_ent_hash_build() once after the getopt_long() loop if -p, -z or -Z is used. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Remove unnecessary stack variable 'p' in user_ent_hash_build()Peilin Ye2022-05-301-5/+3
| | | | | | | | | Commit 116ac9270b6d ("ss: Add support for retrieving SELinux contexts") added an unnecessary stack variable, 'char *p', in user_ent_hash_build(). Delete it for readability. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Use assignment-suppression character in sscanf()Peilin Ye2022-05-301-3/+2
| | | | | | | | Use the '*' assignment-suppression character, instead of an inappropriately named temporary variable. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: Show zerocopy sendfile status of TLS socketsMaxim Mikityanskiy2022-05-301-0/+6
| | | | | | | | | Print the activation status of zerocopy sendfile on TLS sockets. Zerocopy sendfile was recently added to Linux and exposed via sock_diag. Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: remove an implicit dependency on rpcinfoAndrea Claudi2022-03-231-20/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ss uses rpcinfo to get info about rpc services socket. This makes it dependent on a tool not included in iproute2, and makes it impossible to get info on rpc sockets if rpcinfo is not installed. This reworks init_service_resolver() to use libtirpc, thus avoiding the implicity dependency on rpcinfo. Moreover, this also makes it possible to display info about ipv6 rpc socket that are not included in the rpcinfo -p output. For example, before this patch: $ ss -rtap LISTEN 0 5 localhost:ipp [::]:* users:(("cupsd",pid=1600,fd=9)) LISTEN 0 64 [::]:34265 [::]:* LISTEN 0 64 [::]:rpc.nfs_acl [::]:* LISTEN 0 128 [::]:42253 [::]:* users:(("rpc.statd",pid=146164,fd=12)) After this patch: $ ss -rtap LISTEN 0 5 localhost:ipp [::]:* users:(("cupsd",pid=1600,fd=9)) LISTEN 0 64 [::]:rpc.nlockmgr [::]:* LISTEN 0 64 [::]:rpc.nfs_acl [::]:* LISTEN 0 128 [::]:rpc.status [::]:* users:(("rpc.statd",pid=146164,fd=12)) Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: display advertised TCP receive window and out-of-order counterDavide Caratti2022-03-041-0/+8
| | | | | | | | | | | these members of TCP_INFO have been included in v5.4. tested with: # ss -nti Signed-off-by: Davide Caratti <dcaratti@redhat.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* ss: use freecon() instead of free() when appropriateAndrea Claudi2022-01-311-4/+9
| | | | | | | | | | | | According to SELinux API, when resources are allocated using getpidcon() of getfilecon(), they should be freed using freecon(). This commit makes ss use freecon() where appropriate, defining a stub function executing a free() useful when iproute2 is compiled without SELinux support. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: fix fallback to procfs for raw socketsJakub Kicinski2021-08-181-4/+4
| | | | | | | | | | | | | | | | Jonas reports that ss -awp does not display any RAW sockets on a Knoppix 4.4 kernel. sockdiag_send() diverts to tcpdiag_send() to try the older netlink interface. tcpdiag_send() works for TCP and DCCP but not other protocols. Instead of rejecting unsupported protocols (and missing RAW and SCTP) match on supported ones. Link: https://lore.kernel.org/netdev/20210815231738.7b42bad4@mmluhan/ Reported-and-tested-by: Jonas Bechtel <post@jbechtel.de> Fixes: 41fe6c34de50 ("ss: Add inet raw sockets information gathering via netlink diag interface") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-nextStephen Hemminger2021-02-231-49/+49
|\
| * ss: Make leading ":" always optional for sport and dportThayne McCombs2021-02-141-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sport and dport conditions in expressions were inconsistent on whether there should be a ":" at the beginning of the port when only a port was provided depending on the family. The link and netlink families required a ":" to work. The vsock family required the ":" to be absent. The inet and inet6 families work with or without a leading ":". This makes the leading ":" optional in all cases, so if sport or dport are used, then it works with a leading ":" or without one, as inet and inet6 did. Signed-off-by: Thayne McCombs <astrothayne@gmail.com> Signed-off-by: David Ahern <dsahern@kernel.org>
| * ss: always prefer family as part of host condition to default familyThayne McCombs2021-02-041-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ss accepts an address family both with the -f option and as part of a host condition. However, if the family in the host condition is different than the the last -f option, then which family is actually used depends on the order that different families are checked. This changes parse_hostcond to check all family prefixes before parsing the rest of the address, so that the host condition's family always has a higher priority than the "preferred" family. Signed-off-by: Thayne McCombs <astrothayne@gmail.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* | ss: do not emit warn while dumping MPTCP on old kernelsPaolo Abeni2021-02-021-1/+9
|/ | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, running 'ss' on a kernel older than v5.9 bumps an error message: RTNETLINK answers: Invalid argument When asked to dump protocol number > 255 - that is: MPTCP - 'ss' adds an INET_DIAG_REQ_PROTOCOL attribute, unsupported by the older kernel. Avoid the warning ignoring filter issues when INET_DIAG_REQ_PROTOCOL is used. Additionally older kernel end-up invoking tcpdiag_send(), which in turn will try to dump DCCP socks. Bail early in such function, as the kernel does not implement an MPTCPDIAG_GET request. Reported-by: "Rantala, Tommi T. (Nokia - FI/Espoo)" <tommi.t.rantala@nokia.com> Fixes: 9c3be2c0eee0 ("ss: mptcp: add msk diag interface support") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: mptcp: fix add_addr_accepted stat printAndrea Claudi2020-12-151-1/+1
| | | | | | | | | add_addr_accepted value is not printed if add_addr_signal value is 0. Fix this properly looking for add_addr_accepted value, instead. Fixes: 9c3be2c0eee01 ("ss: mptcp: add msk diag interface support") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: add support for xdp statisticsCiara Loftus2020-09-291-1/+21
| | | | | | | | | | | | | | | | The patch exposes statistics for XDP sockets which can be useful for debugging purposes. The stats exposed are: rx dropped rx invalid rx queue full rx fill ring empty tx invalid tx ring empty Signed-off-by: Ciara Loftus <ciara.loftus@intel.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* iproute2: ss: add support to expose various inet sockoptsWei Wang2020-09-081-0/+43
| | | | | | | | | | | | | | | | | | | | This commit adds support to expose the following inet socket options: -- recverr -- is_icsk -- freebind -- hdrincl -- mc_loop -- transparent -- mc_all -- nodefrag -- bind_address_no_port -- recverr_rfc4884 -- defer_connect with the option --inet-sockopt. The individual option is only shown when set. Signed-off-by: Wei Wang <weiwan@google.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* Merge branch 'main' into nextDavid Ahern2020-08-061-3/+3
|\ | | | | | | | | | | | | | | Conflicts: bridge/fdb.c man/man8/bridge.8 Signed-off-by: David Ahern <dsahern@kernel.org>
| * replace SNAPSHOT with auto-generated version stringStephen Hemminger2020-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | Replace the iproute2 snapshot with a version string which is autogenerated as part of the build process using git describe. This will also allow seeing if the version of the command is built from the same sources is as upstream. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * misc: make the pattern matching case-insensitiveAnton Danilov2020-07-201-1/+1
| | | | | | | | | | | | | | | | To improve the usability better use case-insensitive pattern-matching in ifstat, nstat and ss tools. Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ss: mptcp: add msk diag interface supportPaolo Abeni2020-07-141-10/+105
|/ | | | | | | | | | This implement support for MPTCP sockets type, comprising extended socket info. Note that we need to add an extended attribute carrying the actual protocol number to the diag request. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
* Merge branch 'master' into nextDavid Ahern2020-05-271-4/+13
|\ | | | | | | Signed-off-by: David Ahern <dsahern@gmail.com>
| * ss: update to bw printStephen Hemminger2020-05-051-1/+8
| | | | | | | | | | | | | | | | Display kilobit with the standard suffix. Add comment to describe where data rate suffixes come from. Add support for terrabit. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * ss: add support for Gbit speeds in sprint_bw()Eric Dumazet2020-05-051-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also use 'g' specifier instead of 'f' to remove trailing zeros, and increase precision. Examples of output : Before After 8.0Kbps 8Kbps 9.9Mbps 9.92Mbps 55001Mbps 55Gbps Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ss: add checks for bc filter supportDmitry Yakunin2020-05-131-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted by David Ahern, now if some bytecode filter is not supported by running kernel printed error message is not clear. This patch is attempt to detect such case and print correct message. This is done by providing checking function for new filter types. As example check function for cgroup filter is implemented. It sends correct lightweight request (idiag_states = 0) with zero cgroup condition to the kernel and checks returned errno. If filter is not supported EINVAL is returned. Result of checking is cached to avoid extra checks if several same filters are specified. Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
* | ss: add support for cgroup v2 information and filteringDmitry Yakunin2020-05-131-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces two new features: obtaining cgroup information and filtering sockets by cgroups. These features work based on cgroup v2 ID field in the socket (kernel should be compiled with CONFIG_SOCK_CGROUP_DATA). Cgroup information can be obtained by specifying --cgroup flag and now contains only pathname. For faster pathname lookups cgroup cache is implemented. This cache is filled on ss startup and missed entries are resolved and saved on the fly. Cgroup filter extends EXPRESSION and allows to specify cgroup pathname (relative or absolute) to obtain sockets attached only to this cgroup. Filter syntax: ss [ cgroup PATHNAME ] Examples: ss -a cgroup /sys/fs/cgroup/unified (or ss -a cgroup .) ss -a cgroup /sys/fs/cgroup/unified/cgroup1 (or ss -a cgroup cgroup1) v2: - style fixes (David Ahern) Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
* | ss: allow dumping MPTCP subflow informationDavide Caratti2020-04-291-0/+62
|/ | | | | | | | | | | | | [root@f31 packetdrill]# ss -tni ESTAB 0 0 192.168.82.247:8080 192.0.2.1:35273 cubic wscale:7,8 [...] tcp-ulp-mptcp flags:Mec token:0000(id:0)/5f856c60(id:0) seq:b810457db34209a5 sfseq:1 ssnoff:0 maplen:190 Additionally extends ss manpage to describe the new entry layout. Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* Merge branch 'master' of ↵Stephen Hemminger2020-01-291-4/+15
|\ | | | | | | | | | | git://git.kernel.org/pub/scm/network/iproute2/iproute2-next Resolved conflict in tc/f_flower.c
| * ss: use compact output for undetected screen widthPeter Junos2020-01-021-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes calculation of width in case user pipes the output. SS output output works correctly when stdout is a terminal. When one pipes the output, it tries to use 80 or 160 columns. That adds a line-break if user has terminal width of 100 chars and output is of the similar width. No width is assumed here. To reproduce the issue, call ss | less and see every other line empty if your screen is between 80 and 160 columns wide. This second version of the patch fixes screen_width being set to arbitrary value. Signed-off-by: Peter Junos <petoju@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* | build: fix build failure with -fno-commonJan Engelhardt2020-01-201-1/+1
|/ | | | | | | | | | | | | | | $ make CCOPTS=-fno-common gcc ... -o ip ld: rt_names.o (symbol from plugin): in function "rtnl_rtprot_n2a": (.text+0x0): multiple definition of "numeric"; ip.o (symbol from plugin):(.text+0x0): first defined here gcc ... -o tipc ld: ../lib/libutil.a(utils.o):(.bss+0xc): multiple definition of `pretty'; tipc.o:tipc.c:28: first defined here References: https://bugzilla.opensuse.org/1160244 Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: fix end-of-line printing in misc/ss.cBrian Vazquez2019-12-051-0/+5
| | | | | | | | | | | | | | The previous change to ss to show header broke the printing of end-of-line for the last entry. Tested: diff <(./ss.old -nltp) <(misc/ss -nltp) 38c38 < LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116)) \ No newline at end of file Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge branch 'master' into nextDavid Ahern2019-11-201-0/+2
|\ | | | | | | | | | | | | Conflicts: include/uapi/linux/devlink.h Signed-off-by: David Ahern <dsahern@gmail.com>
| * ss: show header for --processes/-pHritik Vijay2019-11-141-0/+2
| | | | | | | | | | | | | | | | ss by default shows headers for every column but omits it for --processes for no apparent reason. This patch adds the "Process" header. Signed-off-by: Hritik Vijay <hritikxx8@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | Merge branch 'master' into nextDavid Ahern2019-11-091-13/+13
|\ \ | |/ | | | | Signed-off-by: David Ahern <dsahern@gmail.com>
| * libnetlink.c, ss.c: properly handle fread() errorsMichał Łyszczek2019-11-011-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fread(3) returns size_t data type which is unsigned, thus check `if (fread(...) < 0)' is always false. To check if fread(3) has failed, user should check error indicator with ferror(3). This commit also changes read logic a little bit by being less forgiving for errors. Previous logic was checking if fread(3) read *at least* required ammount of data, now code checks if fread(3) read *exactly* expected ammount of data. This makes sense because code parses very specific binary file, and reading even 1 less/more byte than expected, will later corrupt data anyway. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ss: allow dumping kTLS infoDavide Caratti2019-10-141-0/+89
|/ | | | | | | | | | | | now that INET_DIAG_INFO requests can dump TCP ULP information, extend 'ss' to allow diagnosing kTLS when it is attached to a TCP socket. While at it, import kTLS uAPI definitions from the latest net-next tree. CC: Andrea Claudi <aclaudi@redhat.com> Co-developed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* ss: sctp: Formatting tweak in sctp_show_info for localsPatrick Talbert2019-08-061-1/+1
| | | | | | | | 'locals' output does not include a leading space so it runs up against skmem:() output. Add a leading space to fix it. Signed-off-by: Patrick Talbert <ptalbert@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: sctp: fix typo for nodelayPatrick Talbert2019-08-061-1/+1
| | | | | | | nodealy should be nodelay. Signed-off-by: Patrick Talbert <ptalbert@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ss: Change resolve_services to numericDavid Ahern2019-07-091-1/+1
| | | | | | | | | | | Commit ca697cee4cfc ("ip: add a new parameter -Numeric") changed !resolve_services to numeric in ss.c. A commit in master: d791e75d74ff ("ss: in --numeric mode, print raw numbers for data rates") added another reference to !resolve_services. Convert it to numeric. Signed-off-by: David Ahern <dsahern@gmail.com>
* Merge branch 'master' into nextDavid Ahern2019-07-091-1/+3
|\ | | | | | | Signed-off-by: David Ahern <dsahern@gmail.com>
| * ss: in --numeric mode, print raw numbers for data ratesTomasz Torcz2019-07-081-1/+3
| | | | | | | | | | | | | | | | | | ss by default shows data rates in human-readable form - as Mbps/Gbps etc. Enhance --numeric mode to show raw values in bps, without conversion. Signed-of-by: Tomasz Torcz <tomasz.torcz@nordea.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ip: add a new parameter -NumericHangbin Liu2019-06-181-9/+6
|/ | | | | | | | | | | | 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>
* ss: add option to print socket information on one lineJosh Hunt2019-05-021-10/+41
| | | | | | | | | | | | | | | | | | | | 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>