[systemd-devel] [PATCH] Document CONFIG_NET_NS as a required kernel option

Lennart Poettering lennart at poettering.net
Thu Apr 10 13:00:53 PDT 2014


On Thu, 10.04.14 10:21, Thomas Bächler (thomas at archlinux.org) wrote:

> Am 10.04.2014 03:35, schrieb Lennart Poettering:
> >> Simply try:
> >>   int func(...) {
> >>      static bool network_namespace_warning = false;
> >>      ...
> >>
> >>      if (!network_namespace_warning) {
> >>          network_namespace_warning = true;
> >> 	 log_warn("...");
> >>      }
> >>   }
> >>
> >> Zbyszek
> > 
> > Hmm, so actually this is more complex than this, since the network
> > namespace stuff is done after we fork() before we exec() in the child
> > process. That means having this as static variable won't help, since you
> > could only set the copy, never the variable in the parent.
> 
> So, why not issue the warning while parsing the configuration, i.e.
> during daemon startup or reload?

Yeah, I thought about that too, but I couldn't think about a nice way to
detect this. However, now thinking about this again I think it might be
OK to do an access("/proc/self/ns/net, F_OK) should suffice. The
/proc/self/ns feature is newer than net namespaces, but that shouldn't
matter because to my knowledge both where available in 3.0 and we don't
support anything older anymore.

So, yeah, let's do this!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list