Update arp processing for ethernet

This commit is contained in:
Nico Schottelius 2019-04-02 17:22:21 +02:00
parent 09ad815e7c
commit 6e22465ae4
1 changed files with 7 additions and 2 deletions

View File

@ -336,12 +336,17 @@ Echo or Echo Reply Message
action arp_reply(mac_addr_t mac_addr) {
ipv4_addr_t tmp = hdr.arp.src_ipv4_addr;
hdr.arp.src_mac_addr = mac_addr;
hdr.arp.src_ipv4_addr = hdr.arp.dst_ipv4_addr;
/* fill the ethernet header */
hdr.ethernet.src_addr = mac_addr;
hdr.ethernet.dst_addr = hdr.arp.src_mac_addr;
/* fill the arp header */
hdr.arp.dst_mac_addr = hdr.arp.src_mac_addr;
hdr.arp.dst_ipv4_addr = tmp;
hdr.arp.src_mac_addr = mac_addr;
hdr.arp.src_ipv4_addr = hdr.arp.dst_ipv4_addr;
hdr.arp.opcode = ARP_REPLY;
}