On Fri, Sep 05, 2025 at 10:11:46PM -0400, Jon Maloy wrote:
We add a cache table to keep partial contents of the kernel ARP/NDP tables. This way, we drastically reduce the number of netlink calls to read those tables.
We create placeholder cache entries representing non- or not-yet- existing ARP/NDP entries when needed. We add a short expiration time to each such entry, so that we can know when to make repeated calls to the kernel tables in the beginning. We also add an access counter to the entries, to ensure that the timer becomes longer and the call frequency abates over time if no ARP/NDP entry shows up.
For regular entries we use a much longer timer, with the purpose to update the entry in the rare case that a remote host changes its MAC address.
Signed-off-by: Jon Maloy
Sorry, another patch reminded me of something I missed on the first pass: [snip]
+static struct mac_cache_table mac_cache; +const uint8_t undefined_mac[6] = {0, 0, 0, 0, 0, 0};
We already have MAC_ZERO in util.h. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson