Patch "mptcp: count CLOSE-WAIT sockets for MPTCP_MIB_CURRESTAB" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mptcp: count CLOSE-WAIT sockets for MPTCP_MIB_CURRESTAB

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mptcp-count-close-wait-sockets-for-mptcp_mib_currest.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d24c56ac9d2f8400d8ea97477f8a506c309e7def
Author: Jason Xing <kernelxing@xxxxxxxxxxx>
Date:   Tue Jun 4 01:02:17 2024 +0800

    mptcp: count CLOSE-WAIT sockets for MPTCP_MIB_CURRESTAB
    
    [ Upstream commit 9633e9377e6af0244f7381e86b9aac5276f5be97 ]
    
    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@xxxxxxxxxxx>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 618d80112d1e2..4ace52e4211ad 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2873,9 +2873,14 @@ void mptcp_set_state(struct sock *sk, int state)
 		if (oldstate != TCP_ESTABLISHED)
 			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB);
 		break;
-
+	case TCP_CLOSE_WAIT:
+		/* Unlike TCP, MPTCP sk would not have the TCP_SYN_RECV state:
+		 * MPTCP "accepted" sockets will be created later on. So no
+		 * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT.
+		 */
+		break;
 	default:
-		if (oldstate == TCP_ESTABLISHED)
+		if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT)
 			MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB);
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux