Page MenuHomeFreeBSD

D31741.id95942.diff
No OneTemporary

D31741.id95942.diff

Index: sys/netpfil/pf/pf.c
===================================================================
--- sys/netpfil/pf/pf.c
+++ sys/netpfil/pf/pf.c
@@ -129,6 +129,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
*/
@@ -3594,6 +3603,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);
@@ -3602,21 +3613,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;
@@ -3626,6 +3655,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
Wed, Jul 22, 12:31 PM (14 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35364204
Default Alt Text
D31741.id95942.diff (2 KB)

Event Timeline