Commit 2284aae2b8c7beec06e3c9847ee89169b4ac8e37

Authored by Stéphane Raimbault
1 parent e10ee2d5

Explicit check against Modbus broadcast address

Showing 1 changed file with 2 additions and 2 deletions
src/modbus.c
... ... @@ -1055,8 +1055,8 @@ int modbus_reply(modbus_t *ctx, const uint8_t *req,
1055 1055 break;
1056 1056 }
1057 1057  
1058   - /* Suppress any response when the request was a broadcast */
1059   - return slave ? send_msg(ctx, rsp, rsp_length) : 0;
  1058 + /* Suppress any responses when the request was a broadcast */
  1059 + return (slave == MODBUS_BROADCAST_ADDRESS) ? 0 : send_msg(ctx, rsp, rsp_length);
1060 1060 }
1061 1061  
1062 1062 int modbus_reply_exception(modbus_t *ctx, const uint8_t *req,
... ...