Bugfix/btl mstp local broadcast discard (#248)

* Discard Confirmed PDU DNER on local broadcast. Discard DER on local broacast.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-04-02 08:44:04 -05:00
committed by GitHub
parent 050efc2472
commit 12a5e48b3e
10 changed files with 170 additions and 75 deletions
+24 -11
View File
@@ -55,8 +55,10 @@
#include "crc.h"
#include "rs485.h"
#include "bacnet/datalink/mstptext.h"
#if !defined(DEBUG_ENABLED)
#define DEBUG_ENABLED 1
#include "bacnet/npdu.h"
#ifndef DEBUG_ENABLED
#define DEBUG_ENABLED 0
#endif
#include "bacnet/basic/sys/debug.h"
@@ -655,18 +657,29 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
}
break;
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
/* indicate successful reception to the higher
* layers */
(void)MSTP_Put_Receive(mstp_port);
if ((mstp_port->DestinationAddress ==
MSTP_BROADCAST_ADDRESS) &&
(npdu_confirmed_service(mstp_port->InputBuffer,
mstp_port->DataLength))) {
/* BTL test: verifies that the IUT will quietly
discard any Confirmed-Request-PDU, whose
destination address is a multicast or
broadcast address, received from the
network layer. */
} else {
/* indicate successful reception to the higher
* layers */
(void)MSTP_Put_Receive(mstp_port);
}
break;
case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY:
/*mstp_port->ReplyPostponedTimer = 0; */
/* indicate successful reception to the higher
* layers */
(void)MSTP_Put_Receive(mstp_port);
/* broadcast DER just remains IDLE */
if (mstp_port->DestinationAddress !=
if (mstp_port->DestinationAddress ==
MSTP_BROADCAST_ADDRESS) {
/* broadcast DER just remains IDLE */
} else {
/* indicate successful reception to the higher
* layers */
(void)MSTP_Put_Receive(mstp_port);
mstp_port->master_state =
MSTP_MASTER_STATE_ANSWER_DATA_REQUEST;
}