mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
Kernel/IPv4: Unbreak raw socket (port allocation failing is OK)
Raw sockets don't need a local port, so we shouldn't fail operations if allocation yields an ENOPROTOOPT. I'm not in love with the factoring here, just patching up the bug.
This commit is contained in:
parent
8fac7a1d5d
commit
51f88cb00d
Notes:
sideshowbarker
2024-07-18 18:51:04 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/51f88cb00d0
@ -109,7 +109,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
|
|||||||
KResult IPv4Socket::listen(size_t backlog)
|
KResult IPv4Socket::listen(size_t backlog)
|
||||||
{
|
{
|
||||||
Locker locker(lock());
|
Locker locker(lock());
|
||||||
if (auto result = allocate_local_port_if_needed(); result.is_error())
|
if (auto result = allocate_local_port_if_needed(); result.is_error() && result.error() != -ENOPROTOOPT)
|
||||||
return result.error();
|
return result.error();
|
||||||
|
|
||||||
set_backlog(backlog);
|
set_backlog(backlog);
|
||||||
@ -198,7 +198,7 @@ KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer&
|
|||||||
if (m_local_address.to_u32() == 0)
|
if (m_local_address.to_u32() == 0)
|
||||||
m_local_address = routing_decision.adapter->ipv4_address();
|
m_local_address = routing_decision.adapter->ipv4_address();
|
||||||
|
|
||||||
if (auto result = allocate_local_port_if_needed(); result.is_error())
|
if (auto result = allocate_local_port_if_needed(); result.is_error() && result.error() != -ENOPROTOOPT)
|
||||||
return result.error();
|
return result.error();
|
||||||
|
|
||||||
dbgln_if(IPV4_SOCKET_DEBUG, "sendto: destination={}:{}", m_peer_address, m_peer_port);
|
dbgln_if(IPV4_SOCKET_DEBUG, "sendto: destination={}:{}", m_peer_address, m_peer_port);
|
||||||
|
Loading…
Reference in New Issue
Block a user