git: 2d2481c35f5a - main - pf: add extra SCTP multihoming probe points

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 15 Jan 2025 22:06:42 UTC
The branch main has been updated by kp:

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

commit 2d2481c35f5a53322e982e47a2bb8f9085f525b7
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-08 21:23:17 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-15 22:02:42 +0000

    pf: add extra SCTP multihoming probe points
    
    Add probe points in the SCTP multihome parsing code. This is intended to help
    debug a multihome issue, and is expected to be generally useful, so will be
    included for everyone.
    
    MFC after:      2 weeks
    Sponsored by:   Orange Business Services
---
 sys/netpfil/pf/pf.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 053b0b2ccb31..a49216a9dc20 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -140,6 +140,13 @@ SDT_PROBE_DEFINE2(pf, sctp, multihome, add, "uint32_t",
     "struct pf_sctp_source *");
 SDT_PROBE_DEFINE3(pf, sctp, multihome, remove, "uint32_t",
     "struct pf_kstate *", "struct pf_sctp_source *");
+SDT_PROBE_DEFINE4(pf, sctp, multihome_scan, entry, "int",
+    "int", "struct pf_pdesc *", "int");
+SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, param, "uint16_t", "uint16_t");
+SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, ipv4, "struct in_addr *",
+    "int");
+SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, ipv6, "struct in_addr6 *",
+    "int");
 
 SDT_PROBE_DEFINE3(pf, eth, test_rule, entry, "int", "struct ifnet *",
     "struct mbuf *");
@@ -7493,6 +7500,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op)
 	int			 off = 0;
 	struct pf_sctp_multihome_job	*job;
 
+	SDT_PROBE4(pf, sctp, multihome_scan, entry, start, len, pd, op);
+
 	while (off < len) {
 		struct sctp_paramhdr h;
 
@@ -7504,6 +7513,9 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op)
 		if (ntohs(h.param_length) < 4)
 			return (PF_DROP);
 
+		SDT_PROBE2(pf, sctp, multihome_scan, param, ntohs(h.param_type),
+		    ntohs(h.param_length));
+
 		switch (ntohs(h.param_type)) {
 		case  SCTP_IPV4_ADDRESS: {
 			struct in_addr t;
@@ -7533,6 +7545,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op)
 			if (! job)
 				return (PF_DROP);
 
+			SDT_PROBE2(pf, sctp, multihome_scan, ipv4, &t, op);
+
 			memcpy(&job->pd, pd, sizeof(*pd));
 
 			// New source address!
@@ -7566,6 +7580,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op)
 			if (! job)
 				return (PF_DROP);
 
+			SDT_PROBE2(pf, sctp, multihome_scan, ipv6, &t, op);
+
 			memcpy(&job->pd, pd, sizeof(*pd));
 			memcpy(&job->src, &t, sizeof(t));
 			job->pd.src = &job->src;
@@ -7616,6 +7632,7 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op)
 
 	return (PF_PASS);
 }
+
 int
 pf_multihome_scan_init(int start, int len, struct pf_pdesc *pd)
 {