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

Apply option local port #222

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Conversation

boaks
Copy link
Contributor

@boaks boaks commented Jan 18, 2024

The previous version ignores the option for the local port. That may be
caused by issues using the same default local port for the server and
client.
This enables the use of an specific local port and changes the default
to an ephemeral free port, similar to quite a lot of other UDP clients.
The DEFAULT_PORT is therefore only used for the destination.

Comment on lines 489 to 494
case -1 :
/* handle arguments */
if (!dst.size) {
/* resolve destination address where server should be sent */
res = resolve_address(argv[optind++], &dst.addr.sa);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced that this is the best way do do this (very unusual), moving the logic processing the arguments to within the getopt() logic, and fail to see why it is actually needed. If this is done, at a minimum dtls_set_log_level(log_level); needs to be included at the start.

I think that simply removing the use of port_str, using the new local_port or DEFAULT_PORT in the appropriate places along with the other changes should should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess, the comment is for PR #221.

This PR and PR #221 are changing the very same lines so I decided to put the changes of this PR on the top of PR #221.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah - yes, this really should be against #221.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already copied your comment ;-)

@boaks boaks added the available on develop Mark PRs (pre-)available only on develop label Feb 7, 2024
Copy link
Contributor

@obgm obgm left a comment

Choose a reason for hiding this comment

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

LGTM.

Just a small comment: Technically, there is no "IPv4 port" or "IPv6 port" as described in the comments prior to the bind. As I think that this is useful to differentiate these two cases, I am entirely ok with leaving it like this.

@boaks
Copy link
Contributor Author

boaks commented Aug 28, 2024

I guess, adding a ',' will be an improvement :-)

dtls_info("bind to local IPv6, port %u\n", local_port);

The previous version ignores the option for the local port. That may be
caused by issues using the same default local port for the server and
client.
This enables the use of an specific local port and changes the default
to an ephemeral free port, similar to quite a lot of other UDP clients.
The DEFAULT_PORT is therefore only used for the destination.

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
@boaks boaks merged commit 1f1bc2a into eclipse:main Aug 28, 2024
6 checks passed
@boaks boaks deleted the apply_option_local_port branch August 28, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
available on develop Mark PRs (pre-)available only on develop
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants