mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
Kernel: Add a LoopbackAdapter for talking to yourself via 127.0.0.1.
Choosing adapter for transmit is done by adapter_for_route_to(IPv4Address). This is just hard-coded logic right now but can be expanded to support a proper routing table. Also start moving kernel networking code into Kernel/Net/.
This commit is contained in:
10
Kernel/Net/Routing.cpp
Normal file
10
Kernel/Net/Routing.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <Kernel/Net/Routing.h>
|
||||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
|
||||
NetworkAdapter* adapter_for_route_to(const IPv4Address& ipv4_address)
|
||||
{
|
||||
// FIXME: Have an actual routing table.
|
||||
if (ipv4_address == IPv4Address(127, 0, 0, 1))
|
||||
return &LoopbackAdapter::the();
|
||||
return NetworkAdapter::from_ipv4_address(IPv4Address(192, 168, 5, 2));
|
||||
}
|
||||
Reference in New Issue
Block a user