[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+sqG+T7LNxXhB-KHM-c7DU2v__vEbiV1_DJV7tkuEaGg@mail.gmail.com>
Date: Tue, 28 Nov 2023 11:14:28 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Guillaume Nault <gnault@...hat.com>
Cc: David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
David Ahern <dsahern@...nel.org>, Kuniyuki Iwashima <kuniyu@...zon.com>,
Michal Kubecek <mkubecek@...e.cz>
Subject: Re: [PATCH net-next v2] tcp: Dump bound-only sockets in inet_diag.
On Fri, Nov 24, 2023 at 12:11 AM Guillaume Nault <gnault@...hat.com> wrote:
>
> Walk the hashinfo->bhash2 table so that inet_diag can dump TCP sockets
> that are bound but haven't yet called connect() or listen().
>
> This allows ss to dump bound-only TCP sockets, together with listening
> sockets (as there's no specific state for bound-only sockets). This is
> similar to the UDP behaviour for which bound-only sockets are already
> dumped by ss -lu.
>
> The code is inspired by the ->lhash2 loop. However there's no manual
> test of the source port, since this kind of filtering is already
> handled by inet_diag_bc_sk(). Also, a maximum of 16 sockets are dumped
> at a time, to avoid running with bh disabled for too long.
>
> No change is needed for ss. With an IPv4, an IPv6 and an IPv6-only
> socket, bound respectively to 40000, 64000, 60000, the result is:
>
> $ ss -lt
> State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
> UNCONN 0 0 0.0.0.0:40000 0.0.0.0:*
> UNCONN 0 0 [::]:60000 [::]:*
> UNCONN 0 0 *:64000 *:*
Hmm... "ss -l" is supposed to only list listening sockets.
So this change might confuse some users ?
Powered by blists - more mailing lists