[Bug 222126] pf is not clearing expired states

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Oct 1 15:39:15 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222126

--- Comment #32 from Kristof Provost <kp at freebsd.org> ---
(In reply to hlh from comment #31)
It's a little odd that you're seeing double pf_purge_expired_states:return
entries.
Any chance you've got two such probes in your dtrace script?

Anyway, let's stick a couple of static probes in and see what's going on:
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 8613a161f0a..f8244a6ef6e 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/md5.h>
 #include <sys/random.h>
 #include <sys/refcount.h>
+#include <sys/sdt.h>
 #include <sys/socket.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
@@ -105,6 +106,14 @@ __FBSDID("$FreeBSD$");

 #define        DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x

+/* DTrace static probes */
+SDT_PROVIDER_DEFINE(pf);
+
+SDT_PROBE_DEFINE(pf, purge, thread, wakeup);
+SDT_PROBE_DEFINE2(pf, purge, , expired_states,
+               "unsigned int",
+               "int");
+
 /*
  * Global variables
  */
@@ -1434,6 +1443,7 @@ pf_purge_thread(void *unused __unused)
        sx_xlock(&pf_end_lock);
        while (pf_end_threads == 0) {
                sx_sleep(pf_purge_thread, &pf_end_lock, 0, "pftm", hz / 10);
+               SDT_PROBE0(pf, purge, thread, wakeup);

                VNET_LIST_RLOCK();
                VNET_FOREACH(vnet_iter) {
@@ -1680,6 +1690,8 @@ pf_purge_expired_states(u_int i, int maxcheck)

        V_pf_status.states = uma_zone_get_cur(V_pf_state_z);

+       SDT_PROBE2(pf, purge, , expired_states, i, maxcheck);
+
        /*
         * Go through hash and unlink states that expire now.
         */

You can trace those with:
#!/usr/sbin/dtrace -s

pf:purge:thread:wakeup
{

}

pf:purge::expired_states
{
    printf("i %d maxentry %d %d", arg0, arg1, arg2);
}

Hopefully we'll get a clue as to what's going on with this.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-pf mailing list