kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
ARPwatch Integration

The Kea nodes need to communicate with the ARPwatch daemon, providing information about currently valid leases and seen devices (i.e.

devices which have requested a lease).

The integration is split into two components: the exporter and the interface. While the exporter handles hook-triggered exports of lease information from the Kea DHCP server, the interface provides an endpoint for ARPwatch to make requests against a DHCP node.

ARPwatch Exporter (AAE)

The admindb-arpwatch-exporter (AAE) is a Kea hooks library, hooking into the lease selection and renewal procedure, thus processing every lease the DHCP server assigns to devices.

Leases are pushed to a queue in arpwatch::Exporter from where a separate thread processes lease information in several ways:

  • Entries are sent to a local Redis cache, containing the IP-to-MAC mapping of the lease for later retrieval. These entries automatically expire as the lease expires (but with some extra time to account for processing delays in ARPwatch)
  • Information about every lease is pushed to ARPwatch via XML-RPC to inform ARPwatch about the presence of the device, which in turn triggers ARPwatch checks and updates of the last-seen status in the AdminDB.

ARPwatch Interface (AAI)

The admindb-arpwatch-interface (AAI) is a standalone program, providing an XML-RPC endpoint for ARPwatch to request lease information. The endpoint allows ARPwatch to request the MAC address which currently holds the lease for a given IP address.

Requests are handled as follows:

  • aai::XmlRpcServer provides an XML-RPC server, listening for connections and receiving RPC calls.
  • When an RPC call occurs, the corresponding method in aai::ArpwatchRequestHandler is called, which fetches the requested information from the local Redis cache and returns it as the function result.
  • aai::XmlRpcServer takes the function result and returns it as a response to the RPC call.
Note
The result of an RPC call might be nil if there is no data to return. Consumers of the RPC interface must be prepared to handle nil results.