Issues/issue 811 mstpcap considers valid frames as invalid if used as a standalone tool (#812)

* Fixed mstpcap utility by setting This-Station to the MS/TP promiscuous mode address 255.

* Fixed MS/TP receive filter for valid data frames which was missing.

* Fixed MS/TP zero-config duplicate node detection

* Reset silence during MS/TP capture after writing packet to prevent endless packets when stream is interrupted.
This commit is contained in:
Steve Karg
2024-10-15 15:38:25 -05:00
committed by GitHub
parent 2b58f5b122
commit ac7dee0021
2 changed files with 46 additions and 42 deletions
+5 -2
View File
@@ -972,7 +972,8 @@ static void print_help(const char *filename)
filename);
}
/* initialize some of the variables in the MS/TP Receive structure */
/* initialize some of the variables in the MS/TP Receive structure
after each packet write */
static void mstp_structure_init(struct mstp_port_struct_t *mstp_port)
{
if (mstp_port) {
@@ -983,9 +984,11 @@ static void mstp_structure_init(struct mstp_port_struct_t *mstp_port)
mstp_port->HeaderCRCActual = 0;
mstp_port->Index = 0;
mstp_port->EventCount = 0;
mstp_port->DataRegister = 0xFF;
mstp_port->ReceivedInvalidFrame = false;
mstp_port->ReceivedValidFrame = false;
mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE;
mstp_port->SilenceTimerReset(NULL);
}
}
@@ -1003,7 +1006,7 @@ int main(int argc, char *argv[])
MSTP_Port.InputBufferSize = sizeof(RxBuffer);
MSTP_Port.OutputBuffer = &TxBuffer[0];
MSTP_Port.OutputBufferSize = sizeof(TxBuffer);
MSTP_Port.This_Station = 127;
MSTP_Port.This_Station = MSTP_BROADCAST_ADDRESS;
MSTP_Port.Nmax_info_frames = 1;
MSTP_Port.Nmax_master = 127;
MSTP_Port.SilenceTimer = Timer_Silence;