]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ss: Drop empty lines in UDP output
authorPhil Sutter <phil@nwl.cc>
Fri, 2 Dec 2016 10:39:46 +0000 (11:39 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 2 Dec 2016 22:07:46 +0000 (14:07 -0800)
When dumping UDP sockets and show_tcpinfo (-i) is active but not
show_mem (-m), print_tcpinfo() does not output anything leading to an
empty line being printed after every socket. Fix this by skipping the
call to print_tcpinfo() and the previous newline printing in that case.

Signed-off-by: Phil Sutter <phil@nwl.cc>
misc/ss.c

index 5796d800f314dbf637791538847224d3bde478da..18ccb6dbfd099658f12f2823eecddbd847f94674 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2444,7 +2444,7 @@ static int inet_show_sock(struct nlmsghdr *nlh,
                }
        }
 
-       if (show_mem || show_tcpinfo) {
+       if (show_mem || (show_tcpinfo && protocol != IPPROTO_UDP)) {
                printf("\n\t");
                if (protocol == IPPROTO_SCTP)
                        sctp_show_info(nlh, r, tb);