Title: arp_main()


arp_main(arp_port) is called in two places during the initialization of the network service. The first time arp_main() is called is by arp_set_cb(), which is in the ip code. During this call, arp_main() opens an ethernet file descriptor for the arp port arp_port, arp_main()'s only parameter and retrieves the ethernet address of the ethernet file descriptor's underlying ethernet port, with which it sets the arp port's ap_ethaddr field.

arp_set_ipaddr() calls arp_main() the second time. During this call, the arp table (which is also referred to as the arp cache) is initialized and the ethernet file descriptor previously opened is configured with values appropriate for an ethernet file descriptor supporting an arp port. After configuring the file descriptor, setup_read() is called.