Page MenuHomeFreeBSD

D31741.id94417.diff
No OneTemporary

D31741.id94417.diff

Index: sys/netpfil/pf/pf.c
===================================================================
--- sys/netpfil/pf/pf.c
+++ sys/netpfil/pf/pf.c
@@ -122,6 +122,15 @@
"struct pf_state_key_cmp *", "int", "struct pf_pdesc *",
"struct pf_kstate *");
+SDT_PROBE_DEFINE3(pf, eth, test_rule, entry, "int", "struct ifnet *",
+ "struct mbuf *");
+SDT_PROBE_DEFINE2(pf, eth, test_rule, test, "int", "struct pf_keth_rule *");
+SDT_PROBE_DEFINE3(pf, eth, test_rule, mismatch,
+ "int", "struct pf_keth_rule *", "char *");
+SDT_PROBE_DEFINE2(pf, eth, test_rule, match, "int", "struct pf_keth_rule *");
+SDT_PROBE_DEFINE2(pf, eth, test_rule, final_match,
+ "int", "struct pf_keth_rule *");
+
/*
* Global variables
*/
@@ -3501,6 +3510,8 @@
MPASS(kif->pfik_ifp->if_vnet == curvnet);
NET_EPOCH_ASSERT();
+ SDT_PROBE3(pf, eth, test_rule, entry, dir, kif->pfik_ifp, m);
+
e = mtod(m, struct ether_header *);
settings = ck_pr_load_ptr(&V_pf_keth);
@@ -3509,21 +3520,39 @@
while (r != NULL) {
counter_u64_add(r->evaluations, 1);
- if (pfi_kkif_match(r->kif, kif) == r->ifnot)
+ SDT_PROBE2(pf, eth, test_rule, test, r->nr, r);
+
+ if (pfi_kkif_match(r->kif, kif) == r->ifnot) {
+ SDT_PROBE3(pf, eth, test_rule, mismatch, r->nr, r,
+ "kif");
r = r->skip[PFE_SKIP_IFP].ptr;
- else if (r->direction && r->direction != dir)
+ }
+ else if (r->direction && r->direction != dir) {
+ SDT_PROBE3(pf, eth, test_rule, mismatch, r->nr, r,
+ "dir");
r = r->skip[PFE_SKIP_DIR].ptr;
- else if (r->proto && r->proto != ntohs(e->ether_type))
+ }
+ else if (r->proto && r->proto != ntohs(e->ether_type)) {
+ SDT_PROBE3(pf, eth, test_rule, mismatch, r->nr, r,
+ "proto");
r = r->skip[PFE_SKIP_PROTO].ptr;
- else if (! pf_match_eth_addr(e->ether_shost, &r->src))
+ }
+ else if (! pf_match_eth_addr(e->ether_shost, &r->src)) {
+ SDT_PROBE3(pf, eth, test_rule, mismatch, r->nr, r,
+ "src");
r = r->skip[PFE_SKIP_SRC_ADDR].ptr;
+ }
else if (! pf_match_eth_addr(e->ether_dhost, &r->dst)) {
+ SDT_PROBE3(pf, eth, test_rule, mismatch, r->nr, r,
+ "dst");
r = TAILQ_NEXT(r, entries);
}
else {
/* Rule matches */
rm = r;
+ SDT_PROBE2(pf, eth, test_rule, match, r->nr, r);
+
if (r->quick)
break;
@@ -3533,6 +3562,8 @@
r = rm;
+ SDT_PROBE2(pf, eth, test_rule, final_match, (r != NULL ? r->nr : -1), r);
+
/* Default to pass. */
if (r == NULL)
return (PF_PASS);

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 4, 12:58 PM (8 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40190008
Default Alt Text
D31741.id94417.diff (2 KB)

Event Timeline