![]() |
Kea 3.1.1
|
Welcome to Kea's limits hook library. This documentation is addressed at developers who are interested in the internal workings of the library. This file provides information needed to understand and perhaps extend this library.
This documentation is stand-alone: you should have read and understood Kea Developer's Guide and in particular its section about hooks: Hooks Developer's Guide.
The limits hook library provides the ability to define limits on Kea's quantifiable features such as packet processing and lease allocation. The types of limiting currently implemented are:
n
leases are assigned at any one time.n
packets per time_unit
receive a response.The limits can be applied per client class or per subnet.
In addition to the requisite load() and unload() functions implemented in load_unload.cc:
The library implements the following callouts in dhcpv4_callouts.cc
and dhcpv6_callouts.cc:
There is an abstract base class responsible for parsing Kea configuration in configuration.cc
. In the same file, there are instantiable versions of that representing rate limiting, address limiting and prefix limiting configuration responsible for fetching the limits inside the user contexts of client classes and subnets.
The main logic for rate limiting revolves around keeping a circular buffer of time points. Each packet follows two steps:
The libdhcp_limits hook library is compatible with multi-threading.