+22 August 2022: Wouter
+ - Fix #741: systemd socket activation fails on IPv6.
+
12 August 2022: Wouter
- Fix to log accept error ENFILE and EMFILE errno, but slowly, once
per 10 seconds. Also log accept failures when no slow down is used.
int action;
# endif
# if defined(IPV6_V6ONLY)
- if(v6only) {
+ if(v6only
+# ifdef HAVE_SYSTEMD
+ /* Systemd wants to control if the socket is v6 only
+ * or both, with BindIPv6Only=default, ipv6-only or
+ * both in systemd.socket, so it is not set here. */
+ && !got_fd_from_systemd
+# endif
+ ) {
int val=(v6only==2)?0:1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
(void*)&val, (socklen_t)sizeof(val)) < 0) {
(void)reuseport;
#endif /* defined(SO_REUSEPORT) */
#if defined(IPV6_V6ONLY)
- if(addr->ai_family == AF_INET6 && v6only) {
+ if(addr->ai_family == AF_INET6 && v6only
+# ifdef HAVE_SYSTEMD
+ /* Systemd wants to control if the socket is v6 only
+ * or both, with BindIPv6Only=default, ipv6-only or
+ * both in systemd.socket, so it is not set here. */
+ && !got_fd_from_systemd
+# endif
+ ) {
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
(void*)&on, (socklen_t)sizeof(on)) < 0) {
log_err("setsockopt(..., IPV6_V6ONLY, ...) failed: %s",