Kernel: Route all loopback traffic through the loopback adapter

This commit is contained in:
Conrad Pankoff
2019-12-28 10:59:52 +11:00
committed by Andreas Kling
parent 04cbdb2e6f
commit 5ca7ae4585
2 changed files with 7 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
#include <Kernel/Net/LoopbackAdapter.h>
#include <Kernel/Net/Routing.h>
#include <Kernel/Thread.h>
@@ -18,6 +19,9 @@ bool RoutingDecision::is_zero() const
RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source)
{
if (target[0] == 127)
return { LoopbackAdapter::the().make_weak_ptr(), {} };
auto target_addr = target.to_u32();
auto source_addr = source.to_u32();