X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fsocket.c;h=1cd98e29920cf14769d083b2332091d5038dc73a;hp=aeedcbd7f3719eb26aaac4e524249769b9557568;hb=75c8e3cffd7da8eede614cf61384957af2c82a29;hpb=6bda96a0234e2d3d61bc36de99c19a9293721fef diff --git a/src/socket.c b/src/socket.c index aeedcbd7f..1cd98e299 100644 --- a/src/socket.c +++ b/src/socket.c @@ -417,6 +417,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { "%sTransparent: %s\n" "%sBroadcast: %s\n" "%sPassCredentials: %s\n" + "%sPassSecurity: %s\n" "%sTCPCongestion: %s\n", prefix, socket_state_to_string(s->state), prefix, socket_result_to_string(s->result), @@ -429,6 +430,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { prefix, yes_no(s->transparent), prefix, yes_no(s->broadcast), prefix, yes_no(s->pass_cred), + prefix, yes_no(s->pass_sec), prefix, strna(s->tcp_congestion)); if (s->control_pid > 0) @@ -562,7 +564,8 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { b = ntohl(remote.in.sin_addr.s_addr); if (asprintf(&r, - "%u.%u.%u.%u:%u-%u.%u.%u.%u:%u", + "%u-%u.%u.%u.%u:%u-%u.%u.%u.%u:%u", + nr, a >> 24, (a >> 16) & 0xFF, (a >> 8) & 0xFF, a & 0xFF, ntohs(local.in.sin_port), b >> 24, (b >> 16) & 0xFF, (b >> 8) & 0xFF, b & 0xFF, @@ -584,7 +587,8 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { *b = remote.in6.sin6_addr.s6_addr+12; if (asprintf(&r, - "%u.%u.%u.%u:%u-%u.%u.%u.%u:%u", + "%u-%u.%u.%u.%u:%u-%u.%u.%u.%u:%u", + nr, a[0], a[1], a[2], a[3], ntohs(local.in6.sin6_port), b[0], b[1], b[2], b[3], @@ -594,7 +598,8 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { char a[INET6_ADDRSTRLEN], b[INET6_ADDRSTRLEN]; if (asprintf(&r, - "%s:%u-%s:%u", + "%u-%s:%u-%s:%u", + nr, inet_ntop(AF_INET6, &local.in6.sin6_addr, a, sizeof(a)), ntohs(local.in6.sin6_port), inet_ntop(AF_INET6, &remote.in6.sin6_addr, b, sizeof(b)), @@ -676,6 +681,12 @@ static void socket_apply_socket_options(Socket *s, int fd) { log_warning("SO_PASSCRED failed: %m"); } + if (s->pass_sec) { + int one = 1; + if (setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)) < 0) + log_warning("SO_PASSSEC failed: %m"); + } + if (s->priority >= 0) if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &s->priority, sizeof(s->priority)) < 0) log_warning("SO_PRIORITY failed: %m"); @@ -1483,7 +1494,6 @@ static void socket_enter_running(Socket *s, int cfd) { fail: log_warning("%s failed to queue socket startup job: %s", UNIT(s)->id, bus_error(&error, r)); - socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); if (cfd >= 0) close_nointr_nofail(cfd);