From 3f008343a4dcd51c29e53c71eee835e64cf53145 Mon Sep 17 00:00:00 2001 From: Jan Willamowius Date: Sat, 23 Mar 2019 14:54:23 +0100 Subject: [PATCH] fix for LCF caching --- RasTbl.cxx | 11 +++++++++++ RasTbl.h | 1 + docs/manual/neighbors.sgml | 5 +++++ gk.cxx | 1 + 4 files changed, 18 insertions(+) diff --git a/RasTbl.cxx b/RasTbl.cxx index b24c5c6e..eba36392 100644 --- a/RasTbl.cxx +++ b/RasTbl.cxx @@ -5954,6 +5954,7 @@ PreliminaryCall * PreliminaryCallTable::Find(const H225_CallIdentifier & id) con CallLoopTable::CallLoopTable() : Singleton("CallLoopTable") { m_expireTime = GkConfig()->GetInteger("RasSrv::LRQFeatures", "LoopDetectionExpireTime", 60); + m_reprocessLCFs = GkConfig()->GetInteger("RasSrv::LRQFeatures", "LoopDetectionReprocessLCFs", false); } CallLoopTable::~CallLoopTable() @@ -5980,6 +5981,16 @@ CallLoopTable::LoopResult CallLoopTable::IsLoop(const H225_LocationRequest & lrq return NoLoop; } if ((*iter).second.m_cachedLCF) { + if (m_reprocessLCFs) { + // reprocess all LCFs if switch is set + return NoLoop; + } + if (AsDotString((*iter).second.m_cachedLCF->m_rasAddress, false) == from + || AsDotString((*iter).second.m_cachedLCF->m_callSignalAddress, false) == from) { + // don't use a cached LCF if it points back to the sender + // must be a cached version for sender further down the stream + return NoLoop; + } cachedLCF = *(*iter).second.m_cachedLCF; return CachedLCF; } diff --git a/RasTbl.h b/RasTbl.h index 50b51a88..bca742e5 100644 --- a/RasTbl.h +++ b/RasTbl.h @@ -2347,6 +2347,7 @@ class CallLoopTable : public Singleton mutable PReadWriteMutex tableLock; std::map m_knownCalls; unsigned m_expireTime; + bool m_reprocessLCFs; }; #endif // RASTBL_H diff --git a/docs/manual/neighbors.sgml b/docs/manual/neighbors.sgml index 76040d02..cedfb093 100644 --- a/docs/manual/neighbors.sgml +++ b/docs/manual/neighbors.sgml @@ -195,6 +195,11 @@ Default: 60

Time duration in seconds how long to store data about calls GnuGk has seen. + +Default: 0 +

+Don't cache any LCFs in the loop detection. Use if cached LCFs with incorrect data (for another endpoint) break the routing. + diff --git a/gk.cxx b/gk.cxx index 1d1bf33b..af77ed96 100644 --- a/gk.cxx +++ b/gk.cxx @@ -533,6 +533,7 @@ const char * KnownConfigEntries[][2] = { { "RasSrv::LRQFeatures", "ForwardResponse" }, { "RasSrv::LRQFeatures", "LoopDetection" }, { "RasSrv::LRQFeatures", "LoopDetectionExpireTime" }, + { "RasSrv::LRQFeatures", "LoopDetectionReprocessLCFs" }, { "RasSrv::LRQFeatures", "LRQPingInterval" }, { "RasSrv::LRQFeatures", "NeighborTimeout" }, { "RasSrv::LRQFeatures", "PingAlias" },