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

Output error when trying to use --auth (-a) for RTI built without -DAUTH=ON #222

Merged
merged 2 commits into from
May 26, 2023

Conversation

hokeun
Copy link
Member

@hokeun hokeun commented May 25, 2023

Add an error message when trying to use the --auth (-a) option for the RTI built without the -DAUTH=ON option. Also fix a minor build warning.

Relevant issue: lf-lang/lingua-franca#1777

…e RTI built without the -DAUTH=ON option. Also fix a minor build warning.
@hokeun hokeun requested a review from edwardalee May 25, 2023 14:56
Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hokeun
Copy link
Member Author

hokeun commented May 26, 2023

This change will make sure that the RTI outputs an error and terminates with return -1 in main (https://github.com/lf-lang/reactor-c/blob/main/core/federated/RTI/rti.c#L67) when it's executed with an authentication option while it's not built with the OpenSSL support, as shown below. I believe this will fail the test when running the SimpleFederatedAuthenticated test with an RTI without OpenSSL (authentication) support.

./test/C/bin/SimpleFederatedAuthenticated
Federate SimpleFederatedAuthenticated in Federation ID '3c1c172f45cb7d2dab5c5ad93c47549fae6fbf815964fa09'
RTI: Federation ID: 3c1c172f45cb7d2dab5c5ad93c47549fae6fbf815964fa09
Error: --auth requires the RTI to be built with the -DAUTH=ON option.

Command-line arguments:

  -i, --id <n>
   The ID of the federation that this RTI will control.

  -n, --number_of_federates <n>
   The number of federates in the federation that this RTI will control.

  -p, --port <n>
   The port number to use for the RTI. Must be larger than 0 and smaller than 65535. Default is 15045.

  -c, --clock_sync [off|init|on] [period <n>] [exchanges-per-interval <n>]
   The status of clock synchronization for this federate.
       - off: Clock synchronization is off.
       - init (default): Clock synchronization is done only during startup.
       - on: Clock synchronization is done both at startup and during the execution.
   Relevant parameters that can be set:
       - period <n>(in nanoseconds): Controls how often a clock synchronization attempt is made
          (period in nanoseconds, default is 5 msec). Only applies to 'on'.
       - exchanges-per-interval <n>: Controls the number of messages that are exchanged for each
          clock sync attempt (default is 10). Applies to 'init' and 'on'.

  -a, --auth Turn on HMAC authentication options.

  -t, --tracing Turn on tracing.

Command given:
RTI -i 3c1c172f45cb7d2dab5c5ad93c47549fae6fbf815964fa09 -a -n 2 -c init exchanges-per-interval 10

#### Launching the federate federate__fed1.
#### Launching the federate federate__fed2.
#### Bringing the RTI back to foreground so it can receive Control-C.
./test/C/bin/SimpleFederatedAuthenticated: line 69: fg: job has terminated
#### Received ERR signal on line 69. Invoking cleanup().
Killing federate 63269.
Killing federate 63270.
#### Killing RTI 63267.
./test/C/bin/SimpleFederatedAuthenticated: line 17: kill: (63267) - No such process

@lhstrh lhstrh enabled auto-merge May 26, 2023 01:09
Copy link
Contributor

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this.

@lhstrh lhstrh merged commit f1db5a7 into main May 26, 2023
25 checks passed
@edwardalee edwardalee deleted the fix-rti-auth branch May 26, 2023 16:52
@lhstrh lhstrh added the enhancement Enhancement of existing feature label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants