Fixed NDPU comparison functions that were missing segment-ack PDU. (#991)

This commit is contained in:
Steve Karg
2025-05-08 09:12:41 -05:00
committed by GitHub
parent f771f90323
commit 5f646e9e5d
12 changed files with 34 additions and 11 deletions
+1
View File
@@ -29,6 +29,7 @@ The git repositories are hosted at the following sites:
### Fixed ### Fixed
* Fixed NDPU comparison functions that were missing segment-ack PDU. (#991)
* Fixed WriteProperty NULL bypass which is only for present-value property * Fixed WriteProperty NULL bypass which is only for present-value property
of commandable objects. (#984) of commandable objects. (#984)
* Fixed the ghost Device ID 0 in the I-Am response when the actual * Fixed the ghost Device ID 0 in the I-Am response when the actual
+3 -1
View File
@@ -264,6 +264,7 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu,
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -274,7 +275,8 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu,
} }
/* these services don't have service choice included */ /* these services don't have service choice included */
if ((reply.pdu_type != PDU_TYPE_REJECT) && if ((reply.pdu_type != PDU_TYPE_REJECT) &&
(reply.pdu_type != PDU_TYPE_ABORT)) { (reply.pdu_type != PDU_TYPE_ABORT) &&
(reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) {
if (request.service_choice != reply.service_choice) { if (request.service_choice != reply.service_choice) {
return false; return false;
} }
+3 -1
View File
@@ -265,6 +265,7 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu,
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -275,7 +276,8 @@ static bool dlmstp_compare_data_expecting_reply(const uint8_t *request_pdu,
} }
/* these services don't have service choice included */ /* these services don't have service choice included */
if ((reply.pdu_type != PDU_TYPE_REJECT) && if ((reply.pdu_type != PDU_TYPE_REJECT) &&
(reply.pdu_type != PDU_TYPE_ABORT)) { (reply.pdu_type != PDU_TYPE_ABORT) &&
(reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) {
if (request.service_choice != reply.service_choice) { if (request.service_choice != reply.service_choice) {
return false; return false;
} }
+3 -1
View File
@@ -488,6 +488,7 @@ static bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -495,7 +496,8 @@ static bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
debug_printf("DLMSTP: DER Compare failed: " debug_printf("DLMSTP: DER Compare failed: "
"Invoke ID mismatch.\n"); "Invoke ID mismatch.\n");
+3 -1
View File
@@ -526,6 +526,7 @@ static bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -533,7 +534,8 @@ static bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
debug_printf("DLMSTP: DER Compare failed: " debug_printf("DLMSTP: DER Compare failed: "
"Invoke ID mismatch.\n"); "Invoke ID mismatch.\n");
+3 -1
View File
@@ -489,6 +489,7 @@ static bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -496,7 +497,8 @@ static bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
debug_printf("DLMSTP: DER Compare failed: " debug_printf("DLMSTP: DER Compare failed: "
"Invoke ID mismatch.\n"); "Invoke ID mismatch.\n");
+3 -1
View File
@@ -471,6 +471,7 @@ static bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -478,7 +479,8 @@ static bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
debug_printf("DLMSTP: DER Compare failed: " debug_printf("DLMSTP: DER Compare failed: "
"Invoke ID mismatch.\n"); "Invoke ID mismatch.\n");
+3 -1
View File
@@ -586,6 +586,7 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu,
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -596,7 +597,8 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu,
} }
/* these services don't have service choice included */ /* these services don't have service choice included */
if ((reply.pdu_type != PDU_TYPE_REJECT) && if ((reply.pdu_type != PDU_TYPE_REJECT) &&
(reply.pdu_type != PDU_TYPE_ABORT)) { (reply.pdu_type != PDU_TYPE_ABORT) &&
(reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) {
if (request.service_choice != reply.service_choice) { if (request.service_choice != reply.service_choice) {
return false; return false;
} }
+3 -1
View File
@@ -594,6 +594,7 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu,
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -604,7 +605,8 @@ static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu,
} }
/* these services don't have service choice included */ /* these services don't have service choice included */
if ((reply.pdu_type != PDU_TYPE_REJECT) && if ((reply.pdu_type != PDU_TYPE_REJECT) &&
(reply.pdu_type != PDU_TYPE_ABORT)) { (reply.pdu_type != PDU_TYPE_ABORT) &&
(reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) {
if (request.service_choice != reply.service_choice) { if (request.service_choice != reply.service_choice) {
return false; return false;
} }
+3 -1
View File
@@ -377,6 +377,7 @@ bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -384,7 +385,8 @@ bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
return false; return false;
} }
+3 -1
View File
@@ -364,6 +364,7 @@ static bool dlmstp_compare_data_expecting_reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -371,7 +372,8 @@ static bool dlmstp_compare_data_expecting_reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
return false; return false;
} }
+3 -1
View File
@@ -200,6 +200,7 @@ static bool MSTP_Compare_Data_Expecting_Reply(
break; break;
case PDU_TYPE_REJECT: case PDU_TYPE_REJECT:
case PDU_TYPE_ABORT: case PDU_TYPE_ABORT:
case PDU_TYPE_SEGMENT_ACK:
reply.invoke_id = reply_pdu[offset + 1]; reply.invoke_id = reply_pdu[offset + 1];
break; break;
default: default:
@@ -207,7 +208,8 @@ static bool MSTP_Compare_Data_Expecting_Reply(
} }
/* these don't have service choice included */ /* these don't have service choice included */
if ((reply.pdu_type == PDU_TYPE_REJECT) || if ((reply.pdu_type == PDU_TYPE_REJECT) ||
(reply.pdu_type == PDU_TYPE_ABORT)) { (reply.pdu_type == PDU_TYPE_ABORT) ||
(reply.pdu_type == PDU_TYPE_SEGMENT_ACK)) {
if (request.invoke_id != reply.invoke_id) { if (request.invoke_id != reply.invoke_id) {
return false; return false;
} }