Re: Retrieving the network namespace of a socket

Sergey Ryazanov
2021-10-20T14:03:12Z

Hello Sargun,

On Wed, Oct 20, 2021 at 12:57 PM Sargun Dhillon <sargun@sargun.me> wrote:
> I'm working on a problem where I need to determine which network namespace a
> given socket is in. I can currently bruteforce this by using INET_DIAG, and
> enumerating namespaces and working backwards.

Namespace is not a per-socket, but a per-process attribute. So each
socket of a process belongs to the same namespace.

Could you elaborate what kind of problem you are trying to solve?
Maybe there is a more simple solution. for it.

--
Sergey