forked from Bananymous/banan-os
Kernel: Binding to port 0 will always find unused port
This commit is contained in:
parent
57aec2a733
commit
d395cf38b7
|
@ -116,7 +116,9 @@ namespace Kernel
|
||||||
return BAN::Error::from_errno(EAFNOSUPPORT);
|
return BAN::Error::from_errno(EAFNOSUPPORT);
|
||||||
|
|
||||||
auto& sockaddr_in = *reinterpret_cast<const struct sockaddr_in*>(address);
|
auto& sockaddr_in = *reinterpret_cast<const struct sockaddr_in*>(address);
|
||||||
uint16_t port = BAN::host_to_network_endian(sockaddr_in.sin_port);
|
const uint16_t port = BAN::host_to_network_endian(sockaddr_in.sin_port);
|
||||||
|
if (port == NetworkSocket::PORT_NONE)
|
||||||
|
return bind_socket_to_unused(socket, address, address_len);
|
||||||
|
|
||||||
SpinLockGuard _(m_bound_socket_lock);
|
SpinLockGuard _(m_bound_socket_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue