sockets: perform implicit bind during sendto()

A client should not require to explicitly call bind() to receive packets, but is expected to receive replies sent to the ephemeral port that was selected as a source port by the UDP implementation.
This commit is contained in:
Oleg Hahm 2015-11-20 22:07:56 +01:00
parent 0153933241
commit c366f2bbcd
1 changed files with 2 additions and 3 deletions

View File

@ -728,12 +728,11 @@ ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags,
switch (s->type) {
#ifdef MODULE_CONN_UDP
case SOCK_DGRAM:
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr, &addr_len,
port)) < 0) {
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr,
&addr_len, port)) < 0) {
errno = -res;
return -1;
}
break;
#endif
#ifdef MODULE_CONN_IP