]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pfctl: improve rule load times with thousands of interfaces
authorkp <kp@FreeBSD.org>
Thu, 19 Mar 2020 12:54:43 +0000 (12:54 +0000)
committerkp <kp@FreeBSD.org>
Thu, 19 Mar 2020 12:54:43 +0000 (12:54 +0000)
commit0080e7ebdf964366f4e6c40d8f3637e8022a90b5
tree08f710471dd63b48cf06e842b7a9a06720d2f5bb
parent4d92686d2b95838023532c8c80c4918cf583040d
pfctl: improve rule load times with thousands of interfaces

r343287 / D18759 introduced ifa_add_groups_to_map() which is now run by
ifa_load/ifa_lookup/host_if. When loading an anchor or ruleset via pfctl that
does NOT contain ifnames as hosts, host() still ends up iterating all
interfaces twice, grabbing SIOCGIFGROUP ioctl twice for each. This adds an
unnecessary amount of time on systems with thousands or tens of thousands of
interfaces.

Prioritize the IPv4/6 check over the interface name lookup, which skips loading
the iftab and iterating all interfaces when the configuration does not contain
interface names.

Submitted by: Nick Rogers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24100
sbin/pfctl/pfctl_parser.c