corrected invalid frame handling for mstpcap scan feature
This commit is contained in:
@@ -759,6 +759,7 @@ static bool read_received_packet(
|
|||||||
if (mstp_port->HeaderCRC != 0x55) {
|
if (mstp_port->HeaderCRC != 0x55) {
|
||||||
mstp_port->ReceivedInvalidFrame = true;
|
mstp_port->ReceivedInvalidFrame = true;
|
||||||
} else if (mstp_port->DataLength == 0) {
|
} else if (mstp_port->DataLength == 0) {
|
||||||
|
mstp_port->ReceivedInvalidFrame = false;
|
||||||
mstp_port->ReceivedValidFrame = true;
|
mstp_port->ReceivedValidFrame = true;
|
||||||
mstp_port->ReceivedValidFrameNotForUs = true;
|
mstp_port->ReceivedValidFrameNotForUs = true;
|
||||||
}
|
}
|
||||||
@@ -794,16 +795,18 @@ static bool read_received_packet(
|
|||||||
CRC_Calc_Data(mstp_port->DataCRCActualMSB, mstp_port->DataCRC);
|
CRC_Calc_Data(mstp_port->DataCRCActualMSB, mstp_port->DataCRC);
|
||||||
mstp_port->DataCRC =
|
mstp_port->DataCRC =
|
||||||
CRC_Calc_Data(mstp_port->DataCRCActualLSB, mstp_port->DataCRC);
|
CRC_Calc_Data(mstp_port->DataCRCActualLSB, mstp_port->DataCRC);
|
||||||
if (mstp_port->DataCRC == 0xF0B8) {
|
if (mstp_port->DataCRC != 0xF0B8) {
|
||||||
mstp_port->ReceivedValidFrame = true;
|
|
||||||
mstp_port->ReceivedValidFrameNotForUs = true;
|
|
||||||
} else {
|
|
||||||
mstp_port->ReceivedInvalidFrame = true;
|
mstp_port->ReceivedInvalidFrame = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mstp_port->DataLength = 0;
|
mstp_port->DataLength = 0;
|
||||||
}
|
}
|
||||||
packet_statistics(&tv, mstp_port);
|
if (mstp_port->ReceivedInvalidFrame) {
|
||||||
|
Invalid_Frame_Count++;
|
||||||
|
} else if ((mstp_port->ReceivedValidFrame) ||
|
||||||
|
(mstp_port->ReceivedValidFrameNotForUs)) {
|
||||||
|
packet_statistics(&tv, mstp_port);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user