netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kuniyuki Iwashima <kuniyu@amazon.com>, dave.seddon.ca@gmail.com
Cc: netdev@vger.kernel.org, bpf <bpf@vger.kernel.org>
Subject: Re: tcp_diag for all network namespaces?
Date: Thu, 19 Dec 2024 10:11:44 -0800	[thread overview]
Message-ID: <97220e81-9835-4bd1-8cd2-15c2eda1dbfb@linux.dev> (raw)
In-Reply-To: <20241210020057.26127-1-kuniyu@amazon.com>

On 12/9/24 6:00 PM, Kuniyuki Iwashima wrote:
>> G'day,
>>
>> Short
>> Is there a way to extract tcp_diag socket data for all sockets from
>> all network name spaces please?
> I think there's no such interface.
> 
> I remember there was a similar request for TCP BPF iterator,
> but now it's difficult because each netns could have its own
> TCP hash table for established connections.

It would be nice to be able to iterate netns in bpf. There is a bpf task/file 
iterator that iterates tasks and all files under each task 
(tools/testing/selftests/bpf/progs/bpf_iter_task_file.c). The netns/sock 
iteration feels similar. The first step could be to allow bpf prog to iterate 
all netns first. Then it will allow bpf to inspect "struct net". There is also a 
newer open iterator approach in bpf which should be considered also.

  reply	other threads:[~2024-12-19 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 19:24 tcp_diag for all network namespaces? dave seddon
2024-12-10  2:00 ` Kuniyuki Iwashima
2024-12-19 18:11   ` Martin KaFai Lau [this message]
2024-12-10  5:17 ` Cong Wang
2024-12-10 20:45   ` Jay Vosburgh
2024-12-11  6:35     ` Xiao Liang
2024-12-11 17:28       ` Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97220e81-9835-4bd1-8cd2-15c2eda1dbfb@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=dave.seddon.ca@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).