diff --git a/core/federated/RTI/rti_remote.c b/core/federated/RTI/rti_remote.c index ef7b3d519..4efe438e6 100644 --- a/core/federated/RTI/rti_remote.c +++ b/core/federated/RTI/rti_remote.c @@ -1198,6 +1198,9 @@ static int32_t receive_and_check_fed_id_message(int* socket_id, struct sockaddr_ // If the connection is a peer-to-peer connection between two // federates, reject the connection with the WRONG_SERVER error. send_reject(socket_id, WRONG_SERVER); + } else if (buffer[0] == MSG_TYPE_FED_NONCE) { + send_reject(socket_id, RTI_NOT_EXECUTED_WITH_AUTH); + lf_print_error("RTI not executed with HMAC authentication option using -a or --auth."); } else { send_reject(socket_id, UNEXPECTED_MESSAGE); } diff --git a/core/federated/federate.c b/core/federated/federate.c index 498687d07..ad1ec1741 100644 --- a/core/federated/federate.c +++ b/core/federated/federate.c @@ -862,6 +862,9 @@ static int perform_hmac_authentication() { if (received[0] == MSG_TYPE_FAILED) { lf_print_error("RTI has failed."); return -1; + } else if (received[0] == MSG_TYPE_REJECT && received[1] == RTI_NOT_EXECUTED_WITH_AUTH) { + lf_print_error("RTI is not executed with HMAC option."); + return -1; } else { lf_print_error("Received unexpected response %u from the RTI (see net_common.h).", received[0]); return -1; diff --git a/include/core/federated/network/net_common.h b/include/core/federated/network/net_common.h index 202592aa8..accd075bc 100644 --- a/include/core/federated/network/net_common.h +++ b/include/core/federated/network/net_common.h @@ -696,4 +696,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** HMAC authentication failed. */ #define HMAC_DOES_NOT_MATCH 6 +/** RTI not executed using -a or --auth option. */ +#define RTI_NOT_EXECUTED_WITH_AUTH 7 + #endif /* NET_COMMON_H */