From 6f67b462980d36ced3705b23c5c8c6a575844da2 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Thu, 2 Jul 2020 10:38:10 -0700 Subject: [PATCH 01/10] Fix orphaned Frame memory leak --- src/cprotocol.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/cprotocol.cpp b/src/cprotocol.cpp index 7fd4967..12661eb 100644 --- a/src/cprotocol.cpp +++ b/src/cprotocol.cpp @@ -19,7 +19,7 @@ // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with Foobar. If not, see . +// along with Foobar. If not, see . // ---------------------------------------------------------------------------- #include "main.h" @@ -52,7 +52,7 @@ CProtocol::~CProtocol() m_pThread->join(); delete m_pThread; } - + // empty queue m_Queue.Lock(); while ( !m_Queue.empty() ) @@ -69,13 +69,13 @@ bool CProtocol::Init(void) { // init reflector apparent callsign m_ReflectorCallsign = g_Reflector.GetCallsign(); - + // reset stop flag m_bStopThread = false; // start thread; m_pThread = new std::thread(CProtocol::Thread, this); - + // done return true; } @@ -138,7 +138,12 @@ void CProtocol::OnDvFramePacketIn(CDvFramePacket *Frame, const CIp *Ip) { // find the stream CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip); - if ( stream != NULL ) + if ( stream == NULL ) + { + std::cout << "Deleting oprhaned Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; + delete Frame; + } + else { //std::cout << "DV frame" << "from " << *Ip << std::endl; // and push @@ -152,13 +157,18 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip) { // find the stream CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip); - if ( stream != NULL ) + if ( stream == NULL ) + { + std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl; + delete Frame; + } + else { // push stream->Lock(); stream->Push(Frame); stream->Unlock(); - + // and close the stream g_Reflector.CloseStream(stream); } @@ -170,7 +180,7 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip) CPacketStream *CProtocol::GetStream(uint16 uiStreamId, const CIp *Ip) { CPacketStream *stream = NULL; - + // find if we have a stream with same streamid in our cache for ( int i = 0; (i < m_Streams.size()) && (stream == NULL); i++ ) { @@ -256,5 +266,3 @@ uint32 CProtocol::ModuleToDmrDestId(char m) const { return (uint32)(m - 'A')+1; } - - From 7fab6c2e661533e6261e81193dd5dcdaf0de79a0 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Mon, 27 Jul 2020 08:25:31 +0200 Subject: [PATCH 02/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef3f33a..265493d 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,6 @@ XLX Server requires the following ports to be open and forwarded properly for in Pay attention, the XLX Server acts as an YSF Master, which provides 26 wires-x rooms. It has nothing to do with the regular YSFReflector network, hence you don’t need to register your XLX at ysfreflector.de ! - +Nevertheless it is possible. © 2016 Jean-Luc Deltombe (LX3JL) and Luc Engelmann (LX1IQ) From fa7b3e80981fb72f1b21b0bffe8fd331299183f4 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sun, 2 Aug 2020 09:56:16 +0200 Subject: [PATCH 03/10] Create watchdog Small watchdog script to check the connectivity to the ambed hardware. If the usb port gets unresponsive and you get persistent timeouts. The script restarts the ambed service. You can run the script every "x" via a cronjob. --- scripts/watchdog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/watchdog diff --git a/scripts/watchdog b/scripts/watchdog new file mode 100644 index 0000000..4582bf0 --- /dev/null +++ b/scripts/watchdog @@ -0,0 +1,14 @@ +#!/bin/bash +sleep 5 +PATTERN=timed +FILE=/var/log/syslog +if grep -q $PATTERN $FILE; + then + echo "ambed timeout error" + > /var/log/syslog + service ambed restart + else + echo "all ok" + echo "Exiting..." + exit 0 +fi From 1ed96a16fd796d8e548e745cf67a0220add01f7b Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sun, 2 Aug 2020 10:02:00 +0200 Subject: [PATCH 04/10] Update scripts.readme.txt --- scripts/scripts.readme.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/scripts.readme.txt b/scripts/scripts.readme.txt index 4008da3..86bb307 100644 --- a/scripts/scripts.readme.txt +++ b/scripts/scripts.readme.txt @@ -1,11 +1,10 @@ ************************************************* -*copy xlxd into /etc.init.d/ -*copy ambed.service into /etc/systemd/system/ -* +*copy xlxd to /etc.init.d/ +*copy ambed.service to /etc/systemd/system/ +*copy watchdog to /ambed/ ************************************************* * xlxd executable must be in /xlxd/ folder * ambed executable must be in /ambed/ folder -* ************************************************* * possible options: * @@ -18,3 +17,10 @@ * #systemctl enable ambed * ************************************************* +* If your usb port gets unresponsive and you get some persistent timeouts, +* the watchdog script restarts the ambed service. +* You can run it every 5 minutes by a cronjob. +* +* */5 * * * * /ambed/./watchdog >> /ambed/watchdog.log +* +*************************************************** From 14ccc8bd0900e370b5874f49f59e54efb0bb04c6 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sat, 15 Aug 2020 10:17:14 +0200 Subject: [PATCH 05/10] Update index.php Hide liveirddb. Is usefull if you run your dashboard under https: --- dashboard/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dashboard/index.php b/dashboard/index.php index 56626e1..f72d7fb 100755 --- a/dashboard/index.php +++ b/dashboard/index.php @@ -139,7 +139,6 @@ else { Repeaters / Nodes (NodeCount(); ?>) Peers (PeerCount(); ?>) Reflectorlist - D-Star live Traffic statistics'; } + if ($PageOptions['IRCDDB']['Show']) { + echo ' + D-Star live'; + } ?> From 71a1ee556af1b0a7b1ffa898fedf9333d0a34c52 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sat, 15 Aug 2020 10:21:01 +0200 Subject: [PATCH 06/10] Update config.inc.php --- dashboard/pgs/config.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dashboard/pgs/config.inc.php b/dashboard/pgs/config.inc.php index 970671c..09f1a13 100755 --- a/dashboard/pgs/config.inc.php +++ b/dashboard/pgs/config.inc.php @@ -17,7 +17,7 @@ $VNStat = array(); $PageOptions['ContactEmail'] = 'your_email'; // Support E-Mail address -$PageOptions['DashboardVersion'] = '2.4.0'; // Dashboard Version +$PageOptions['DashboardVersion'] = '2.4.1'; // Dashboard Version $PageOptions['PageRefreshActive'] = true; // Activate automatic refresh $PageOptions['PageRefreshDelay'] = '10000'; // Page refresh time in miliseconds @@ -48,6 +48,7 @@ $PageOptions['MetaRobots'] = 'index,follow'; // $PageOptions['UserPage']['ShowFilter'] = true; // Show Filter on Users page $PageOptions['Traffic']['Show'] = false; // Enable vnstat traffic statistics +$PageOptions['IRCDDB']['Show'] = true; // Show liveircddb, set it to false if you are running your db in https $PageOptions['CustomTXT'] = ''; // custom text in your header From ff837885b02b851820c7cb8b2784a3036692372a Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sat, 15 Aug 2020 10:24:58 +0200 Subject: [PATCH 07/10] Update changes.txt --- dashboard/changes.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dashboard/changes.txt b/dashboard/changes.txt index 904cb77..5d18d53 100755 --- a/dashboard/changes.txt +++ b/dashboard/changes.txt @@ -1,3 +1,10 @@ +xlx db v2.4.1 + +you can now hide the liveircddb menu button, if you are running your db in https. + +- "config.inc.php +- "index.php" + xlx db v2.4.0 - "config.inc.php" @@ -91,7 +98,7 @@ xlx db v2.2.2 This version is a major release with voluntary self-registration feature build in. You need to edit the conf.inc.php to your needs. -On the first run your personal hash to access the database is place in the server’s /tmp folder. +On the first run your personal hash to access the database is place in the server’s /tmp folder. Take care to make a backup of this file because this folder is cleaned up after a server reboot. This version is a major release @@ -119,7 +126,7 @@ xlx db v2.1.4 - "class.reflector.php" improved the flag search - "country.csv" added serveral prefixes -- "flags" added Puerto Ricco and Åland Islands +- "flags" added Puerto Ricco and Ã…land Islands xlx db v2.1.3 From 49b16a7fa075af53f06f20d4c6074f1c8ef5e759 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sat, 22 Aug 2020 23:05:28 +0200 Subject: [PATCH 08/10] Update reflectors.php --- dashboard/pgs/reflectors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/pgs/reflectors.php b/dashboard/pgs/reflectors.php index 15318e2..d79ce5a 100755 --- a/dashboard/pgs/reflectors.php +++ b/dashboard/pgs/reflectors.php @@ -43,7 +43,7 @@ for ($i=0;$i'.($i+1).' '.$NAME.' '.$COUNTRY.' - + '.$COMMENT.' '; } From af900106c59c7b64f31bc3fb7d9fab0632c4c741 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Sat, 22 Aug 2020 23:06:14 +0200 Subject: [PATCH 09/10] Update reflectors.php --- dashboard2/pgs/reflectors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard2/pgs/reflectors.php b/dashboard2/pgs/reflectors.php index 8211315..f8e1adb 100644 --- a/dashboard2/pgs/reflectors.php +++ b/dashboard2/pgs/reflectors.php @@ -40,7 +40,7 @@ for ($i=0;$i'.($i+1).' '.$NAME.' '.$COUNTRY.' - + '.$COMMENT.' '; } From cb989fd8deb8a51fd851b3b3288bfb78c3c067ab Mon Sep 17 00:00:00 2001 From: LX3JL Date: Tue, 5 Jan 2021 10:36:36 +0100 Subject: [PATCH 10/10] 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 ---------------------------------------------------