Skip to content

Commit

Permalink
pf: add extra SCTP multihoming probe points
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
kprovost authored and fichtner committed Feb 18, 2025
1 parent efd622d commit de69fe0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sys/netpfil/pf/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *");
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de69fe0

Please sign in to comment.