]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: Fix vnet purging
authorkp <kp@FreeBSD.org>
Sun, 9 Jul 2017 17:56:39 +0000 (17:56 +0000)
committerkp <kp@FreeBSD.org>
Sun, 9 Jul 2017 17:56:39 +0000 (17:56 +0000)
commit683404221f539272641cfea4d2c20f4c039b7915
tree65bba520b89efc6671678e731de761d2ea1dd28a
parent075b75a28b8cb4f76403a56dba37ca09afdd823e
pf: Fix vnet purging

pf_purge_thread() breaks up the work of iterating all states (in
pf_purge_expired_states()) and tracks progress in the idx variable.

If multiple vnets exist this results in pf_purge_thread() only calling
pf_purge_expired_states() for part of the states (the first part of the
first vnet, second part of the second vnet and so on).
Combined with the mark-and-sweep approach to cleaning up old rules (in
V_pf_unlinked_rules) that resulted in pf freeing rules that were still
referenced by states. This in turn caused panics when pf_state_expires()
encounters that state and attempts to access the rule.

We need to track the progress per vnet, not globally, so idx is moved
into a per-vnet V_pf_purge_idx.

PR: 219251
Sponsored by: Hackathon Essen 2017
sys/netpfil/pf/pf.c