From b726458ab903ddf8805540a8d32e5cdcf7e545d9 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Thu, 16 Oct 2025 10:31:21 -0500 Subject: [PATCH] The NDPU priority is now passed through the stack via apdu.c or h_apdu.c module so the MS/TP compare DER function can include the value in the comparison. (#1119) --- CHANGELOG.md | 2 ++ ports/at91sam7s/dlmstp.c | 4 ---- ports/bdk-atxx4-mstp/dlmstp.c | 4 ---- ports/bsd/dlmstp.c | 8 ++------ ports/bsd/dlmstp_port.c | 8 ++------ ports/linux/dlmstp.c | 8 ++------ ports/linux/dlmstp_port.c | 8 ++------ ports/pic18f6720/mstp.c | 4 ---- ports/pic18f97j60/mstp.c | 4 ---- ports/win32/dlmstp-mm.c | 4 ---- ports/win32/dlmstp.c | 4 ---- src/bacnet/datalink/dlmstp.c | 4 ---- 12 files changed, 10 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0e6694c..5b92b45c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,6 +132,8 @@ The git repositories are hosted at the following sites: ### Fixed +* Fixed the MS/TP compare DER function which can now include the NPDU network + priority in the comparison. (#1119) * Fixed basic program object internal datatype for reason-for-fault and change properties. (#1110) * Fixed compile errors in basic/server/device when BACAPP_TIMESTAMP diff --git a/ports/at91sam7s/dlmstp.c b/ports/at91sam7s/dlmstp.c index f3cf8c98..752ca247 100644 --- a/ports/at91sam7s/dlmstp.c +++ b/ports/at91sam7s/dlmstp.c @@ -285,13 +285,9 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu, reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/ports/bdk-atxx4-mstp/dlmstp.c b/ports/bdk-atxx4-mstp/dlmstp.c index e1b9a0aa..8960a980 100644 --- a/ports/bdk-atxx4-mstp/dlmstp.c +++ b/ports/bdk-atxx4-mstp/dlmstp.c @@ -286,13 +286,9 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu, reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/ports/bsd/dlmstp.c b/ports/bsd/dlmstp.c index a8ed2f58..5d2f0709 100644 --- a/ports/bsd/dlmstp.c +++ b/ports/bsd/dlmstp.c @@ -292,15 +292,11 @@ static bool dlmstp_compare_data_expecting_reply( "NPDU Protocol Version mismatch.\n"); return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { - debug_printf( - "DLMSTP: DER Compare failed: " "NPDU Priority mismatch.\n"); + debug_printf("DLMSTP: DER Compare failed: " + "NPDU Priority mismatch.\n"); return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { debug_printf("DLMSTP: DER Compare failed: " "BACnet Address mismatch.\n"); diff --git a/ports/bsd/dlmstp_port.c b/ports/bsd/dlmstp_port.c index 917552f8..0ec0c9b5 100644 --- a/ports/bsd/dlmstp_port.c +++ b/ports/bsd/dlmstp_port.c @@ -563,15 +563,11 @@ static bool dlmstp_compare_data_expecting_reply( "NPDU Protocol Version mismatch.\n"); return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { - debug_printf( - "DLMSTP: DER Compare failed: " "NPDU Priority mismatch.\n"); + debug_printf("DLMSTP: DER Compare failed: " + "NPDU Priority mismatch.\n"); return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { debug_printf("DLMSTP: DER Compare failed: " "BACnet Address mismatch.\n"); diff --git a/ports/linux/dlmstp.c b/ports/linux/dlmstp.c index 06b9087c..4a504ced 100644 --- a/ports/linux/dlmstp.c +++ b/ports/linux/dlmstp.c @@ -293,15 +293,11 @@ static bool dlmstp_compare_data_expecting_reply( "NPDU Protocol Version mismatch.\n"); return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { - debug_printf( - "DLMSTP: DER Compare failed: " "NPDU Priority mismatch.\n"); + debug_printf("DLMSTP: DER Compare failed: " + "NPDU Priority mismatch.\n"); return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { debug_printf("DLMSTP: DER Compare failed: " "BACnet Address mismatch.\n"); diff --git a/ports/linux/dlmstp_port.c b/ports/linux/dlmstp_port.c index 341845e3..120a7e6b 100644 --- a/ports/linux/dlmstp_port.c +++ b/ports/linux/dlmstp_port.c @@ -507,15 +507,11 @@ static bool dlmstp_compare_data_expecting_reply( "NPDU Protocol Version mismatch.\n"); return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { - debug_printf( - "DLMSTP: DER Compare failed: " "NPDU Priority mismatch.\n"); + debug_printf("DLMSTP: DER Compare failed: " + "NPDU Priority mismatch.\n"); return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { debug_printf("DLMSTP: DER Compare failed: " "BACnet Address mismatch.\n"); diff --git a/ports/pic18f6720/mstp.c b/ports/pic18f6720/mstp.c index 7afd1c5a..46326782 100644 --- a/ports/pic18f6720/mstp.c +++ b/ports/pic18f6720/mstp.c @@ -607,13 +607,9 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu, reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/ports/pic18f97j60/mstp.c b/ports/pic18f97j60/mstp.c index 38043746..57d3fb75 100644 --- a/ports/pic18f97j60/mstp.c +++ b/ports/pic18f97j60/mstp.c @@ -615,13 +615,9 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu, reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/ports/win32/dlmstp-mm.c b/ports/win32/dlmstp-mm.c index f047f811..47bdc9c1 100644 --- a/ports/win32/dlmstp-mm.c +++ b/ports/win32/dlmstp-mm.c @@ -404,13 +404,9 @@ bool dlmstp_compare_data_expecting_reply( reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/ports/win32/dlmstp.c b/ports/win32/dlmstp.c index 6151b073..534bf4f2 100644 --- a/ports/win32/dlmstp.c +++ b/ports/win32/dlmstp.c @@ -268,13 +268,9 @@ static bool dlmstp_compare_data_expecting_reply( reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; } diff --git a/src/bacnet/datalink/dlmstp.c b/src/bacnet/datalink/dlmstp.c index 0b52544d..7d0afefd 100644 --- a/src/bacnet/datalink/dlmstp.c +++ b/src/bacnet/datalink/dlmstp.c @@ -225,13 +225,9 @@ static bool MSTP_Compare_Data_Expecting_Reply( reply.npdu_data.protocol_version) { return false; } -#if 0 - /* the NDPU priority doesn't get passed through the stack, and - all outgoing messages have NORMAL priority */ if (request.npdu_data.priority != reply.npdu_data.priority) { return false; } -#endif if (!bacnet_address_same(&request.address, &reply.address)) { return false; }