Skip to contentSkip to conversation

mptcp: print new line in mptcp_seq_show() if mptcp isn't in use

PATCH Applied Jianguo Wu 2 participants 2 messages Dec 5, 2020 – Dec 8, 2020

Subsystems (3)
lore
Share & tools
lore

Jianguo Wu

author
#0 lore raw

PATCH v2 1/1 mptcp: print new line in mptcp_seq_show() if mptcp isn't in use

From: Jianguo Wu <[email protected]>

When do cat /proc/net/netstat, the output isn't append with a new line, it looks like this:
[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0[root@localhost ~]#

This is because in mptcp_seq_show(), if mptcp isn't in use, net->mib.mptcp_statistics is NULL, so it just puts all 0 after "MPTcpExt:", and return, forgot the '\n'.

After this patch:

[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0
[root@localhost ~]#

Fixes fc518953bc9c8d7d ("mptcp: add and use MIB counter infrastructure")
---
 net/mptcp/mib.c | 1 +
 1 file changed, 1 insertion(+)
net/mptcp/mib.c +1 -0
index 84d1194..b921cbd 100644
@@ -67,6 +67,7 @@ void mptcp_seq_show(struct seq_file *seq)
 		for (i = 0; mptcp_snmp_list[i].name; i++)
 			seq_puts(seq, " 0");
 
+		seq_putc(seq, '\n');
 		return;
 	}
 
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 12 lines · On Sat, 5 Dec 2020 15:56:33 +0800 Jianguo Wu wrote:

From: Jianguo Wu <[email protected]>

When do cat /proc/net/netstat, the output isn't append with a new line, it looks like this:
[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0[root@localhost ~]#

This is because in mptcp_seq_show(), if mptcp isn't in use, net->mib.mptcp_statistics is NULL, so it just puts all 0 after "MPTcpExt:", and return, forgot the '\n'.

After this patch:

Quoted 8 lines

[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0
[root@localhost ~]#

Fixes fc518953bc9c8d7d ("mptcp: add and use MIB counter infrastructure")

Applied, thanks!