Index: pf.c =================================================================== RCS file: /cvs/src/sys/net/pf.c,v retrieving revision 1.1153 diff -u -p -r1.1153 pf.c --- pf.c 12 Nov 2022 02:48:14 -0000 1.1153 +++ pf.c 22 Nov 2022 00:29:30 -0000 @@ -1603,20 +1620,14 @@ pf_purge(void *null) { unsigned int interval = max(1, pf_default_rule.timeout[PFTM_INTERVAL]); - /* XXX is NET_LOCK necessary? */ - NET_LOCK(); - - PF_LOCK(); - + rw_enter_write(&pf_lock); /* PF_LOCK() without NET_LOCK() */ pf_purge_expired_src_nodes(); - - PF_UNLOCK(); + rw_exit_write(&pf_lock); /* PF_UNLOCK() without NET_LOCK() */ /* * Fragments don't require PF_LOCK(), they use their own lock. */ pf_purge_expired_fragments(); - NET_UNLOCK(); /* interpret the interval as idle time between runs */ timeout_add_sec(&pf_purge_to, interval); @@ -1891,9 +1902,8 @@ pf_purge_expired_states(const unsigned i if (SLIST_EMPTY(&gcl)) return (scanned); - NET_LOCK(); rw_enter_write(&pf_state_list.pfs_rwl); - PF_LOCK(); + rw_enter_write(&pf_lock); /* PF_LOCK() without NET_LOCK() */ PF_STATE_ENTER_WRITE(); SLIST_FOREACH(st, &gcl, gc_list) { if (st->timeout != PFTM_UNLINKED) @@ -1902,9 +1912,8 @@ pf_purge_expired_states(const unsigned i pf_free_state(st); } PF_STATE_EXIT_WRITE(); - PF_UNLOCK(); + rw_exit_write(&pf_lock); /* PF_UNLOCK() without NET_LOCK() */ rw_exit_write(&pf_state_list.pfs_rwl); - NET_UNLOCK(); while ((st = SLIST_FIRST(&gcl)) != NULL) { SLIST_REMOVE_HEAD(&gcl, gc_list);