From 4043e770e5f00b7ed869226392599a94ccaf2000 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Mon, 15 Feb 2021 21:20:15 +0330 Subject: [PATCH] Kernel: Don't go through ARP for IP broadcast messages --- Kernel/Net/Routing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index 2c813c9afa..a7cc5f519c 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -205,6 +205,12 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c return { nullptr, {} }; } + // If it's a broadcast, we already know everything we need to know. + // FIXME: We should also deal with the case where `target_addr` is + // a broadcast to a subnet rather than a full broadcast. + if (target_addr == 0xffffffff && matches(adapter)) + return { adapter, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; + { LOCKER(arp_table().lock()); auto addr = arp_table().resource().get(next_hop_ip);