summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
-rw-r--r--Kernel/Net/NetworkAdapter.cpp8
-rw-r--r--Kernel/Net/NetworkAdapter.h2
-rw-r--r--Kernel/Net/NetworkTask.cpp2
-rw-r--r--Kernel/Net/TCPSocket.cpp2
-rw-r--r--Kernel/Net/UDPSocket.cpp2
6 files changed, 9 insertions, 9 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 09b842c295..8df46ad7a6 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -164,7 +164,7 @@ ssize_t IPv4Socket::sendto(FileDescription&, const void* data, size_t data_lengt
kprintf("sendto: destination=%s:%u\n", m_peer_address.to_string().characters(), m_peer_port);
if (type() == SOCK_RAW) {
- adapter->send_ipv4(MACAddress(), m_peer_address, (IPv4Protocol)protocol(), ByteBuffer::copy(data, data_length));
+ adapter->send_ipv4(MACAddress(), m_peer_address, (IPv4Protocol)protocol(), (const u8*)data, data_length);
return data_length;
}
diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp
index 6476305daa..e4fdb2020e 100644
--- a/Kernel/Net/NetworkAdapter.cpp
+++ b/Kernel/Net/NetworkAdapter.cpp
@@ -56,9 +56,9 @@ void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet
send_raw((u8*)eth, size_in_bytes);
}
-void NetworkAdapter::send_ipv4(const MACAddress& destination_mac, const IPv4Address& destination_ipv4, IPv4Protocol protocol, ByteBuffer&& payload)
+void NetworkAdapter::send_ipv4(const MACAddress& destination_mac, const IPv4Address& destination_ipv4, IPv4Protocol protocol, const u8* payload, size_t payload_size)
{
- size_t size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(IPv4Packet) + payload.size();
+ size_t size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(IPv4Packet) + payload_size;
auto buffer = ByteBuffer::create_zeroed(size_in_bytes);
auto& eth = *(EthernetFrameHeader*)buffer.pointer();
eth.set_source(mac_address());
@@ -70,11 +70,11 @@ void NetworkAdapter::send_ipv4(const MACAddress& destination_mac, const IPv4Addr
ipv4.set_source(ipv4_address());
ipv4.set_destination(destination_ipv4);
ipv4.set_protocol((u8)protocol);
- ipv4.set_length(sizeof(IPv4Packet) + payload.size());
+ ipv4.set_length(sizeof(IPv4Packet) + payload_size);
ipv4.set_ident(1);
ipv4.set_ttl(64);
ipv4.set_checksum(ipv4.compute_checksum());
- memcpy(ipv4.payload(), payload.pointer(), payload.size());
+ memcpy(ipv4.payload(), payload, payload_size);
send_raw((const u8*)&eth, size_in_bytes);
}
diff --git a/Kernel/Net/NetworkAdapter.h b/Kernel/Net/NetworkAdapter.h
index d2b4c10862..4be39df383 100644
--- a/Kernel/Net/NetworkAdapter.h
+++ b/Kernel/Net/NetworkAdapter.h
@@ -27,7 +27,7 @@ public:
void set_ipv4_address(const IPv4Address&);
void send(const MACAddress&, const ARPPacket&);
- void send_ipv4(const MACAddress&, const IPv4Address&, IPv4Protocol, ByteBuffer&& payload);
+ void send_ipv4(const MACAddress&, const IPv4Address&, IPv4Protocol, const u8* payload, size_t payload_size);
RefPtr<KBuffer> dequeue_packet();
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index 4ff8b1c9bd..a61d1980f6 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -228,7 +228,7 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size)
if (size_t icmp_payload_size = icmp_packet_size - sizeof(ICMPEchoPacket))
memcpy(response.payload(), request.payload(), icmp_payload_size);
response.header.set_checksum(internet_checksum(&response, icmp_packet_size));
- adapter->send_ipv4(eth.source(), ipv4_packet.source(), IPv4Protocol::ICMP, move(buffer));
+ adapter->send_ipv4(eth.source(), ipv4_packet.source(), IPv4Protocol::ICMP, buffer.data(), buffer.size());
}
}
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index 42528a85ba..a50215c954 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -107,7 +107,7 @@ void TCPSocket::send_tcp_packet(u16 flags, const void* payload, int payload_size
tcp_packet.sequence_number(),
tcp_packet.ack_number());
#endif
- adapter->send_ipv4(MACAddress(), peer_address(), IPv4Protocol::TCP, move(buffer));
+ adapter->send_ipv4(MACAddress(), peer_address(), IPv4Protocol::TCP, buffer.data(), buffer.size());
}
NetworkOrdered<u16> TCPSocket::compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket& packet, u16 payload_size)
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index 2349837ba4..c3acf1261f 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -70,7 +70,7 @@ int UDPSocket::protocol_send(const void* data, int data_length)
local_port(),
peer_address().to_string().characters(),
peer_port());
- adapter->send_ipv4(MACAddress(), peer_address(), IPv4Protocol::UDP, move(buffer));
+ adapter->send_ipv4(MACAddress(), peer_address(), IPv4Protocol::UDP, buffer.data(), buffer.size());
return data_length;
}