mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-16 07:57:13 -04:00
Cleanup
This commit is contained in:
parent
34f0ce0a1f
commit
2de3bb3f05
@ -19,11 +19,11 @@ inline network::ip::address network::ip::ip32_to_ip(uint32_t raw){
|
||||
}
|
||||
|
||||
void network::ip::decode(network::interface_descriptor& interface, network::ethernet::packet& packet){
|
||||
header* arp_header = reinterpret_cast<header*>(packet.payload + packet.index);
|
||||
header* ip_header = reinterpret_cast<header*>(packet.payload + packet.index);
|
||||
|
||||
logging::logf(logging::log_level::TRACE, "ip: Start IPv4 packet handling\n");
|
||||
|
||||
auto version = arp_header->version_ihl >> 4;
|
||||
auto version = ip_header->version_ihl >> 4;
|
||||
|
||||
if(version != 4){
|
||||
logging::logf(logging::log_level::ERROR, "ip: IPv6 Packet received instead of IPv4\n");
|
||||
@ -31,22 +31,22 @@ void network::ip::decode(network::interface_descriptor& interface, network::ethe
|
||||
return;
|
||||
}
|
||||
|
||||
auto ihl = arp_header->version_ihl & 0xF;
|
||||
auto length = switch_endian_16(arp_header->total_len);
|
||||
auto ihl = ip_header->version_ihl & 0xF;
|
||||
auto length = switch_endian_16(ip_header->total_len);
|
||||
auto data_length = length - ihl * 4;
|
||||
|
||||
logging::logf(logging::log_level::TRACE, "ip: Data Length: %u\n", size_t(data_length));
|
||||
logging::logf(logging::log_level::TRACE, "ip: Time To Live: %u\n", size_t(arp_header->ttl));
|
||||
logging::logf(logging::log_level::TRACE, "ip: Time To Live: %u\n", size_t(ip_header->ttl));
|
||||
|
||||
auto source = ip32_to_ip(arp_header->source_ip);
|
||||
auto target = ip32_to_ip(arp_header->target_ip);
|
||||
auto source = ip32_to_ip(ip_header->source_ip);
|
||||
auto target = ip32_to_ip(ip_header->target_ip);
|
||||
|
||||
logging::logf(logging::log_level::TRACE, "ip: Source Protocol Address %u.%u.%u.%u \n",
|
||||
uint64_t(source(0)), uint64_t(source(1)), uint64_t(source(2)), uint64_t(source(3)));
|
||||
logging::logf(logging::log_level::TRACE, "ip: Target Protocol Address %u.%u.%u.%u \n",
|
||||
uint64_t(target(0)), uint64_t(target(1)), uint64_t(target(2)), uint64_t(target(3)));
|
||||
|
||||
auto protocol = arp_header->protocol;
|
||||
auto protocol = ip_header->protocol;
|
||||
|
||||
packet.index += sizeof(header);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user