]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: Fix table entry counter toggling
authormarkj <markj@FreeBSD.org>
Wed, 2 Dec 2020 16:01:43 +0000 (16:01 +0000)
committermarkj <markj@FreeBSD.org>
Wed, 2 Dec 2020 16:01:43 +0000 (16:01 +0000)
commit64ae3320de665d004aa407f5e4e808b11e24b497
tree669c3f9518ec907a306b54533761fa0b247874a8
parentaae2f76c43bb98efe346af18510d57534e578843
pf: Fix table entry counter toggling

When updating a table, pf will keep existing table entry structures
corresponding to addresses that are in both of the old and new tables.
However, the update may also enable or disable per-entry counters which
are allocated separately.  Thus when toggling PFR_TFLAG_COUNTERS, the
entries may be missing counters or may have unused counters allocated.

Fix the problem by modifying pfr_ina_commit() to transfer counters
from or to entries in the shadow table.

PR: 251414
Reported by: sigsys@gmail.com
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27440
sys/netpfil/pf/pf_table.c