Fix DTLS with systemd socket activation

Remove IPV6_V6ONLY flag from per-client UDP sockets as it prevents
IPv4 traffic on systemd-provided IPv6 sockets. This was a legacy
from the old reopen_udp_port() code and is no longer needed.

Fixes: #647

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
This commit is contained in:
Grigory Trenin
2025-12-01 18:16:22 -05:00
committed by Nikos Mavrogiannopoulos
parent 9833ca4789
commit 3892e032d9
2 changed files with 5 additions and 18 deletions

1
NEWS
View File

@@ -8,6 +8,7 @@
- Fixed 'iroute' option processing to handle multiple routes (#625)
- occtl: fix invalid JSON output in `occtl -j show iroutes` (#661)
- occtl: fix regression with trailing commas in `occtl -j show sessions` (#669)
- Fixed DTLS not working with systemd socket activation (#647)
* Version 1.3.0 (released 2024-05-05)
- Switch to https://github.com/nodejs/llhttp from http-parser.

View File

@@ -423,21 +423,8 @@ static int listen_ports(void *pool, struct perm_cfg_st *config,
* worker */
static void set_worker_udp_opts(main_server_st *s, int fd, int family)
{
int y;
int y = 1;
#ifdef IPV6_V6ONLY
if (family == AF_INET6) {
y = 1;
/* avoid listen on ipv6 addresses failing
* because already listening on ipv4 addresses: */
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void *)&y,
sizeof(y)) < 0) {
perror("setsockopt(IPV6_V6ONLY) failed");
}
}
#endif
y = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&y,
sizeof(y)) < 0) {
perror("setsockopt(SO_REUSEADDR) failed");
@@ -810,10 +797,9 @@ static int forward_udp_to_owner(main_server_st *s, struct listener_st *listener)
e = errno;
mslog(s, proc_to_send, LOG_INFO,
"bind UDP to %s: %s",
human_addr(
(struct sockaddr *)&listener->addr,
listener->addr_len, tbuf,
sizeof(tbuf)),
human_addr((struct sockaddr *)&our_addr,
our_addr_size, tbuf,
sizeof(tbuf)),
strerror(e));
}
}