I would like to implement the functionality similar to pid file but for network namespace. In common file namespace the process can lock pid file and ensure that no other process is running in the same file name space just by checking that it can receive write permission on it. I would like to have the same but for network namespace.

Consider a situation where applications run in different filename spaces but in the same network space (like two containers bridged directly to the host machine network namespace).

Instead of pid I would like to assign each process some abstract instance. No two processes with the same instance id and sharing the same network namespace should be able to run simultaneously.

Bind on some port would not do, as many applications should be able to bind on on the same port.

I encountered the mroute socket however it is used by pimd daemon.

Any ideas?

  • Is your abstraction commonly called port, or am I missing something? – Rui F Ribeiro Mar 9 at 19:08
  • @RuiFRibeiro No it is not port. It is just some number which is assigned to process by means of configuration. No two processes with the same number may run in the same network namespace. – Boris Mar 9 at 21:02
  • Any reason you cannot mount a common subtree in all file namespaces, sharing the same network namespace, and put lock files for your instances in that subtree? – dirkt Mar 10 at 9:24

Seams like using bind on Unix domain socket in abstract namespace with name derived from abstract resource identifier is the way to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.