summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/IPv4Socket.cpp4
-rw-r--r--Kernel/Net/IPv4Socket.h2
-rw-r--r--Kernel/Net/NetworkTask.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index e4e1a26a01..62fd5cec4d 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -369,7 +369,7 @@ KResultOr<size_t> IPv4Socket::recvfrom(FileDescription& description, UserOrKerne
return nreceived;
}
-bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, KBuffer&& packet, const Time& packet_timestamp)
+bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, ReadonlyBytes packet, const Time& packet_timestamp)
{
Locker locker(lock());
@@ -398,7 +398,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
dbgln("IPv4Socket({}): did_receive refusing packet since queue is full.", this);
return false;
}
- m_receive_queue.append({ source_address, source_port, packet_timestamp, move(packet) });
+ m_receive_queue.append({ source_address, source_port, packet_timestamp, KBuffer::copy(packet.data(), packet.size()) });
set_can_read(true);
}
m_bytes_received += packet_size;
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index 7e0d58d8e8..2ec52a1860 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -43,7 +43,7 @@ public:
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
- bool did_receive(const IPv4Address& peer_address, u16 peer_port, KBuffer&&, const Time&);
+ bool did_receive(const IPv4Address& peer_address, u16 peer_port, ReadonlyBytes, const Time&);
const IPv4Address& local_address() const { return m_local_address; }
u16 local_port() const { return m_local_port; }
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index 8a8e3b21d9..92954ff456 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -221,7 +221,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet,
}
}
for (auto& socket : icmp_sockets)
- socket.did_receive(ipv4_packet.source(), 0, KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp);
+ socket.did_receive(ipv4_packet.source(), 0, { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp);
}
auto adapter = NetworkAdapter::from_ipv4_address(ipv4_packet.destination());
@@ -276,7 +276,7 @@ void handle_udp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
auto& destination = ipv4_packet.destination();
if (destination == IPv4Address(255, 255, 255, 255) || NetworkAdapter::from_ipv4_address(destination) || socket->multicast_memberships().contains_slow(destination))
- socket->did_receive(ipv4_packet.source(), udp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp);
+ socket->did_receive(ipv4_packet.source(), udp_packet.source_port(), { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp);
}
void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
@@ -533,7 +533,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
if (tcp_packet.has_fin()) {
if (payload_size != 0)
- socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp);
+ socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp);
socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
unused_rc = socket->send_tcp_packet(TCPFlags::ACK);
@@ -548,7 +548,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
tcp_packet.ack_number(), tcp_packet.sequence_number(), payload_size, socket->ack_number(), socket->sequence_number());
if (payload_size) {
- if (socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp))
+ if (socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp))
unused_rc = socket->send_tcp_packet(TCPFlags::ACK);
}
}