diff --git a/kernel/include/net/icmp_layer.hpp b/kernel/include/net/icmp_layer.hpp index ea2d4914..5c4895c8 100644 --- a/kernel/include/net/icmp_layer.hpp +++ b/kernel/include/net/icmp_layer.hpp @@ -29,8 +29,6 @@ std::expected user_prepare_packet(char* buffer, netwo std::expected finalize_packet(network::interface_descriptor& interface, network::ethernet::packet& p); -void ping(network::interface_descriptor& interface, network::ip::address addr); - } // end of icmp namespace } // end of network namespace diff --git a/kernel/src/net/icmp_layer.cpp b/kernel/src/net/icmp_layer.cpp index f6e6076f..8f3f3e2d 100644 --- a/kernel/src/net/icmp_layer.cpp +++ b/kernel/src/net/icmp_layer.cpp @@ -147,32 +147,3 @@ std::expected network::icmp::finalize_packet(network::interface_descriptor // Give the packet to the IP layer for finalization return network::ip::finalize_packet(interface, packet); } - -void network::icmp::ping(network::interface_descriptor& interface, network::ip::address target_ip){ - logging::logf(logging::log_level::TRACE, "icmp: Ping %u.%u.%u.%u \n", - uint64_t(target_ip(0)), uint64_t(target_ip(1)), uint64_t(target_ip(2)), uint64_t(target_ip(3))); - - auto target_mac = network::arp::get_mac_force(interface, target_ip); - - if(!target_mac){ - logging::logf(logging::log_level::TRACE, "icmp: Failed to get MAC Address from IP\n"); - return; - } - - logging::logf(logging::log_level::TRACE, "icmp: Target MAC Address: %h\n", *target_mac); - - // Ask the ICMP layer to craft a packet - auto packet = network::icmp::kernel_prepare_packet(interface, target_ip, 0, type::ECHO_REQUEST, 0); - - if(packet){ - // Set the Command header - - auto* command_header = reinterpret_cast(packet->payload + packet->index); - - command_header->identifier = 0x666; - command_header->sequence = echo_sequence++; - - // Send the packet back to ICMP - network::icmp::finalize_packet(interface, *packet); - } -}