From 495490743cad6232e0d6029257987254a5105d3f Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 2 Jul 2018 12:25:15 +0200 Subject: [PATCH] nic_router: log ARP decisions when verbose In verbose mode, some types of ARP packets were handled without any log about what was done. Issue #2899 --- repos/os/src/server/nic_router/interface.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 101ee678d3..e508367468 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -1189,6 +1189,9 @@ void Interface::_handle_arp_reply(Ethernet_frame ð, * Packet targets IP local to the domain's subnet and doesn't target * the router. Thus, forward it to all other interfaces of the domain. */ + if (_config().verbose()) { + log("[", local_domain, "] forward ARP reply for local IP " + "to all interfaces of the sender domain"); } _domain_broadcast(eth, size_guard, local_domain); } } @@ -1231,11 +1234,17 @@ void Interface::_handle_arp_request(Ethernet_frame ð, } else if (arp.dst_ip() == local_intf.address) { /* ARP request for the routers IP at this domain */ + if (_config().verbose()) { + log("[", local_domain, "] answer ARP request for router IP " + "with router MAC"); } _send_arp_reply(eth, size_guard, arp); } else { /* forward request to all other interfaces of the domain */ + if (_config().verbose()) { + log("[", local_domain, "] forward ARP request for local IP " + "to all interfaces of the sender domain"); } _domain_broadcast(eth, size_guard, local_domain); } @@ -1250,6 +1259,9 @@ void Interface::_handle_arp_request(Ethernet_frame ð, } else { /* try to act as gateway for the domain as none is configured */ + if (_config().verbose()) { + log("[", local_domain, "] answer ARP request for foreign IP " + "with router MAC"); } _send_arp_reply(eth, size_guard, arp); } }