Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messages when HMAC authentication is attempted by federates when RTI does not support it #461

Merged
merged 5 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions core/federated/federate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions include/core/federated/network/net_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Loading