mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
IPv4: Save the source address/port together with incoming packet payloads.
We need the address/port to fill in the out-params in recvfrom(). It should now be more or less possible to create a UDP server. :^)
This commit is contained in:
@@ -54,10 +54,6 @@ int TCPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, s
|
||||
size_t payload_size = packet_buffer.size() - sizeof(IPv4Packet) - tcp_packet.header_size();
|
||||
kprintf("payload_size %u, will it fit in %u?\n", payload_size, buffer_size);
|
||||
ASSERT(buffer_size >= payload_size);
|
||||
if (addr) {
|
||||
auto& ia = *(sockaddr_in*)addr;
|
||||
ia.sin_port = htons(tcp_packet.destination_port());
|
||||
}
|
||||
memcpy(buffer, tcp_packet.payload(), payload_size);
|
||||
return payload_size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user