CVSROOT: /cvs Module name: src Changes by: sas...@cvs.openbsd.org 2023/04/28 08:08:38
Modified files: sbin/pfctl : pfctl.c sys/net : pf_ioctl.c pf_ruleset.c pfvar.h pfvar_priv.h Log message: This change speeds up DIOCGETRULE ioctl(2) which pfctl(8) uses to retrieve rules from kernel. The current implementation requires like O((n^2)/2) operation to read the complete rule set, because each DIOCGETRULE operation must iterate over previous n rules to find (n + 1)-th rule to read. To address the issue diff introduces a pf_trans structure to keep pointer to next rule to read, thus reading process does not need to iterate from beginning of rule set to reach the next rule. All transactions opened by process get closed either when process is done (reads all rules) or when /dev/pf device is closed. the diff also comes with lots of improvements from dlg@ and kn@ OK dlg@, kn@