freebsd-dev/sys/netpfil/pf
Gleb Smirnoff 48278b8846 Once pf became not covered by a single mutex, many counters in it became
race prone. Some just gather statistics, but some are later used in
different calculations.

A real problem was the race provoked underflow of the states_cur counter
on a rule. Once it goes below zero, it wraps to UINT32_MAX. Later this
value is used in pf_state_expires() and any state created by this rule
is immediately expired.

Thus, make fields states_cur, states_tot and src_nodes of struct
pf_rule be counter(9)s.

Thanks to Dennis for providing me shell access to problematic box and
his help with reproducing, debugging and investigating the problem.

Thanks to:		Dennis Yusupoff <dyr smartspb.net>
Also reported by:	dumbbell, pgj, Rambler
Sponsored by:		Nginx, Inc.
2014-02-14 10:05:21 +00:00
..
if_pflog.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
if_pfsync.c Once pf became not covered by a single mutex, many counters in it became 2014-02-14 10:05:21 +00:00
in4_cksum.c
pf_altq.h Move new pf includes to the pf directory. The pfvar.h remain 2013-10-27 16:25:57 +00:00
pf_if.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
pf_ioctl.c Once pf became not covered by a single mutex, many counters in it became 2014-02-14 10:05:21 +00:00
pf_lb.c When pf_get_translation() fails, it should leave *sn pointer pristine, 2014-01-06 19:05:04 +00:00
pf_mtag.h Move new pf includes to the pf directory. The pfvar.h remain 2013-10-27 16:25:57 +00:00
pf_norm.c Move new pf includes to the pf directory. The pfvar.h remain 2013-10-27 16:25:57 +00:00
pf_osfp.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
pf_ruleset.c Provide includes that are needed in these files, and before were read 2013-10-26 18:18:50 +00:00
pf_table.c Provide includes that are needed in these files, and before were read 2013-10-26 18:18:50 +00:00
pf.c Once pf became not covered by a single mutex, many counters in it became 2014-02-14 10:05:21 +00:00
pf.h Fix incorrect header guard define in sys/netpfil/pf/pf.h, which snuck in 2013-12-22 19:47:22 +00:00