Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/modbus-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ static int _modbus_tcp_pre_check_confirmation(modbus_t *ctx,
return -1;
}

/* Check if response slave ID matches request slave ID*/
if (req[6] != rsp[6]) {
if (ctx->debug) {
fprintf(stderr,
"The responding slave %d isn't the requested slave %d\n",
rsp[6],
req[6]);
}
errno = EMBBADSLAVE;
return -1;
}

return 0;
}

Expand Down