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

Reject locators with port = 0 #1780

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

eboasson
Copy link
Contributor

This PR prevents Cyclone from accepting locators with port = 0 and so should take care of the error messages reported in #1772. The other problems caused by accepting incorrect locators can't be fixed so easily.

Copy link
Contributor

@dpotman dpotman left a comment

Choose a reason for hiding this comment

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

Looks good, only a detail on the meaning of port number 0, see comment below.

@@ -252,15 +252,15 @@ inline dds_return_t ddsi_factory_create_conn (struct ddsi_tran_conn **conn, stru
*conn = NULL;
if ((qos->m_interface != NULL) != (qos->m_purpose == DDSI_TRAN_QOS_XMIT_UC || qos->m_purpose == DDSI_TRAN_QOS_XMIT_MC))
return DDS_RETCODE_BAD_PARAMETER;
if (!ddsi_is_valid_port (factory, port))
if (port != 0 && !ddsi_is_valid_port (factory, port))
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition (and the ones below) confused me a bit, because port number 0 was rejected earlier in the check in do_locator. Because at this point the 0 has a special meaning for the underlying implementation, I think it would be more clear to replace it with a #define with a descriptive name.

@eboasson eboasson merged commit aee37ee into eclipse-cyclonedds:master Jul 27, 2023
15 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants