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:
parent
0153933241
commit
c366f2bbcd
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue