From db2ede94271f58765873289a3b7d51bd731949bc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 9 Feb 2020 13:59:38 +0100 Subject: [PATCH] Net: Short-circuit routing to the IPv4 address of a local adapter This makes it possible to open http://localhost:8000/ in Browser. :^) --- Kernel/Net/Routing.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index cf8374c907..cb0d2b5e13 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -68,6 +68,10 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source) gateway_adapter = adapter; }); + + if (local_adapter && target == local_adapter->ipv4_address()) + return { local_adapter, local_adapter->mac_address() }; + if (!local_adapter && !gateway_adapter) { #ifdef ROUTING_DEBUG kprintf("Routing: Couldn't find a suitable adapter for route to %s\n",