From eb20786f3659847f3366ed2e5c0d3a02127d7f4c Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 23 Oct 2019 20:01:03 +0900 Subject: [PATCH] set INADDR_ANY/IN6ADDR_ANY_INIT address string to m_socket when CUDPSocket::open() is called with m_address (in CUDPSocket) is nothing, IPv4 socket is created by "0.0.0.0" (INADDR_ANY) address. This causes a bug that DMRGateway cannot connect to reflector on IPv6. Avoid this problem, set IP address string to m_socket (in CDMRNetwork) before calling CUDPSocket::open(). This is a workaround, I think there is better idea. --- DMRNetwork.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index 06885d3..a7fecea 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -58,6 +58,8 @@ m_beacon(false) assert(version != NULL); CUDPSocket::lookup(address, port, m_address, m_addrlen); + CUDPSocket temp(m_address.ss_family == AF_INET ? "0.0.0.0" : "::", port); + m_socket = temp; // INADDR_ANY or IN6ADDR_ANY_INIT m_buffer = new unsigned char[BUFFER_LENGTH]; m_salt = new unsigned char[sizeof(uint32_t)];