From 31a438edf6a975d77d13958c9c3f1771998efd43 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 18 Jun 2024 12:31:51 +0200 Subject: [PATCH] nic_router: prevent ARP request without ARP waiter The router used to send an ARP request for a packet before allocating the corresponding ARP waiter. If the ARP waiter could not be allocated due to resource exhaustion plus emergency free failed, the packet got dropped and the router had produced unnecessary network traffic. The commit fixes this by sending only after successful allocation. Ref #4534 --- repos/os/src/server/nic_router/interface.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 4951e95ed3..ea9e1f524e 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -605,14 +605,14 @@ Packet_result Interface::_adapt_eth(Ethernet_frame ð, }, [&] /* handle_no_match */ () { - remote_domain.interfaces().for_each([&] (Interface &interface) - { - interface._broadcast_arp_request( - remote_ip_cfg.interface().address, hop_ip); - }); retry_once( [&] { new (_alloc) Arp_waiter { *this, remote_domain, hop_ip, pkt, _config_ptr->arp_request_timeout(), _timer }; + remote_domain.interfaces().for_each([&] (Interface &interface) + { + interface._broadcast_arp_request( + remote_ip_cfg.interface().address, hop_ip); + }); result = packet_postponed(); }, [&] { _try_emergency_free_quota(); },