mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
718bea73b3
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/.
10 lines
357 B
C++
10 lines
357 B
C++
#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));
|
|
}
|