Re: LibAlias in FreeBSD

From: Lutz Donnerhacke <lutz_at_donnerhacke.de>
Date: Fri, 27 May 2022 15:35:52 UTC
On Fri, May 27, 2022 at 04:18:54PM +0300, Michael Pounov wrote:
> Hello Charles Mott
> 
> I wrote this mail about my work with IPFW firewall.
> I am started my work over IPFW Sync driver and protocol similar like in PF firewall.
> My primery goal is to do sync on NAT states in firewall router cluster. About it, I need to know when NAT driver add, readd or delete alias to be notify from libalias
> I see one good approach to achieve this, but I must to asking if existing hidden drawbacks for such approach the author of libalias.

As long as the callback is internal to the kernel, it might work.
libalias is CPU bound, any additional work will slow down the system,
especially when libalias is called from the interrupt level of network
drivers.

> What are you thinking about such approach, change and hook of the existing code?

One can think about a ringbuffer which is filled by libalias and read by a
different type of code. If the other code is too slow, the ringbuffer will
override the entries. Please do not consider a dynamically allocated buffer.