-
Notifications
You must be signed in to change notification settings - Fork 2k
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: provide port for sock_ip and sock_udp #5772
Conversation
@brummer-simon this PR might also be of interest for you to give you an idea for how to port |
Rebased due to changes in #5526. |
sock is merged, pls rebase |
Can we merge the dependencies first please? Also, while working on lwIP I realized I need to adapt the tests a little ;-). |
Rebased to current dependencies and master. |
Applied the changes I spoke about too. |
58c2df3
to
779ff21
Compare
Rebased to current master, since #5884 was merged. |
While working on #5802 I realized that their raw sock equivalent require the IP header to be provided. This seems to be the behavior with POSIX sockets, too (see e.g. this tutorial). I did not implement it like that in |
Nvm... lwIP isn't consistent in this itself... and so is the information about raw sockets themselves.. |
Needs some small adjustments due to #5929 being merged. |
From my side everything looks in order. Tests succeed and I successfully tested the |
cd34cb9
to
149d29b
Compare
Squashed |
Rebased to current master. |
149d29b
to
9818d55
Compare
Ooops, didn't adapt it to the pseudo-module change in #5526. Done now. |
failed to download the |
Murdock still fails @miri64 |
9818d55
to
f3066f6
Compare
Fixed, rebased and squashed. |
f3066f6
to
9508c8f
Compare
Okay, |
Murdock is finally happy! |
I am good with the changes (so re-ACK) and Murdock is happy -> go @miri64 Congrats, this is big step towards usability of GNRC! |
if ((sock->remote.family != AF_UNSPEC) && /* check remote end-point if set */ | ||
((sock->remote.port != byteorder_ntohs(hdr->src_port)) || | ||
/* We only have IPv6 for now, so just comparing the whole end point | ||
* should suffice */ | ||
((memcmp(&sock->remote.addr, &ipv6_addr_unspecified, | ||
sizeof(ipv6_addr_t)) != 0) && | ||
(memcmp(&sock->remote.addr, &tmp.addr, sizeof(ipv6_addr_t)) != 0)))) { | ||
gnrc_pktbuf_release(pkt); | ||
return -EPROTO; | ||
} |
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 is this condition needed?
This enforces that if the socket was previously used for sending, received packets must come from the same address.
But there is nothing that says a socket must be bound to the remote address, but there is even a test for this.
Why is this there? This makes it impossible to use a socket to send to a multicast address and receive unicast responses.
This PR provides the port for
sock_ip
andsock_udp
(see #5758) to GNRC + tests.Depends on
#5526(mbox
support for GNRC),#5749(fix to UDP so the tests are able to run), and#5758(thesock
header files).