ARP maps IPv4 addresses to MAC (link-layer) addresses on a local network. When the IPv4 layer needs to send a packet to a destination, it uses ARP to find the destination's MAC address (or the gateway's MAC address for non-local destinations).
Security: DoS prevention.
The ARP cache distinguishes between trusted entries (configured by the user, e.g. the local IP address) and disposable entries (learned from the network). Disposable entries are subject to eviction under memory pressure, preventing an attacker from exhausting memory by flooding the network with ARP replies for many different addresses.
Daemon model.
create spawns a background daemon that processes incoming ARP requests and replies. The daemon responds to ARP requests for the locally configured IP address and updates the cache with ARP replies.
set_ips t ips sets the list of IPv4 addresses that this ARP instance responds to. ARP requests for any of these addresses will receive a reply with the local MAC address. These entries are marked as trusted (not disposable).
query t ipv4 resolves the MAC address for the given ipv4 address. If the address is already in the cache, the result is returned immediately. Otherwise, an ARP request is sent and the current Miou task is suspended until a reply is received (or timeout/retries are exhausted).
ask t ipv4 looks up ipv4 in the ARP cache without sending any ARP request. Returns Some mac if the address is cached, None otherwise.
Unlike query, this function never suspends the caller (no effects, no rescheduling). Useful when you want to check the cache speculatively without blocking.