Skip to content

Teach ss to show sockets' shutdown state

Pavel Emelyanov netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5ss: Rename some tcp- names into inet-misc/ss.c+12 -90 replies
2/5ss: Split inet_show_netlink into partsmisc/ss.c+21 -60 replies
3/5ss: Support sock-diagmisc/ss.c+87 -80 replies
4/5ss: Get udp sockets info via sock-diagmisc/ss.c+7 -01 reply
5/5ss: Show inet and unix sockets' shutdown stateinclude/linux/inet_diag.h include/linux/unix_diag.h misc/ss.c+23 -75 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH iproute2 0/5] Teach ss to show sockets' shutdown state

In the net-next sits a patch which extends the sock-diag subsys to show the sockets' shutdown state. I propose to teach the ss tool to print this info when requested with -e|--extended key.

The output will look like arrows at the end of each line, like this:

ESTAB 0 0  127.0.0.1:41705  127.0.0.1:12345  ino:143321 sk:ffff88003a8cea00 -->
ESTAB 0 0  127.0.0.1:46925  127.0.0.1:12346  ino:143322 sk:ffff88003a8ce4c0 <--
ESTAB 0 0  127.0.0.1:51678  127.0.0.1:12347  ino:143323 sk:ffff88003a8cdf80 ---
ESTAB 0 0  127.0.0.1:46911  127.0.0.1:12348  ino:143324 sk:ffff88003b7f05c0 <->

for SHUT_RD, SHUT_WR, SHUT_RDWR and non-shutdown sockets respectively.

In order to do so, it's also required to implement support for the newer sock-diag in tcp and udp netlink code. I did it before, but broke compatibility with older kernels (those without sock-diag). Now this is fixed (checked on 2.6.40 kernel).