Hi all,
As part of a project course, I have to implement a basic IP router in P4. Right now, I am focusing on implementing ARP.
I have been able to program the switches to reply to ARP requests by specifying their own MAC address (i.e., the MAC address of the Ethernet port on which they receive the ARP request). The code is located at this repository. I did not use Mininet yet, but used Veth pairs, to teach myself how Mininet works internally. Sorry if it is not yet idiomatic, but I am P4 novice.
The next step is to make the switches able to resolve the MAC address of other hosts. Consider, for example, the scenario where a switch S (whose IP is 192.168.1.1) has to send an IP packet to a host H (192.168.1.2). To do so, S needs to known H’s MAC address to construct the packet’s Ethernet frame. Therefore, it needs to resolve it by sending an ARP request.
I have the following questions:
- Is it possible to do this using P4?
- What topics, sections of the P4 language specification, or examples should I focus on in order to understand how to achieve it?
I think that the P4 switch will need to put the IP packet in a queue / table, wait until the corresponding MAC address is resolved and then send it. This, however, also requires to implement some timers so that packet does not stay in the switch’s queue forever, wasting memory; so I don’t consider it trivial.
Moreover, I think that this has to do with packet recirculation/resubmission, but I still can’t connect the dots.
Thank you for any insight.