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

gnrc_sock: actually bind implicitly #6021

Merged
merged 2 commits into from
Oct 30, 2016

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Oct 29, 2016

Just setting the port won't cut it. ;-). This fixes the issue we encountered in #6020

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking labels Oct 29, 2016
@miri64 miri64 added this to the Release 2016.10 milestone Oct 29, 2016
@miri64 miri64 mentioned this pull request Oct 29, 2016
@@ -221,11 +221,18 @@ ssize_t sock_udp_send(sock_udp_t *sock, const void *data, size_t len,
if (sock != NULL) {
/* bind sock object implicitly */
sock->local.port = src_port;
if (remote == NULL) {
sock->local.family = sock->remote.family;
Copy link
Member

Choose a reason for hiding this comment

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

Is it guaranteed that the remote member of the sock struct is always set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The line I just added a minor bugfix above guarantees that either remote != NULL or sock->remote.family != AF_UNSEC.

Copy link
Member

@OlegHahm OlegHahm left a comment

Choose a reason for hiding this comment

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

Assuming a positive answer to my question: ACK

@OlegHahm OlegHahm added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 30, 2016
@miri64
Copy link
Member Author

miri64 commented Oct 30, 2016

Piggy-backed a minor logical error (which except for some corner cases shouldn't change anything, since in most cases when sock.remote.family == AF_UNSPEC (= 0) sock.remote.port should also be 0)

@OlegHahm
Copy link
Member

ACK upholds.

@miri64 miri64 merged commit 04f8cc2 into RIOT-OS:master Oct 30, 2016
@miri64 miri64 deleted the gnrc_sock/fix/actually-bind-implicitly branch October 30, 2016 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants