mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:45:08 +00:00
Kernel: Use klog() instead of kprintf()
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
This commit is contained in:
parent
19aa53e1f9
commit
0fc60e41dd
53 changed files with 397 additions and 573 deletions
|
@ -76,8 +76,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source)
|
|||
|
||||
if (!local_adapter && !gateway_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Couldn't find a suitable adapter for route to %s\n",
|
||||
target.to_string().characters());
|
||||
klog() << "Routing: Couldn't find a suitable adapter for route to " << target.to_string().characters();
|
||||
#endif
|
||||
return { nullptr, {} };
|
||||
}
|
||||
|
@ -87,22 +86,13 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source)
|
|||
|
||||
if (local_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Got adapter for route (direct): %s (%s/%s) for %s\n",
|
||||
local_adapter->name().characters(),
|
||||
local_adapter->ipv4_address().to_string().characters(),
|
||||
local_adapter->ipv4_netmask().to_string().characters(),
|
||||
target.to_string().characters());
|
||||
klog() << "Routing: Got adapter for route (direct): " << local_adapter->name().characters() << " (" << local_adapter->ipv4_address().to_string().characters() << "/" << local_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
|
||||
#endif
|
||||
adapter = local_adapter;
|
||||
next_hop_ip = target;
|
||||
} else if (gateway_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Got adapter for route (using gateway %s): %s (%s/%s) for %s\n",
|
||||
gateway_adapter->ipv4_gateway().to_string().characters(),
|
||||
gateway_adapter->name().characters(),
|
||||
gateway_adapter->ipv4_address().to_string().characters(),
|
||||
gateway_adapter->ipv4_netmask().to_string().characters(),
|
||||
target.to_string().characters());
|
||||
klog() << "Routing: Got adapter for route (using gateway " << gateway_adapter->ipv4_gateway().to_string().characters() << "): " << gateway_adapter->name().characters() << " (" << gateway_adapter->ipv4_address().to_string().characters() << "/" << gateway_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
|
||||
#endif
|
||||
adapter = gateway_adapter;
|
||||
next_hop_ip = gateway_adapter->ipv4_gateway();
|
||||
|
@ -115,18 +105,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source)
|
|||
auto addr = arp_table().resource().get(next_hop_ip);
|
||||
if (addr.has_value()) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Using cached ARP entry for %s (%s)\n",
|
||||
next_hop_ip.to_string().characters(),
|
||||
addr.value().to_string().characters());
|
||||
klog() << "Routing: Using cached ARP entry for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
|
||||
#endif
|
||||
return { adapter, addr.value() };
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Sending ARP request via adapter %s for IPv4 address %s\n",
|
||||
adapter->name().characters(),
|
||||
next_hop_ip.to_string().characters());
|
||||
klog() << "Routing: Sending ARP request via adapter " << adapter->name().characters() << " for IPv4 address " << next_hop_ip.to_string().characters();
|
||||
#endif
|
||||
|
||||
ARPPacket request;
|
||||
|
@ -146,19 +132,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source)
|
|||
auto addr = arp_table().resource().get(next_hop_ip);
|
||||
if (addr.has_value()) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Got ARP response using adapter %s for %s (%s)\n",
|
||||
adapter->name().characters(),
|
||||
next_hop_ip.to_string().characters(),
|
||||
addr.value().to_string().characters());
|
||||
klog() << "Routing: Got ARP response using adapter " << adapter->name().characters() << " for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
|
||||
#endif
|
||||
return { adapter, addr.value() };
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ROUTING_DEBUG
|
||||
kprintf("Routing: Couldn't find route using adapter %s for %s\n",
|
||||
adapter->name().characters(),
|
||||
target.to_string().characters());
|
||||
klog() << "Routing: Couldn't find route using adapter " << adapter->name().characters() << " for " << target.to_string().characters();
|
||||
#endif
|
||||
|
||||
return { nullptr, {} };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue