From nobody Wed Nov 13 20:32:00 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XpZhJ3Nwsz5cXbW; Wed, 13 Nov 2024 20:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XpZhJ2skJz4LfG; Wed, 13 Nov 2024 20:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731529920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zZ977j6aDGm7jN8/M5zOv6TTb92VruIl2pSgkuP4Nco=; b=U04ya3cP0mmeQmu9jJxqOqKa8y2u9DPfWUuBIbfCZu0ZE9Tv9DvvpP2cGWQhJhrKYEwuVp kFBCt9hVd13rd6LC9BFABHHQk2jbTh9pUcEE/Kfsnenq2r/yTEgA15VMPVBNAq8F/hnBTb yI/Hxsbx5sbun8YwoSJez/QfdSSuVLh/xHoerq0cYy/lT6bcKGWBm1jf7toqUiWTUyn81U 2kpVhTSRuHcriWHNQgpsORnA7o5rNUoNgOvZdeJcK7dEloBJpKhEoJtMuzY1qhWCD8nJiz rXR9bq7JOqCycPXMkRJ7+f+EoYOQN169AKcwJShdiFGdV4VdryDZtsBA6MZBrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731529920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zZ977j6aDGm7jN8/M5zOv6TTb92VruIl2pSgkuP4Nco=; b=dnXkg4l9cDrHXkddzwM86vztr7OZUiRb+nlRgLoWKuQVgrnC0egac7hVNzJfWW0IEKO+xx ut8EWTE6giANJw+krGs7FvxCO3UsRfFd2WfMvxzoGn+/eNSLjdbs8p0mi7Or4cmqFuf0IV lO4N1Gbu1Ybb4keTui2FopcuEh8haXgrbuBFckHjBdPWjG6PUeB/kRi2sOiT0XZINhGmIX 925PEhiRDnd2R39UwNNiv1JHc+2xybPSuUAYoUV+OtVxpkj4BklP0kJM6VPs0h44klnuMk KXS9ii1cd7VQhhp5VyTK0h95paO7NXSkZCc8VrgtIp/ikf3pJcqBaZ2mzWs2PQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731529920; a=rsa-sha256; cv=none; b=wtqtQxMk5t6SADLk8A02LNKVNsDMd83vM8AsVr2Yzy8kl2kSTCofKwdxtX+7fHtNGFBfnm JJdLJ7Oxy2skoZmadKhrbGuLR3ZsjKv4Q9GpR++5CwZDIGl2q2Vra33IPMmRsHIvWKwV80 7cxZGCcAPGjpYMGGgKpgEdSpdF1YxIWj0sVhy+Worh9AMOGu3cGHh4625CIaIIz2Brm8WE tLUVbDqzw7tDEs5Q9iyJXGlt4haCumcwS8mJDeOsjI76WaKPsWVPRNV8iYM1mMOqe2xakE 17F+BbOzCYlIYyY8keOXlX5pjx7+QvZ/TucTk3uVcpZOLW099ISIY2wPLo6udw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XpZhJ2LtTz17y7; Wed, 13 Nov 2024 20:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ADKW0UE058190; Wed, 13 Nov 2024 20:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ADKW0dj058187; Wed, 13 Nov 2024 20:32:00 GMT (envelope-from git) Date: Wed, 13 Nov 2024 20:32:00 GMT Message-Id: <202411132032.4ADKW0dj058187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ac5e30a8073f - main - pf: add probe points to pf_route(6)() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac5e30a8073f95a4764c939cde29adae51229bdd Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ac5e30a8073f95a4764c939cde29adae51229bdd commit ac5e30a8073f95a4764c939cde29adae51229bdd Author: Kristof Provost AuthorDate: 2024-11-13 10:26:39 +0000 Commit: Kristof Provost CommitDate: 2024-11-13 20:26:28 +0000 pf: add probe points to pf_route(6)() Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 71 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 691cb697a659..daf3fcf567ad 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -126,6 +126,14 @@ SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_kstate *"); SDT_PROBE_DEFINE2(pf, ip, , bound_iface, "struct pf_kstate *", "struct pfi_kkif *"); +SDT_PROBE_DEFINE4(pf, ip, route_to, entry, "struct mbuf *", + "struct pf_pdesc *", "struct pf_kstate *", "struct ifnet *"); +SDT_PROBE_DEFINE1(pf, ip, route_to, drop, "int"); +SDT_PROBE_DEFINE2(pf, ip, route_to, output, "struct ifnet *", "int"); +SDT_PROBE_DEFINE4(pf, ip6, route_to, entry, "struct mbuf *", + "struct pf_pdesc *", "struct pf_kstate *", "struct ifnet *"); +SDT_PROBE_DEFINE1(pf, ip6, route_to, drop, "int"); +SDT_PROBE_DEFINE2(pf, ip6, route_to, output, "struct ifnet *", "int"); SDT_PROBE_DEFINE4(pf, sctp, multihome, test, "struct pfi_kkif *", "struct pf_krule *", "struct mbuf *", "int"); SDT_PROBE_DEFINE2(pf, sctp, multihome, add, "uint32_t", @@ -7660,6 +7668,8 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); + SDT_PROBE4(pf, ip, route_to, entry, *m, pd, s, oifp); + if (s) { r_rt = s->rt; r_dir = s->direction; @@ -7677,6 +7687,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, pd->pf_mtag->routed++ > 3) { m0 = *m; *m = NULL; + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad_locked; } @@ -7699,6 +7710,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } else { m0 = *m; *m = NULL; + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; } } else { @@ -7732,6 +7744,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if (TAILQ_EMPTY(&r->rpool.list)) { DPFPRINTF(PF_DEBUG_URGENT, ("%s: TAILQ_EMPTY(&r->rpool.list)\n", __func__)); + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad_locked; } pf_map_addr(AF_INET, r, (struct pf_addr *)&ip->ip_src, @@ -7764,18 +7777,24 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, PF_STATE_UNLOCK(s); } - if (ifp == NULL) + if (ifp == NULL) { + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; + } if (pd->dir == PF_IN) { if (pf_test(AF_INET, PF_OUT, PFIL_FWD, ifp, &m0, inp, - &pd->act) != PF_PASS) + &pd->act) != PF_PASS) { + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; - else if (m0 == NULL) + } else if (m0 == NULL) { + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto done; + } if (m0->m_len < sizeof(struct ip)) { DPFPRINTF(PF_DEBUG_URGENT, ("%s: m0->m_len < sizeof(struct ip)\n", __func__)); + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; } ip = mtod(m0, struct ip *); @@ -7834,8 +7853,10 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, md = m0; error = pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); - if (md != NULL) + if (md != NULL) { error = (*ifp->if_output)(ifp, md, sintosa(&dst), NULL); + SDT_PROBE2(pf, ip, route_to, output, ifp, error); + } goto done; } @@ -7851,14 +7872,19 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, icmp_error(m0, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, ifp->if_mtu); + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto done; - } else + } else { + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; + } } error = ip_fragment(ip, &m0, ifp->if_mtu, ifp->if_hwassist); - if (error) + if (error) { + SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; + } for (; m0; m0 = m1) { m1 = m0->m_nextpkt; @@ -7869,9 +7895,11 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, pd->pf_mtag = pf_find_mtag(md); error = pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); - if (md != NULL) + if (md != NULL) { error = (*ifp->if_output)(ifp, md, sintosa(&dst), NULL); + SDT_PROBE2(pf, ip, route_to, output, ifp, error); + } } else m_freem(m0); } @@ -7908,6 +7936,8 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); + SDT_PROBE4(pf, ip6, route_to, entry, *m, pd, s, oifp); + if (s) { r_rt = s->rt; r_dir = s->direction; @@ -7925,6 +7955,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, pd->pf_mtag->routed++ > 3) { m0 = *m; *m = NULL; + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad_locked; } @@ -7947,6 +7978,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } else { m0 = *m; *m = NULL; + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; } } else { @@ -7980,6 +8012,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if (TAILQ_EMPTY(&r->rpool.list)) { DPFPRINTF(PF_DEBUG_URGENT, ("%s: TAILQ_EMPTY(&r->rpool.list)\n", __func__)); + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad_locked; } pf_map_addr(AF_INET6, r, (struct pf_addr *)&ip6->ip6_src, @@ -8014,19 +8047,25 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if (s) PF_STATE_UNLOCK(s); - if (ifp == NULL) + if (ifp == NULL) { + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; + } if (pd->dir == PF_IN) { if (pf_test(AF_INET6, PF_OUT, PFIL_FWD, ifp, &m0, inp, - &pd->act) != PF_PASS) + &pd->act) != PF_PASS) { + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; - else if (m0 == NULL) + } else if (m0 == NULL) { + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto done; + } if (m0->m_len < sizeof(struct ip6_hdr)) { DPFPRINTF(PF_DEBUG_URGENT, ("%s: m0->m_len < sizeof(struct ip6_hdr)\n", __func__)); + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; } ip6 = mtod(m0, struct ip6_hdr *); @@ -8051,8 +8090,11 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) { md = m0; pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); - if (md != NULL) - nd6_output_ifp(ifp, ifp, md, &dst, NULL); + if (md != NULL) { + int ret; + ret = nd6_output_ifp(ifp, ifp, md, &dst, NULL); + SDT_PROBE2(pf, ip6, route_to, output, ifp, ret); + } } else { in6_ifstat_inc(ifp, ifs6_in_toobig); @@ -8063,8 +8105,11 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, sizeof(struct ip6_hdr), s); icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); - } else + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); + } else { + SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; + } } done: