Subject: bug#55335: [PATCH] services: Allow shepherd to listen for IPv6 connections to openssh.

From: Jack Hill <[email-masked]>
Date: Fri, 13 May 2022 11:23:18 -0400 (EDT)

Thanks for looking into this! Does this fix work for you (I assume so)? I 
tried a simpler patch to use a v6 socket:

--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -535,7 +535,7 @@ (define openssh-command
           (start #~(if (defined? 'make-inetd-constructor)
                        (make-inetd-constructor
                         (append #$openssh-command '("-i"))
-                       (make-socket-address AF_INET INADDR_ANY
+                       (make-socket-address AF_INET6 INADDR_ANY
                                              #$port-number)
                         #:max-connections #$max-connections)
                        (make-forkexec-constructor #$openssh-command

and that does indeed produce a v6 socket that also accepts v4 connection. 
The output of `ss -tulpen`:

tcp       LISTEN     0          10 
*:22                       *:*         users:(("shepherd",pid=1,fd=29)) ino:1522146 sk:2001 cgroup:/ v6only:0 <->

However, while ssh is now able to connect to the socket, something is 
going wrong in the handoff to sshd. I see the following message printed on 
the console when trying to connect:

Uncaught exception in task:
In fibers.scm:
   150:8 4 (_)
In shepherd/service.scm:
   1435:21 3 (_)
   1280:30 2 (socket-address->string #(10 # 37896 0 0))
In unknown file:
           1 (inet-ntop 2 42540578165178177408896616697074944157)
In ice-9/boot-9.scm:
   1685:16 0 (raise-exception _ #:continualbe? _)
ice-9/boot-9.scm:1685:16: In procecure raise-exception:
Value our of range 0 to 18446744073709551615: 42540578165178177408896616697074944157

Best,
Jack