]> www.infradead.org Git - users/hch/xfs.git/commit
mptcp: count CLOSE-WAIT sockets for MPTCP_MIB_CURRESTAB
authorJason Xing <kernelxing@tencent.com>
Mon, 3 Jun 2024 17:02:17 +0000 (01:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2024 11:32:47 +0000 (12:32 +0100)
commit9633e9377e6af0244f7381e86b9aac5276f5be97
tree4cdda588b6ad4cc51b256f7a5494fdb693384e41
parenta46d0ea5c94205f40ecf912d1bb7806a8a64704f
mptcp: count CLOSE-WAIT sockets for MPTCP_MIB_CURRESTAB

Like previous patch does in TCP, we need to adhere to RFC 1213:

  "tcpCurrEstab OBJECT-TYPE
   ...
   The number of TCP connections for which the current state
   is either ESTABLISHED or CLOSE- WAIT."

So let's consider CLOSE-WAIT sockets.

The logic of counting
When we increment the counter?
a) Only if we change the state to ESTABLISHED.

When we decrement the counter?
a) if the socket leaves ESTABLISHED and will never go into CLOSE-WAIT,
say, on the client side, changing from ESTABLISHED to FIN-WAIT-1.
b) if the socket leaves CLOSE-WAIT, say, on the server side, changing
from CLOSE-WAIT to LAST-ACK.

Fixes: d9cd27b8cd19 ("mptcp: add CurrEstab MIB counter support")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c