mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
core: pass the socket cookie to invoked per-connection service instances as $SO_COOKIE env var
The socket cookie is just too useful for identifying connections, let's emphasize this a bit and pass it as environment variable.
This commit is contained in:
@@ -425,13 +425,19 @@
|
||||
above for a more detailed discussion of the naming rules of triggered services.</para>
|
||||
|
||||
<para>For IPv4 and IPv6 connections, the <varname>$REMOTE_ADDR</varname> environment variable will
|
||||
contain the remote IP address, and <varname>$REMOTE_PORT</varname> will contain the remote port. This
|
||||
is the same as the format used by CGI.</para>
|
||||
contain the remote IP address, and <varname>$REMOTE_PORT</varname> will contain the remote port
|
||||
number. These two variables correspond to those defined by the CGI interface for web services (see
|
||||
<ulink url="https://datatracker.ietf.org/doc/html/rfc3875">RFC 3875</ulink>).</para>
|
||||
|
||||
<para>For <constant>AF_UNIX</constant> socket connections, the <varname>$REMOTE_ADDR</varname>
|
||||
environment variable will contain either the remote socket's file system path starting with a slash
|
||||
(<literal>/</literal>) or its address in the abstract namespace starting with an at symbol
|
||||
(<literal>@</literal>). If the socket is unnamed, <varname>$REMOTE_ADDR</varname> will not be set.</para>
|
||||
(<literal>@</literal>). If the socket is unnamed, <varname>$REMOTE_ADDR</varname> will not be
|
||||
set.</para>
|
||||
|
||||
<para>The <varname>$SO_COOKIE</varname> environment variable is set to the Linux socket cookie,
|
||||
formatted as decimal integer. The socket cookie can otherwise be acquired via <citerefentry
|
||||
project='man-pages'><refentrytitle>getsockopt</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
||||
|
||||
<para>It is recommended to set <varname>CollectMode=inactive-or-failed</varname> for service
|
||||
instances activated via <varname>Accept=yes</varname>, to ensure that failed connection services are
|
||||
|
||||
Reference in New Issue
Block a user