From 99b3c15b33a4d16b632cb2393695a74c76c66da7 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 5 Nov 2020 09:51:05 +0000 Subject: [PATCH] Alter the way that the P25 Network is opened for IPv4 and IPv6. --- P25Gateway/P25Network.cpp | 13 +++++++++---- P25Gateway/Version.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/P25Gateway/P25Network.cpp b/P25Gateway/P25Network.cpp index 489df91..18425a3 100644 --- a/P25Gateway/P25Network.cpp +++ b/P25Gateway/P25Network.cpp @@ -43,11 +43,16 @@ bool CP25Network::open() { LogInfo("Opening P25 network connection"); - bool ret = m_socket.open(0, PF_INET, "", m_port); - if (!ret) - return false; + unsigned int index = 0U; - return m_socket.open(1, PF_INET6, "", m_port); + bool ret1 = m_socket.open(index, PF_INET, "", m_port); + if (ret1) + index++; + + bool ret2 = m_socket.open(index, PF_INET6, "", m_port); + + // We're OK as long as we have either IPv4 or IPv6 or both. + return ret1 || ret2; } bool CP25Network::write(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen) diff --git a/P25Gateway/Version.h b/P25Gateway/Version.h index 1ac5058..bdd396f 100644 --- a/P25Gateway/Version.h +++ b/P25Gateway/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20201104"; +const char* VERSION = "20201105"; #endif