From nobody Tue Feb 4 21:14:11 2025 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 4Ynbhh1dqvz5mTTq; Tue, 04 Feb 2025 21:14:12 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ynbhh0cJ8z3bPb; Tue, 04 Feb 2025 21:14:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738703652; 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=09tfy9ekXpnLnEG40cDw/VZRge5PbJ5/QpmM1j7Bc3U=; b=Nz0sj7deZOxLh6hbSuyvJ/ppTvgQxvxA/P3bZlUHdcynbtWu/ElbE4L5PCIRnsLBe+9Cj2 PJ38LlXLT/wkMMtXGqteU5AEPvct/fjrqwK9uF1vNcoKtbOTW5RS5A+0m04cCTwG1UHP4f itH+FBbqZOR43v19cMZmXP//L3B6HtfNKKeirLSqSwVe+YrAtJAx5Son9uevPMZSUJ2zDd mOqP9OcgiNV39XSj5aDpmsbxgYjyc7ZYhAVuBVT9ig7G5pR5qqjrk3nlGUcuy1llSqG5M2 XyEr6EBChf1mf2HveCBoNZUVdvPSjBwViIdfsFe747Gc0yXIEEctKTCHpOV7Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738703652; 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=09tfy9ekXpnLnEG40cDw/VZRge5PbJ5/QpmM1j7Bc3U=; b=nzIyXRlleRqYikLORI2NUlS50w9M5cKLViPJkpNjLazLysH5usE0yPpuJuQvz1XVYTUp5w x3L2UAbxsEhDUGtnTjZqLWzJDI4QpQ8CGz2VzmcHpTr6g8YwJps4RyluJLbrkNypb/tLtd K1ekCkznWIQ9h4i84Ftxzec3dVT6zfXyVcMMQLpfi9GVuYxxM0epQTrOvvCfoBx1u0Ly3S JcqLPGSzdxpGIPXZcfjM3S8ZSTPAUT23FxJ5ooTzWbGNkuh7szHak52BruGdmZtlSkyKhY 0EhIvrnhnDxXmaGqKxKx+q2UKRG705hhXBTILycOOn3FdKrpudxv8r7Gt7H8QA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1738703652; a=rsa-sha256; cv=none; b=JckH0ar8t9MiEnk/y2THNObZ7JmZ64NT0roHZnEWv3TnLCaClP9WPlA48WfVdIatOsG6Sn hhAdkPzBygfJ+OSNAFjbPqYt1/qZ8aD7FW61OUmEcL2nfYu6QQQS3/8StTR3ccztfWVXzf rMjrA01o/2GnQGzBqvxkFhoNOcuWNhJrpYs7zAkIl1byqQ85E/1+N6dNGlHU8cFVZnvznw 5qdzhngfn2G3UdZgxVtTPyAWAn4Ef4gxY6Wja/LLhTWPD1bVquItqDIVWMhIoW0nM40Yad CxvROBHL2kj4x0zjo2n3OMW1IOeKiK1YlZkFDHPqNaQ6XHiqTpaG52poTk/PZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ynbhh07gGz7W5; Tue, 04 Feb 2025 21:14:12 +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 514LEB5c039524; Tue, 4 Feb 2025 21:14:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 514LEBuj039521; Tue, 4 Feb 2025 21:14:11 GMT (envelope-from git) Date: Tue, 4 Feb 2025 21:14:11 GMT Message-Id: <202502042114.514LEBuj039521@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: 1f4c3887e3fa - main - pfil: set PFIL_FWD for IPv4 forwarding 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: 1f4c3887e3fad411914ddc729fce175d5613e2b4 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1f4c3887e3fad411914ddc729fce175d5613e2b4 commit 1f4c3887e3fad411914ddc729fce175d5613e2b4 Author: Kristof Provost AuthorDate: 2025-01-31 15:53:34 +0000 Commit: Kristof Provost CommitDate: 2025-02-04 20:56:06 +0000 pfil: set PFIL_FWD for IPv4 forwarding Just like we already do for IPv6 set the PFIL_FWD flag when we're forwarding IPv4 traffic. This allows firewalls to make more precise decisions. Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D48824 --- sys/netinet/ip_fastfwd.c | 2 +- sys/netinet/ip_output.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c index 6d34ba4f5420..7a80cce908c1 100644 --- a/sys/netinet/ip_fastfwd.c +++ b/sys/netinet/ip_fastfwd.c @@ -401,7 +401,7 @@ passin: if (!PFIL_HOOKED_OUT(V_inet_pfil_head)) goto passout; - if (pfil_mbuf_out(V_inet_pfil_head, &m, nh->nh_ifp, + if (pfil_mbuf_fwd(V_inet_pfil_head, &m, nh->nh_ifp, NULL) != PFIL_PASS) goto drop; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 9317d5d57e1d..d0dbd22512f0 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -112,13 +112,19 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, int flags, struct mbuf *m; struct in_addr odst; struct ip *ip; + int ret; m = *mp; ip = mtod(m, struct ip *); /* Run through list of hooks for output packets. */ odst.s_addr = ip->ip_dst.s_addr; - switch (pfil_mbuf_out(V_inet_pfil_head, mp, ifp, inp)) { + if (flags & IP_FORWARDING) + ret = pfil_mbuf_fwd(V_inet_pfil_head, mp, ifp, inp); + else + ret = pfil_mbuf_out(V_inet_pfil_head, mp, ifp, inp); + + switch (ret) { case PFIL_DROPPED: *error = EACCES; /* FALLTHROUGH */