From a73ef9fc062983490addbad61e6ad7910ceaff14 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 29 Jan 2020 14:49:26 +0100 Subject: [PATCH] app/ping: fix destination MAC on ARP replies The ARP destination MAC was set to the Ethernet source MAC which is not necessarily the MAC of the other ARP peer. Instead use the ARP source MAC of the ARP request. --- repos/os/src/app/ping/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/os/src/app/ping/main.cc b/repos/os/src/app/ping/main.cc index a3966f285..89c584efa 100644 --- a/repos/os/src/app/ping/main.cc +++ b/repos/os/src/app/ping/main.cc @@ -481,7 +481,7 @@ void Main::_send_arp_reply(Ethernet_frame &req_eth, arp.opcode(Arp_packet::REPLY); arp.src_mac(_nic.mac()); arp.src_ip(ip_config().interface.address); - arp.dst_mac(req_eth.src()); + arp.dst_mac(req_arp.src_mac()); arp.dst_ip(req_arp.src_ip()); }); }