[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250821123555.67ed31d1@elisabeth>
Date: Thu, 21 Aug 2025 12:35:55 +0200
From: Stefano Brivio <sbrivio@...hat.com>
To: Paul Wayper <pwayper@...hat.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>, netdev@...r.kernel.org,
paulway@...hat.com, jbainbri@...hat.com
Subject: Re: [PATCH iproute2] ss: Don't pad the last (enabled) column
Hi Paul,
On Thu, 21 Aug 2025 15:45:47 +1000
Paul Wayper <pwayper@...hat.com> wrote:
> ss will emit spaces on the right hand side of a left-justified, enabled
> column even if it's the last column. In situations where one or more
> lines are very long - e.g. because of a large PROCESS field value - this
> causes a lot of excess output.
I guess I understand the issue, but having an example would help,
because I'm not quite sure how to reproduce this.
There's a problem with this change though, which I didn't really
investigate. It turns something like this (105 columns):
$ ss -tunl
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 10.45.242.29:49047 0.0.0.0:*
udp UNCONN 0 0 192.168.122.1:53 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0%virbr0:67 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:111 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:33335 0.0.0.0:*
udp UNCONN 0 0 192.168.1.185:60797 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:5154 0.0.0.0:*
udp UNCONN 0 0 224.0.0.251:5353 0.0.0.0:*
udp UNCONN 0 0 224.0.0.251:5353 0.0.0.0:*
udp UNCONN 0 0 224.0.0.251:5353 0.0.0.0:*
udp UNCONN 0 0 224.0.0.251:5353 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:*
udp UNCONN 0 0 [::]:111 [::]:*
udp UNCONN 0 0 [fe80::1839:8c7e:5e64:76a4]%wlp4s0:546 [::]:*
udp UNCONN 0 0 [::]:5353 [::]:*
udp UNCONN 0 0 [::]:39164 [::]:*
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:111 0.0.0.0:*
tcp LISTEN 0 1024 0.0.0.0:80 0.0.0.0:*
tcp LISTEN 0 5 0.0.0.0:5154 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.1:631 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.1:41001 0.0.0.0:*
tcp LISTEN 0 20 127.0.0.1:25 0.0.0.0:*
tcp LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 4096 [::]:111 [::]:*
tcp LISTEN 0 1024 [::]:80 [::]:*
tcp LISTEN 0 4096 [::1]:631 [::]:*
tcp LISTEN 0 1024 *:12865 *:*
tcp LISTEN 0 20 [::1]:25 [::]:*
into this:
$ ./ss -tunl
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 192.168.122.1: 530.0.0.0:
* udp UNCONN 0 0 0.0.0.0%virbr0:67
0.0.0.0: * udp UNCONN0 0 0.0.0.0:
111 0.0.0.0: * udpUNCONN 0 0
0.0.0.0: 33335 0.0.0.0: * udp UNCONN0
0 0.0.0.0: 5154 0.0.0.0: * udpUNCONN
0 0 224.0.0.251: 5353 0.0.0.0:* udp
UNCONN 0 0 224.0.0.251: 53530.0.0.0: *
udp UNCONN 0 0 224.0.0.251:5353 0.0.0.0:*
udp UNCONN 0 0 224.0.0.251: 53530.0.0.0:
* udp UNCONN 0 0 0.0.0.0:5353
0.0.0.0: * udp UNCONN0 0 [::]:
111 [::]: * udpUNCONN 0 0
[fe80::1839:8c7e:5e64:76a4]%wlp4s0: 546 [::]: * udp UNCONN0
0 [::]: 5353 [::]: * udpUNCONN
0 0 [::]: 39164 [::]:* tcp
LISTEN 0 128 0.0.0.0: 220.0.0.0: *
tcp LISTEN 0 4096 0.0.0.0:111 0.0.0.0:*
tcp LISTEN 0 1024 0.0.0.0: 800.0.0.0:
* tcp LISTEN 0 5 0.0.0.0:5154
0.0.0.0: * tcp LISTEN0 4096 127.0.0.1:
631 0.0.0.0: * tcpLISTEN 0 4096
127.0.0.1: 41001 0.0.0.0: * tcp LISTEN0
20 127.0.0.1: 25 0.0.0.0: * tcpLISTEN
0 32 192.168.122.1: 53 0.0.0.0:* tcp
LISTEN 0 128 [::]: 22[::]: *
tcp LISTEN 0 4096 [::]:111 [::]:*
tcp LISTEN 0 1024 [::]: 80[::]:
* tcp LISTEN 0 4096 [::1]:631
[::]: * tcp LISTEN0 1024 *:
12865 *: * tcpLISTEN 0 20
[::1]: 25 [::]: *
> Firstly, calculate the last enabled column. Then use this in the check
> for whether to emit trailing spaces on the last column.
>
> Also remove the 'EXT' column which does not seem to be used.
It's not referenced explicitly but it's definitely used, see also commits:
8740ca9dcd3c ss: add support for BPF socket-local storage
84c45b8acb30 Reapply "ss: prevent "Process" column from being printed unless requested"
f22c49730c36 Revert "ss: prevent "Process" column from being printed unless requested"
1607bf531fd2 ss: prevent "Process" column from being printed unless requested
Now, while 5883c6eba517 ("ss: show header for --processes/-p") and consequently
f22c49730c36 are obviously broken (sorry, I didn't review those, nobody Cc'ed
me), they clearly show that COL_EXT is used. It's for stuff like TCP extensions
(say, 'ss -tei') which have no own / specific column header.
--
Stefano
Powered by blists - more mailing lists