summaryrefslogtreecommitdiff
path: root/Kernel/Net/UDPSocket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-04 03:27:50 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-04 03:27:50 +0200
commit780d2a08c488e5e8a61f7508f7cc31f35bdf8b26 (patch)
tree1c91597b2b92fbae9bf9c91a41425375f58b956c /Kernel/Net/UDPSocket.cpp
parentc4bb9a3ccbbd0538472d7a6ea025c17bfaec9e8d (diff)
downloadserenity-780d2a08c488e5e8a61f7508f7cc31f35bdf8b26.zip
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. :^)
Diffstat (limited to 'Kernel/Net/UDPSocket.cpp')
-rw-r--r--Kernel/Net/UDPSocket.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index e631054630..982bdd8606 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -53,10 +53,6 @@ int UDPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, s
auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload());
ASSERT(udp_packet.length() >= sizeof(UDPPacket)); // FIXME: This should be rejected earlier.
ASSERT(buffer_size >= (udp_packet.length() - sizeof(UDPPacket)));
- if (addr) {
- auto& ia = *(sockaddr_in*)addr;
- ia.sin_port = htons(udp_packet.destination_port());
- }
memcpy(buffer, udp_packet.payload(), udp_packet.length() - sizeof(UDPPacket));
return udp_packet.length() - sizeof(UDPPacket);
}