-
Notifications
You must be signed in to change notification settings - Fork 2.2k
change port identifiers to use uint16_t #1752
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
base: master
Are you sure you want to change the base?
Conversation
ab7cd62 to
42bd9c7
Compare
| init_socket(&udp_fd, local_addr, *local_port, remote_addr); | ||
|
|
||
| ret = stunclient_send(&buf, udp_fd, local_addr, local_port, remote_addr, change_ip, change_port, padding, -1); | ||
| ret = stunclient_send(&buf, udp_fd, local_addr, (uint16_t *)local_port, remote_addr, change_ip, change_port, padding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not change the argument to the function instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these all fall under the same issue - init_socket uses local_port as a pseudo-boolean, where it is treated as a port in the range [0, USHRT_MAX), but as a negation of a path when < 0.
the port has to be passed as an integer through some functions to preserve this meaning.
| init_socket(&udp_fd, local_addr, *local_port, remote_addr); | ||
|
|
||
| ret = stunclient_send(&buf, udp_fd, local_addr, local_port, remote_addr, change_ip, change_port, padding, -1); | ||
| ret = stunclient_send(&buf, udp_fd, local_addr, (uint16_t *)local_port, remote_addr, change_ip, change_port, padding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same... instead of casting should change the function argument
| } | ||
|
|
||
| addr_set_port(&real_local_addr, response_port); | ||
| addr_set_port(&real_local_addr, (uint16_t)response_port); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the type of the argument of addr_set_port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there - a few more places to change the type
42bd9c7 to
1dcda65
Compare
1dcda65 to
240c486
Compare
based on the ideas originally developed in this pr by @WHYHD