chiark / gitweb /
Handle Unix domain socket connections from outside our namespace
authorEelco Dolstra <eelco.dolstra@logicblox.com>
Wed, 16 Apr 2014 16:39:07 +0000 (18:39 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 17 Apr 2014 02:24:28 +0000 (22:24 -0400)
commit9754d56e9b21bfe89fc18f47987d6bef491b8521
tree52e39e7fff1072ac25a23e8628a80c4d20d8c84d
parent5d2abc04fc95f5c5f6d0eaf2f9b06c70d504019f
Handle Unix domain socket connections from outside our namespace

NixOS uses Unix domain sockets for certain host <-> container
interaction; i.e. the host connects to a socket visible in the
container's directory tree, where the container uses a .socket unit to
spawn the handler program on demand. This worked in systemd 203, but
in 212 fails with "foo.socket failed to queue service startup job
(Maybe the service file is missing or not a template unit?): No data
available".

The reason is that getpeercred() now returns ENODATA if it can't get
the PID of the client, which happens in this case because the client
is not in the same PID namespace. Since getpeercred() is only used to
generate the instance name, this patch simply handles ENODATA by
creating an instance name "<nr>-unknown".

[zj: reorder clauses and remove (unsigned long) casts.]
src/core/socket.c