prevent P25 response, unconfirmed, and AMBT packets from consuming the LLC send sequence; preserve N(S) and SYN advancement for new confirmed data packets only;

pull/138/head
Bryan Biedenkapp 3 days ago
parent ff2481f6db
commit 4399e46b9d

@ -1371,6 +1371,13 @@ void P25PacketData::dispatchToFNE(uint32_t peerId)
}
}
/* Determines whether an outbound PDU requires a new LLC send sequence. */
bool P25PacketData::requiresSendSequence(uint8_t format, bool retransmit)
{
return !retransmit && format == PDUFormatType::CONFIRMED;
}
/* Helper to dispatch PDU user data back to the local FNE network. (Will not transmit to neighbor FNE peers.) */
bool P25PacketData::dispatchUserFrameToFNE(DataHeader& dataHeader, bool extendedAddress, bool auxiliaryES, uint8_t* pduUserData, bool retransmit)
@ -1399,9 +1406,10 @@ bool P25PacketData::dispatchUserFrameToFNE(DataHeader& dataHeader, bool extended
return false;
}
// update V(S) only after a usable RF route has been selected; a retransmission
// keeps the N(S) already in its header, so the SU can discard a duplicate
if (!retransmit) {
// N(S) and SYN exist only in confirmed-data headers; Responses, unconfirmed
// data, and AMBT packets must not consume V(S); a retransmission keeps the
// N(S) already in its header so the SU can discard a duplicate
if (requiresSendSequence(dataHeader.getFormat(), retransmit)) {
bool synchronize = false;
uint8_t sendSequence = m_dataLinkManager.nextSendSequence(srcId, synchronize);
if (synchronize)

@ -36,6 +36,14 @@
#include <unordered_map>
#include <vector>
// ---------------------------------------------------------------------------
// Class Prototypes
// ---------------------------------------------------------------------------
#if defined(CATCH2_TEST_COMPILATION)
class FNETestHooks;
#endif
namespace network
{
namespace callhandler
@ -134,6 +142,9 @@ namespace network
void setDebug(bool debug) { m_debug = debug; }
private:
#if defined(CATCH2_TEST_COMPILATION)
friend class ::FNETestHooks;
#endif
TrafficNetwork* m_network;
TagP25Data* m_tag;
@ -288,6 +299,14 @@ namespace network
std::mutex m_sndcpPendingLock; // never nested with m_sndcpContextLock
std::unordered_map<uint32_t, SNDCPPendingAck> m_sndcpPending;
/**
* @brief Determines whether an outbound PDU requires a new LLC send sequence.
* @param format PDU header format.
* @param retransmit Flag indicating the PDU is a retransmission.
* @return True when the PDU requires a new send sequence; otherwise, false.
*/
static bool requiresSendSequence(uint8_t format, bool retransmit);
/**
* @brief Helper to refresh SNDCP state when a PDU is received from a subscriber.
* @param llId Logical Link ID of the SU.

@ -10,6 +10,7 @@
#include "fne/FNETestHooks.h"
#include "fne/HostFNE.h"
#include "fne/network/P25OTARService.h"
#include "fne/network/callhandler/packetdata/P25PacketData.h"
#include "fne/network/callhandler/TagP25Data.h"
#include "fne/network/callhandler/TagDMRData.h"
#include "fne/network/callhandler/TagP25P2Data.h"
@ -39,6 +40,13 @@ bool g_promiscuousHub = false;
// Public Class Members
// ---------------------------------------------------------------------------
/* Determines whether an outbound P25 PDU requires a new LLC send sequence. */
bool FNETestHooks::p25RequiresSendSequence(uint8_t format, bool retransmit)
{
return network::callhandler::packetdata::P25PacketData::requiresSendSequence(format, retransmit);
}
/* Tests whether a P25 frame is telephone interconnect traffic. */
bool FNETestHooks::isP25TelIntTraffic(TrafficNetwork& network, p25::lc::LC& control,

@ -81,6 +81,14 @@ public:
uint32_t peerId, uint32_t ssrc, uint32_t streamId, uint16_t pktSeq = 1U,
bool fromUpstream = false);
/**
* @brief Determines whether an outbound P25 PDU requires a new LLC send sequence.
* @param format PDU header format.
* @param retransmit Flag indicating the PDU is a retransmission.
* @return True when the PDU requires a new send sequence; otherwise, false.
*/
static bool p25RequiresSendSequence(uint8_t format, bool retransmit);
/**
* @brief Tests whether a P25 frame is classified as telephone interconnect traffic.
* @param network The TrafficNetwork instance.

@ -8,6 +8,7 @@
*
*/
#include "host/Defines.h"
#include "fne/FNETestHooks.h"
#include "common/p25/P25Defines.h"
#include "common/p25/data/ConventionalRegistration.h"
#include "common/p25/data/IPv4Packet.h"
@ -174,6 +175,15 @@ TEST_CASE("P25 LLC state is isolated by LLID", "[p25][packet-data][llc]")
CHECK_FALSE(links.hasState(1001U));
}
TEST_CASE("P25 LLC send sequences are assigned only to new confirmed PDUs", "[p25][packet-data][llc]")
{
CHECK(FNETestHooks::p25RequiresSendSequence(PDUFormatType::CONFIRMED, false));
CHECK_FALSE(FNETestHooks::p25RequiresSendSequence(PDUFormatType::CONFIRMED, true));
CHECK_FALSE(FNETestHooks::p25RequiresSendSequence(PDUFormatType::RSP, false));
CHECK_FALSE(FNETestHooks::p25RequiresSendSequence(PDUFormatType::UNCONFIRMED, false));
CHECK_FALSE(FNETestHooks::p25RequiresSendSequence(PDUFormatType::AMBT, false));
}
TEST_CASE("P25 LLC receive sequence wraps and suppresses duplicates", "[p25][packet-data][llc]")
{
DataLinkManager links;

Loading…
Cancel
Save

Powered by TurnKey Linux.