From 9cc2e7ad43aa26f4f6c024da21954284a6f5f320 Mon Sep 17 00:00:00 2001 From: Pavel Koveshnikov Date: Mon, 6 Jan 2025 01:16:04 -0500 Subject: [PATCH] Proposed fix for issue #59 in upstream --- include/enet.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/enet.h b/include/enet.h index 7a9afc7..6d9f5e2 100644 --- a/include/enet.h +++ b/include/enet.h @@ -5655,8 +5655,15 @@ extern "C" { if (address != NULL) { address->host = sin.sin6_addr; - address->port = ENET_NET_TO_HOST_16(sin.sin6_port); address->sin6_scope_id = sin.sin6_scope_id; + if (sin.sin6_family == AF_INET || (sin.sin6_family == AF_UNSPEC && sin.sin6_len == sizeof(struct sockaddr_in))) + { + enet_inaddr_map4to6(((struct sockaddr_in*)&sin)->sin_addr, &address->host); + address->sin6_scope_id = 0; + } + + address->port = ENET_NET_TO_HOST_16(sin.sin6_port); + } return recvLength;