Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Apr 2021 11:44:13 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f4c02909167b - main - pf: Add static DTrace probe points
Message-ID:  <202104051144.135BiDYr039504@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=f4c02909167b6f791df470afddfe31cabf009c4d

commit f4c02909167b6f791df470afddfe31cabf009c4d
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-04-02 13:53:34 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-04-05 07:57:06 +0000

    pf: Add static DTrace probe points
    
    These two have proven to be useful during debugging. We may as well keep
    them permanently.
    Others will be added as their utility becomes clear.
    
    Reviewed by:    gnn
    MFC after:      2 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D29555
---
 sys/netpfil/pf/pf.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 5b41be4ad683..4b11122df544 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -59,6 +59,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>
@@ -112,6 +113,15 @@ __FBSDID("$FreeBSD$");
 
 #define	DPFPRINTF(n, x)	if (V_pf_status.debug >= (n)) printf x
 
+SDT_PROVIDER_DEFINE(pf);
+SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *",
+    "struct pf_state *");
+SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *",
+    "struct pf_state *");
+SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *",
+    "struct pf_state_key_cmp *", "int", "struct pf_pdesc *",
+    "struct pf_state *");
+
 /*
  * Global variables
  */
@@ -326,6 +336,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]);
 #define	STATE_LOOKUP(i, k, d, s, pd)					\
 	do {								\
 		(s) = pf_find_state((i), (k), (d));			\
+		SDT_PROBE5(pf, ip, state, lookup, i, k, d, pd, (s));	\
 		if ((s) == NULL)					\
 			return (PF_DROP);				\
 		if (PACKET_LOOPED(pd))					\
@@ -6318,6 +6329,8 @@ done:
 	if (s)
 		PF_STATE_UNLOCK(s);
 
+	SDT_PROBE4(pf, ip, test, done, action, reason, r, s);
+
 	return (action);
 }
 #endif /* INET */
@@ -6726,6 +6739,8 @@ done:
 	    (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL)
 		action = pf_refragment6(ifp, m0, mtag);
 
+	SDT_PROBE4(pf, ip, test6, done, action, reason, r, s);
+
 	return (action);
 }
 #endif /* INET6 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104051144.135BiDYr039504>