1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

Kernel: Outbound packets should use the source address from the socket

Previously we'd use the adapter's address as the source address
when sending packets. Instead we should use the socket's bound local
address.
This commit is contained in:
Gunnar Beutner 2021-05-12 14:36:09 +02:00 committed by Andreas Kling
parent 532db9f768
commit 2b6aa571d1
6 changed files with 16 additions and 13 deletions

View file

@ -84,7 +84,8 @@ KResultOr<size_t> UDPSocket::protocol_send(const UserOrKernelBuffer& data, size_
if (!data.read(udp_packet.payload(), data_length))
return EFAULT;
auto result = routing_decision.adapter->send_ipv4(routing_decision.next_hop, peer_address(), IPv4Protocol::UDP, UserOrKernelBuffer::for_kernel_buffer(buffer.data()), buffer_size, ttl());
auto result = routing_decision.adapter->send_ipv4(local_address(), routing_decision.next_hop,
peer_address(), IPv4Protocol::UDP, UserOrKernelBuffer::for_kernel_buffer(buffer.data()), buffer_size, ttl());
if (result.is_error())
return result;
return data_length;