mds currently uses MDS_PROT_FCTRL_ID 4 bytes value (0x00AC13F5) from octet11 to octet14 to identify the flow control message e.g., chunkack message. In case of fragmentation from big message, the second fragment onwards will start from the octet11, which may have arbitrary value and cause mds to incorrectly decode as a flow control message if the fragment starts with value of 0x00AC13F5.
This patch fixes this rare case by decoding flow control message only if the oct2-5 (mds global sequence number) and oct6-7 (mds fragment number) are non-zero. Change MDS_PROT_FCTRL_ID:0xFDAC13F5 --- src/mds/mds_dt.h | 2 +- src/mds/mds_tipc_fctrl_msg.cc | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mds/mds_dt.h b/src/mds/mds_dt.h index d9e8633..64da600 100644 --- a/src/mds/mds_dt.h +++ b/src/mds/mds_dt.h @@ -245,7 +245,7 @@ bool mdtm_mailbox_mbx_cleanup(NCSCONTEXT arg, NCSCONTEXT msg); /* MDS protocol/version for flow control */ #define MDS_PROT_FCTRL (0xB0 | MDS_VERSION) -#define MDS_PROT_FCTRL_ID 0x00AC13F5 +#define MDS_PROT_FCTRL_ID 0xFDAC13F5 /* Added for the subscription changes */ #define MDS_NCS_CHASSIS_ID (m_NCS_GET_NODE_ID & 0x00ff0000) diff --git a/src/mds/mds_tipc_fctrl_msg.cc b/src/mds/mds_tipc_fctrl_msg.cc index 064d977..8375673 100644 --- a/src/mds/mds_tipc_fctrl_msg.cc +++ b/src/mds/mds_tipc_fctrl_msg.cc @@ -64,13 +64,19 @@ void HeaderMessage::Decode(uint8_t *msg) { // decode flow control sequence number ptr = &msg[HeaderMessage::FieldIndex::kFlowControlSequenceNumber]; fseq_ = ncs_decode_16bit(&ptr); - // decode protocol identifier - ptr = &msg[ChunkAck::FieldIndex::kProtocolIdentifier]; - pro_id_ = ncs_decode_32bit(&ptr); - if (pro_id_ == MDS_PROT_FCTRL_ID) { - // decode message type - ptr = &msg[ChunkAck::FieldIndex::kFlowControlMessageType]; - msg_type_ = ncs_decode_8bit(&ptr); + // decode protocol identifier if the mfrag_ and mseq_ are 0 + // otherwise it is always DataMessage within non-zero mseq_ and mfrag_ + if (mfrag_ == 0 && mseq_ == 0) { + ptr = &msg[ChunkAck::FieldIndex::kProtocolIdentifier]; + pro_id_ = ncs_decode_32bit(&ptr); + if (pro_id_ == MDS_PROT_FCTRL_ID) { + // decode message type + ptr = &msg[ChunkAck::FieldIndex::kFlowControlMessageType]; + msg_type_ = ncs_decode_8bit(&ptr); + } + } else { + pro_id_ = 0; + msg_type_ = 0; } } else { if (mfrag_ != 0) { -- 2.7.4 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel