CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2020/08/24 09:30:58

Modified files:
        sys/net        : if_pfsync.c pf_ioctl.c pfvar.h 

Log message:
Remove ptr_array from struct pf_ruleset

Each ruleset's rules are stored in a TAILQ called "ptr" with "rcount"
representing the number of rules in the ruleset;  "ptr_array" points to an
array of the same length.

"ptr" is backed by pool_get(9) and may change in size as "expired" rules
get removed from the ruleset - see "once" in pf.conf(5).

"ptr_array" is allocated momentarily through mallocarray(9) and gets filled
with the TAILQ entries, so that the sole user pfsync(4) can access the list
of rules by index to pick the n-th rule during state insertion.

Remove "ptr_array" and make pfsync iterate over the TAILQ instead to get the
matching rule's index.  This simplifies both code and data structures and
avoids duplicate memory management.

OK sashan

Reply via email to