[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJh5S=Rmq23SZGCsECUdvmuD22O18rNA=-Z1782BoyMNQ@mail.gmail.com>
Date: Fri, 31 May 2024 08:23:52 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Jason Xing <kerneljasonxing@...il.com>
Cc: kuba@...nel.org, pabeni@...hat.com, davem@...emloft.net,
dsahern@...nel.org, matttbe@...nel.org, martineau@...nel.org,
geliang@...nel.org, netdev@...r.kernel.org, mptcp@...ts.linux.dev,
Jason Xing <kernelxing@...cent.com>
Subject: Re: [PATCH net v3 1/2] tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB
On Thu, May 30, 2024 at 3:13 PM Jason Xing <kerneljasonxing@...il.com> wrote:
>
> From: Jason Xing <kernelxing@...cent.com>
>
> According to RFC 1213, we should also take CLOSE-WAIT sockets into
> consideration:
>
> "tcpCurrEstab OBJECT-TYPE
> ...
> The number of TCP connections for which the current state
> is either ESTABLISHED or CLOSE- WAIT."
>
> After this, CurrEstab counter will display the total number of
> ESTABLISHED and CLOSE-WAIT sockets.
>
> The logic of counting
> When we increment the counter?
> a) if we change the state to ESTABLISHED.
> b) if we change the state from SYN-RECEIVED to CLOSE-WAIT.
>
> 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.
>
> Please note: there are two chances that old state of socket can be changed
> to CLOSE-WAIT in tcp_fin(). One is SYN-RECV, the other is ESTABLISHED.
> So we have to take care of the former case.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Jason Xing <kernelxing@...cent.com>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Thanks.
Powered by blists - more mailing lists