From c3647a45cf19b5d3cb22f0e5c32133e0a0b66ccb Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 20 Apr 2020 23:13:51 +0200 Subject: [PATCH 01/13] Add terminal config to Makefile --- src/makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/makefile b/src/makefile index de1e0db..2d7b587 100644 --- a/src/makefile +++ b/src/makefile @@ -28,3 +28,6 @@ install: [ -f /xlxd/xlxd.interlink ] && \ cp ../config/xlxd.interlink /xlxd/xlxd.interlink.sample || \ cp ../config/xlxd.interlink /xlxd/xlxd.interlink + [ -f /xlxd/xlxd.terminal ] && \ + cp ../config/xlxd.terminal /xlxd/xlxd.terminal.sample || \ + cp ../config/xlxd.terminal /xlxd/xlxd.terminal From effd58b296ecd52693f7e0f464156c0a95cf241f Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Thu, 25 Jun 2020 07:30:48 +0300 Subject: [PATCH 02/13] Update class.reflector.php --- dashboard2/pgs/class.reflector.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index d6505f7..504fcfa 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -43,11 +43,11 @@ class xReflector { fclose($handle); $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { - $this->ServiceName = null; - return false; - } - +# XLX alphanumeric naming... By commenting the following four lines, it is possible to use an alphanumeric name for the reflector (eg: XLXABC) +# if (!is_numeric($this->ServiceName)) { +# $this->ServiceName = null; +# return false; +# } $this->ReflectorName = "XLX".$this->ServiceName; $LinkedPeersName = "XLX".$this->ServiceName." linked peers"; From 8d7cb4b605771f9a462a8ac39817163fca49ebcc Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Thu, 25 Jun 2020 07:32:12 +0300 Subject: [PATCH 03/13] Allows alphanumeric names for the reflector --- dashboard/pgs/class.reflector.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php index 6ec8a6e..4f5fb60 100755 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -43,10 +43,11 @@ class xReflector { fclose($handle); $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { - $this->ServiceName = null; - return false; - } +# XLX alphanumeric naming... By commenting the following four lines, it is possible to use an alphanumeric name for the reflector (eg: XLXABC) +# if (!is_numeric($this->ServiceName)) { +# $this->ServiceName = null; +# return false; +# } $this->ReflectorName = "XLX".$this->ServiceName; From 40e732bf7b04f9db89a34e4f18a95ada63a78171 Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Thu, 25 Jun 2020 07:33:33 +0300 Subject: [PATCH 04/13] Allows alphanumeric names for the reflector --- dashboard2/pgs/class.reflector.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index 504fcfa..f9cb053 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -48,6 +48,7 @@ class xReflector { # $this->ServiceName = null; # return false; # } + $this->ReflectorName = "XLX".$this->ServiceName; $LinkedPeersName = "XLX".$this->ServiceName." linked peers"; @@ -60,7 +61,8 @@ class xReflector { $tmpNodes = $XML->GetAllElements($AllNodesString, "NODE"); for ($i=0;$iGetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'), CreateCode(16)); + + $Node = new Node($XML->GetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'), CreateCode(16)); $this->AddNode($Node); } From 257d97c58350ac298c60f8952e7d65ca4111c5b6 Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Thu, 25 Jun 2020 07:39:49 +0300 Subject: [PATCH 05/13] Add alphanumeric name to reflector --- dashboard2/pgs/class.reflector.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index f9cb053..010c4b0 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -61,8 +61,7 @@ class xReflector { $tmpNodes = $XML->GetAllElements($AllNodesString, "NODE"); for ($i=0;$iGetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'), CreateCode(16)); + $Node = new Node($XML->GetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'), CreateCode(16)); $this->AddNode($Node); } From 40ce30446cfc0a5c11163b1ab63e250b0362cdad Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Thu, 25 Jun 2020 07:41:04 +0300 Subject: [PATCH 06/13] Allows alphanumeric names for the reflector --- dashboard2/pgs/class.reflector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index 010c4b0..beb5ae2 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -48,7 +48,7 @@ class xReflector { # $this->ServiceName = null; # return false; # } - +# $this->ReflectorName = "XLX".$this->ServiceName; $LinkedPeersName = "XLX".$this->ServiceName." linked peers"; From 220da86aa037f2b105a4742c8f9540c4dc95fade Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Thu, 8 Oct 2020 18:50:06 +0200 Subject: [PATCH 07/13] Avoid using public IP for transcoder connection --- src/ccodecstream.cpp | 2 +- src/ctranscoder.cpp | 2 +- src/cudpsocket.cpp | 7 ++++++- src/cudpsocket.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ccodecstream.cpp b/src/ccodecstream.cpp index 7d8e0c8..10d9a2b 100644 --- a/src/ccodecstream.cpp +++ b/src/ccodecstream.cpp @@ -99,7 +99,7 @@ bool CCodecStream::Init(uint16 uiPort) m_uiPort = uiPort; // create our socket - ok = m_Socket.Open(uiPort); + ok = m_Socket.Open(CIp("0.0.0.0"), uiPort); if ( ok ) { // start thread; diff --git a/src/ctranscoder.cpp b/src/ctranscoder.cpp index 6b810c9..36faa8a 100644 --- a/src/ctranscoder.cpp +++ b/src/ctranscoder.cpp @@ -97,7 +97,7 @@ bool CTranscoder::Init(void) m_Ip = g_Reflector.GetTranscoderIp(); // create our socket - ok = m_Socket.Open(TRANSCODER_PORT); + ok = m_Socket.Open(CIp("0.0.0.0"), TRANSCODER_PORT); if ( ok ) { // start thread; diff --git a/src/cudpsocket.cpp b/src/cudpsocket.cpp index 5caa074..b528ffa 100644 --- a/src/cudpsocket.cpp +++ b/src/cudpsocket.cpp @@ -51,6 +51,11 @@ CUdpSocket::~CUdpSocket() // open & close bool CUdpSocket::Open(uint16 uiPort) +{ + return Open(g_Reflector.GetListenIp(), uiPort); +} + +bool CUdpSocket::Open(const CIp & listenIp, uint16 uiPort) { bool open = false; @@ -62,7 +67,7 @@ bool CUdpSocket::Open(uint16 uiPort) ::memset(&m_SocketAddr, 0, sizeof(struct sockaddr_in)); m_SocketAddr.sin_family = AF_INET; m_SocketAddr.sin_port = htons(uiPort); - m_SocketAddr.sin_addr.s_addr = inet_addr(g_Reflector.GetListenIp()); + m_SocketAddr.sin_addr.s_addr = inet_addr(listenIp); if ( bind(m_Socket, (struct sockaddr *)&m_SocketAddr, sizeof(struct sockaddr_in)) == 0 ) { diff --git a/src/cudpsocket.h b/src/cudpsocket.h index e91ed80..bb28fc1 100644 --- a/src/cudpsocket.h +++ b/src/cudpsocket.h @@ -56,6 +56,7 @@ public: // open & close bool Open(uint16); + bool Open(const CIp &, uint16); void Close(void); int GetSocket(void) { return m_Socket; } From cb989fd8deb8a51fd851b3b3288bfb78c3c067ab Mon Sep 17 00:00:00 2001 From: LX3JL Date: Tue, 5 Jan 2021 10:36:36 +0100 Subject: [PATCH 08/13] xlxd 2.4.1 Corrected bug : last packets of a stream are sent back to sender --- src/cg3protocol.cpp | 4 +++- src/cprotocol.cpp | 14 +++++++++----- src/main.h | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) mode change 100644 => 100755 src/cg3protocol.cpp mode change 100644 => 100755 src/cprotocol.cpp mode change 100644 => 100755 src/main.h diff --git a/src/cg3protocol.cpp b/src/cg3protocol.cpp old mode 100644 new mode 100755 index 053da9d..9f85420 --- a/src/cg3protocol.cpp +++ b/src/cg3protocol.cpp @@ -69,6 +69,7 @@ bool CG3Protocol::Init(void) std::cout << "Error opening socket on port UDP" << G3_CONFIG_PORT << " on ip " << g_Reflector.GetListenIp() << std::endl; } +#ifndef DEBUG_NO_G3_ICMP_SOCKET ok &= m_IcmpRawSocket.Open(IPPROTO_ICMP); if ( !ok ) { @@ -82,7 +83,8 @@ bool CG3Protocol::Init(void) m_pPresenceThread = new std::thread(ConfigThread, this); m_pPresenceThread = new std::thread(IcmpThread, this); } - +#endif + // update time m_LastKeepaliveTime.Now(); diff --git a/src/cprotocol.cpp b/src/cprotocol.cpp old mode 100644 new mode 100755 index 12661eb..6054971 --- a/src/cprotocol.cpp +++ b/src/cprotocol.cpp @@ -140,7 +140,7 @@ void CProtocol::OnDvFramePacketIn(CDvFramePacket *Frame, const CIp *Ip) CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip); if ( stream == NULL ) { - std::cout << "Deleting oprhaned Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; + // std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; delete Frame; } else @@ -159,7 +159,7 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip) CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip); if ( stream == NULL ) { - std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; + // std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; delete Frame; } else @@ -168,9 +168,12 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip) stream->Lock(); stream->Push(Frame); stream->Unlock(); - - // and close the stream - g_Reflector.CloseStream(stream); + + // and don't close the stream yet but rely on CheckStreamsTimeout + // mechanism, so the stream will be closed after the queues have + // been sinked out. This avoid last packets to be send back + // to transmitting client (master) + // g_Reflector.CloseStream(stream); } } @@ -266,3 +269,4 @@ uint32 CProtocol::ModuleToDmrDestId(char m) const { return (uint32)(m - 'A')+1; } + diff --git a/src/main.h b/src/main.h old mode 100644 new mode 100755 index 03c3af1..7127e39 --- a/src/main.h +++ b/src/main.h @@ -49,7 +49,7 @@ #define VERSION_MAJOR 2 #define VERSION_MINOR 4 -#define VERSION_REVISION 0 +#define VERSION_REVISION 1 // global ------------------------------------------------------ @@ -60,6 +60,7 @@ //#define DEBUG_NO_ERROR_ON_XML_OPEN_FAIL //#define DEBUG_DUMPFILE +//#define DEBUG_NO_G3_ICMP_SOCKET // reflector --------------------------------------------------- From a8153d8ae525ac62f7bf10062a78cda945972467 Mon Sep 17 00:00:00 2001 From: "Marius Petrescu, YO2LOJ" Date: Sat, 16 Jan 2021 01:43:05 +0200 Subject: [PATCH 09/13] Update buffer allocation to the correct size Maximum size of ICMP packet is 64k while buffer allocation was UDP_BUFFER_LENMAX, while read was up to 64k. This will cause a crash on read in the subsequent read for packets with length greater than UDP_BUFFER_LENMAX via a buffer overflow. --- src/crawsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crawsocket.cpp b/src/crawsocket.cpp index a30908d..119dbb1 100644 --- a/src/crawsocket.cpp +++ b/src/crawsocket.cpp @@ -92,7 +92,7 @@ int CRawSocket::Receive(CBuffer *Buffer, CIp *Ip, int timeout) if ( m_Socket != -1 ) { // allocate buffer - Buffer->resize(UDP_BUFFER_LENMAX); + Buffer->resize(RAW_BUFFER_LENMAX); // control socket FD_ZERO(&FdSet); From ac3f9e4ad216938085c8210bb545b4c4fc93056f Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Mon, 18 Jan 2021 11:34:52 +0200 Subject: [PATCH 10/13] Update class.reflector.php --- dashboard/pgs/class.reflector.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php index 4f5fb60..d545e99 100755 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -41,9 +41,15 @@ class xReflector { $handle = fopen($this->XMLFile, 'r'); $this->XMLContent = fread($handle, filesize($this->XMLFile)); fclose($handle); - + + # XLX alphanumeric naming... $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName) == 1) { + $this->ServiceName = null; + return false; + } + +# $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { # $this->ServiceName = null; # return false; From c69651ccb2c571fccdf2d9b85345179f60d30c36 Mon Sep 17 00:00:00 2001 From: Catalin Vatra Date: Mon, 18 Jan 2021 11:35:36 +0200 Subject: [PATCH 11/13] Update class.reflector.php --- dashboard2/pgs/class.reflector.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index beb5ae2..4a2c246 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -41,9 +41,15 @@ class xReflector { $handle = fopen($this->XMLFile, 'r'); $this->XMLContent = fread($handle, filesize($this->XMLFile)); fclose($handle); - + +# XLX alphanumeric naming... $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName) == 1) { + $this->ServiceName = null; + return false; + } + +# $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { # $this->ServiceName = null; # return false; From f3dd52d08a74238b68d05ba41b0156f26c318442 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Mon, 18 Jan 2021 11:53:35 +0100 Subject: [PATCH 12/13] Update class.reflector.php --- dashboard/pgs/class.reflector.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php index d545e99..099599c 100755 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -49,12 +49,6 @@ class xReflector { return false; } -# $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { -# $this->ServiceName = null; -# return false; -# } - $this->ReflectorName = "XLX".$this->ServiceName; $LinkedPeersName = "XLX".$this->ServiceName." linked peers"; From c22c7f01e6633408a1b5d1e9c36be855552820fa Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Mon, 18 Jan 2021 11:54:28 +0100 Subject: [PATCH 13/13] Update class.reflector.php --- dashboard2/pgs/class.reflector.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index 4a2c246..2d29483 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -49,12 +49,6 @@ class xReflector { return false; } -# $this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "ServiceName)) { -# $this->ServiceName = null; -# return false; -# } -# $this->ReflectorName = "XLX".$this->ServiceName; $LinkedPeersName = "XLX".$this->ServiceName." linked peers";