[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 04/06: service: No SO_REUSEADDR for AF_UNIX sockets.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 04/06: service: No SO_REUSEADDR for AF_UNIX sockets. |
Date: |
Mon, 1 Jan 2024 17:38:53 -0500 (EST) |
civodul pushed a commit to branch main
in repository shepherd.
commit 15eb04e82bbb195cac986d59f90df5bda153988a
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Jan 1 17:56:14 2024 +0100
service: No SO_REUSEADDR for AF_UNIX sockets.
This fixes execution on GNU/Hurd, where ‘setsockopt’ would return
ENOPROTOOPT.
* modules/shepherd/service.scm (endpoint->listening-socket): Do not set
SO_REUSEADDR on AF_UNIX sockets.
---
modules/shepherd/service.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 7130f37..2b8c025 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1857,7 +1857,11 @@ retrying to bind it in one second.")
(chown (dirname (sockaddr:path address)) owner group)
(catch-system-error (delete-file (sockaddr:path address))))
- (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
+ ;; SO_REUSEADDR appears to be undefined for AF_UNIX sockets; on
+ ;; GNU/Hurd, attempting to set it raises ENOPROTOOPT.
+ (unless (= AF_UNIX (sockaddr:fam address))
+ (setsockopt sock SOL_SOCKET SO_REUSEADDR 1))
+
(bind/retry-if-in-use sock address
#:max-attempts bind-attempts)
(listen sock backlog)
- [shepherd] branch main updated (07006e4 -> 520094a), Ludovic Courtès, 2024/01/01
- [shepherd] 02/06: tests: Deal with ‘setrlimit’ behavior on GNU/Hurd., Ludovic Courtès, 2024/01/01
- [shepherd] 01/06: tests: Check whether /proc/*/fd exists before relying on it., Ludovic Courtès, 2024/01/01
- [shepherd] 06/06: support: Update copyright year in ‘--version’ output., Ludovic Courtès, 2024/01/01
- [shepherd] 04/06: service: No SO_REUSEADDR for AF_UNIX sockets.,
Ludovic Courtès <=
- [shepherd] 03/06: service: Improve handling of the no-PR_SET_CHILD_SUBREAPER case., Ludovic Courtès, 2024/01/01
- [shepherd] 05/06: service: inetd: Clear O_NONBLOCK on the connection socket., Ludovic Courtès, 2024/01/01