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

(cherry picked from commit 2d2481c35f5a53322e982e47a2bb8f9085f525b7)
This commit is contained in:
Kristof Provost 2025-01-08 22:23:17 +01:00 committed by Franco Fichtner
parent efd622d007
commit de69fe0121

View File

@ -132,6 +132,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 *");
@ -6579,6 +6586,8 @@ pf_multihome_scan(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
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;
@ -6590,6 +6599,9 @@ pf_multihome_scan(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
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;
@ -6619,6 +6631,8 @@ pf_multihome_scan(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
if (! job)
return (PF_DROP);
SDT_PROBE2(pf, sctp, multihome_scan, ipv4, &t, op);
memcpy(&job->pd, pd, sizeof(*pd));
// New source address!
@ -6652,6 +6666,8 @@ pf_multihome_scan(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
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;
@ -6702,6 +6718,7 @@ pf_multihome_scan(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
return (PF_PASS);
}
int
pf_multihome_scan_init(struct mbuf *m, int start, int len, struct pf_pdesc *pd,
struct pfi_kkif *kif)