Skip to contentSkip to conversation

ss: prevent "Process" column from being printed unless requested

PATCH Applied Quentin Deslandes 3 participants 3 messages Dec 6, 2023 – Jan 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: prevent "Process" column from being printed unless requested

Commit 5883c6eba517 ("ss: show header for --processes/-p") added "Process" to the list of columns printed by ss. However, the "Process" header is now printed even if --processes/-p is not used.

This change aims to fix this by moving the COL_PROC column ID to the same index as the corresponding column structure in the columns array, and enabling it if --processes/-p is used.

Fixes 5883c6eba517 ("ss: show header for --processes/-p")
---
 misc/ss.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
misc/ss.c +4 -1
index 9438382b..09dc1f37 100644
@@ -100,8 +100,8 @@ enum col_id {
 	COL_SERV,
 	COL_RADDR,
 	COL_RSERV,
-	COL_EXT,
 	COL_PROC,
+	COL_EXT,
 	COL_MAX
 };
 
@@ -5795,6 +5795,9 @@ int main(int argc, char *argv[])
 	if (ssfilter_parse(&current_filter.f, argc, argv, filter_fp))
 		usage();
 
+	if (!show_processes)
+		columns[COL_PROC].disabled = 1;
+
 	if (!(current_filter.dbs & (current_filter.dbs - 1)))
 		columns[COL_NETID].disabled = 1;
 
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 9 lines · On Wed, 6 Dec 2023 12:14:44 +0100 you wrote:

Commit 5883c6eba517 ("ss: show header for --processes/-p") added "Process" to the list of columns printed by ss. However, the "Process" header is now printed even if --processes/-p is not used.

This change aims to fix this by moving the COL_PROC column ID to the same index as the corresponding column structure in the columns array, and enabling it if --processes/-p is used.

[...]

Here is the summary with links:
- ss: prevent "Process" column from being printed unless requested

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=1607bf531fd2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#2 lore raw
In reply to Quentin Deslandes

Hi Quentin,

Quoted 7 lines · Quentin Deslandes

Commit 5883c6eba517 ("ss: show header for --processes/-p") added "Process" to the list of columns printed by ss. However, the "Process" header is now printed even if --processes/-p is not used.

This change aims to fix this by moving the COL_PROC column ID to the same index as the corresponding column structure in the columns array, and enabling it if --processes/-p is used.

I recently noticed that some MPTCP selftests were broken after having upgraded IPRoute2 to the latest version: from v6.6 to v6.7.

It looks like this is due to this patch here:

1607bf53 ("ss: prevent "Process" column from being printed unless
requested")

If I revert it, MPTCP selftests are passing again.

From what I can see, the behaviour has changed recently: if '-i' is used without '-p', the extra line is no longer not displayed any more, e.g. 'ss -tl' and 'ss -tli' gives the same output:

Quoted 7 lines
$ ss -tl 
State            Recv-Q           Send-Q                       Local Address:Port                       Peer Address:Port           
LISTEN           0                1                                  0.0.0.0:4444                            0.0.0.0:*              
$ ss -tli
State            Recv-Q           Send-Q                       Local Address:Port                       Peer Address:Port           
LISTEN           0                1                                  0.0.0.0:4444                            0.0.0.0:*              

If '-p' is added, '-i' works as before:

Quoted 8 lines
$ ss -tlp
State          Recv-Q         Send-Q                 Local Address:Port                   Peer Address:Port         Process         
LISTEN         0              1                            0.0.0.0:4444                        0.0.0.0:*             users:(("netcat",pid=2668,fd=3))
$ ss -tlpi
State          Recv-Q         Send-Q                 Local Address:Port                   Peer Address:Port         Process         
LISTEN         0              1                            0.0.0.0:4444                        0.0.0.0:*             users:(("netcat",pid=2668,fd=3))
         cubic cwnd:10

(we can see the extra line with 'cubic cwnd:10')

I just noticed that you were working on other patches modifying 'ss', and even adding a new column. Are you aware of this issue? Are you already working -- or going to work -- on a fix for it?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.