4

Is there a way to monitor netns creation/deletion in the kernel?

iproute2 provides means to monitor this but it does by using inotify, looking for creation/deletion of a netns fd in /var/run/netns. Often times a netns is created without an entry in /var/run/netns.

Ideally a netns creation/deletion notification should be available via netlink message from the kernel but it does not seem to be the case.

Watching for /proc/<pid> creation and then stat(ing) /proc/<pid>/ns/net does not seem like a feasible option.

chrk
  • 4,037
  • 2
  • 39
  • 47
NetCubist
  • 61
  • 2
  • 6

0 Answers0