mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-05-24 12:08:57 +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:
committed by
Andreas Kling
parent
532db9f768
commit
2b6aa571d1
@@ -227,7 +227,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload,
|
||||
|
||||
auto packet_buffer = UserOrKernelBuffer::for_kernel_buffer(buffer.data());
|
||||
auto result = routing_decision.adapter->send_ipv4(
|
||||
routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
|
||||
local_address(), routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
|
||||
packet_buffer, buffer_size, ttl());
|
||||
if (result.is_error())
|
||||
return result;
|
||||
@@ -265,8 +265,8 @@ void TCPSocket::send_outgoing_packets(RoutingDecision& routing_decision)
|
||||
|
||||
auto packet_buffer = UserOrKernelBuffer::for_kernel_buffer(packet.buffer.data());
|
||||
int err = routing_decision.adapter->send_ipv4(
|
||||
routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
|
||||
packet_buffer, packet.buffer.size(), ttl());
|
||||
local_address(), routing_decision.next_hop, peer_address(),
|
||||
IPv4Protocol::TCP, packet_buffer, packet.buffer.size(), ttl());
|
||||
if (err < 0) {
|
||||
auto& tcp_packet = *(const TCPPacket*)(packet.buffer.data());
|
||||
dmesgln("Error ({}) sending TCP packet from {}:{} to {}:{} with ({}{}{}{}) seq_no={}, ack_no={}, tx_counter={}",
|
||||
|
||||
Reference in New Issue
Block a user