mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc_sock_udp: fix null check in port generation function
Still check if the port is unused if no socket has been given.
This commit is contained in:
parent
b37bed8a1d
commit
5cf433806e
@ -74,8 +74,7 @@ static uint16_t _get_dyn_port(sock_udp_t *sock)
|
||||
do {
|
||||
uint16_t port = GNRC_SOCK_DYN_PORTRANGE_MIN +
|
||||
(random_uint32() % GNRC_SOCK_DYN_PORTRANGE_NUM);
|
||||
if ((sock == NULL) || (sock->flags & SOCK_FLAGS_REUSE_EP) ||
|
||||
!_dyn_port_used(port)) {
|
||||
if ((sock && (sock->flags & SOCK_FLAGS_REUSE_EP)) || !_dyn_port_used(port)) {
|
||||
return port;
|
||||
}
|
||||
--count;
|
||||
|
Loading…
Reference in New Issue
Block a user