mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
Kernel: Route all loopback traffic through the loopback adapter
This commit is contained in:
parent
04cbdb2e6f
commit
5ca7ae4585
2 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
|
||||
|
@ -29,6 +30,8 @@ WeakPtr<NetworkAdapter> NetworkAdapter::from_ipv4_address(const IPv4Address& add
|
|||
if (adapter->ipv4_address() == address)
|
||||
return adapter->make_weak_ptr();
|
||||
}
|
||||
if (address[0] == 127)
|
||||
return LoopbackAdapter::the().make_weak_ptr();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue