diff --git a/plugins/modbus/modbus_req.c b/plugins/modbus/modbus_req.c index 9b29cc80f..e93cce646 100644 --- a/plugins/modbus/modbus_req.c +++ b/plugins/modbus/modbus_req.c @@ -698,7 +698,7 @@ static int process_protocol_buf(neu_plugin_t *plugin, uint8_t slave_id, plog_recv_protocol(plugin, recv_buf, ret); } neu_protocol_unpack_buf_init(&pbuf, recv_buf, ret); - int ret_s = modbus_stack_recv(plugin->stack, 0, &pbuf); + int ret_s = modbus_stack_recv(plugin->stack, slave_id, &pbuf); if (ret_s == MODBUS_DEVICE_ERR) { ret = ret_s; } else { diff --git a/plugins/modbus/modbus_stack.c b/plugins/modbus/modbus_stack.c index 94f4589fe..504691224 100644 --- a/plugins/modbus/modbus_stack.c +++ b/plugins/modbus/modbus_stack.c @@ -84,10 +84,8 @@ int modbus_stack_recv(modbus_stack_t *stack, uint8_t slave_id, return -1; } - if (stack->protocol == MODBUS_PROTOCOL_TCP) { - if (code.slave_id != slave_id) { - return -1; - } + if (code.slave_id != slave_id) { + return -1; } switch (code.function) {