From nobody Thu Feb 9 16:11:23 2023 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 4PCMLN11Jvz3pl5g; Thu, 9 Feb 2023 16:11:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PCMLN0RQvz4J8P; Thu, 9 Feb 2023 16:11:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675959084; 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=m8moc6Hj/jYDCTFeBMEsH6LUYjip6xh0rnQS9ba3Df8=; b=jgV4PUIpFSR6aQf26gES17+LPwwrw40kmow/WWmtUmsPNo12opscjFsapYkSPogFipkEjc 0wuKIegCV0ra7n7Fb2ePSxF+MSoyoYK5qkk1F7yPySpXCd0h1qFTRaE9B4m57mX2xlasmI dSn32GeHq9xnFVk5nLbKgkfIP3BPgWiYjT5i3yTTdzhBOgB0Hp7uAByTGmMxgztS7KxaTe csNjlbSKf5qTHqMALFKpeKkMh7kOcwxldIdWNCU+L6jZQba6it6LnFJFGO+na+klCKxizU U6iRaXW5x2enPpmWUudwVFwqYnGPEuj5ntGWWdrhXPbS1Y2hB7UmBjTh4ePVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675959084; 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=m8moc6Hj/jYDCTFeBMEsH6LUYjip6xh0rnQS9ba3Df8=; b=hjcTimlWxspxJd60Jamy/8Cu4gHlos+70qZUREKkL9PaJSHokD61Yurqoz+p3acouNZaWk ze7NbgGr/ULyqWv8zEwfLfgZRg+1x2h8m3w/3jbEXyabliwNEPkLL4xK6ORe6eLSbpAuFZ Qt1pacJOq7XKnsNB/BoOynor9Uir9B32j/Y+BQkh+IOzhabKhV8ZLZ+oVCOdhPECOdPMS3 C49QE/E5JhnedhW0AmiuSfos0Qslp3mYKIEpNfotSveYNVU7iUvDga7C6qOhpdJD6vx+Rv menpFBB5wr2Ep33ZT8F4btnBOEED1hzVklr5ulknMldz4FaS+pzlKRsFVW98uA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675959084; a=rsa-sha256; cv=none; b=DmL1Fhi/TbgPZVg6UPCLv5ASG8Ae0fWZfHcKoewc2d3wBFab8M47HSZFWa5gIYY+p7MXrX 0Jz03e0uFBUmN+J3UdqZD/vNy9BrSP9pYADGjj0nvb8ULTNz6ReAv5f16DT9OLQsKX5oaE 5cW7Q/YV3h9d9fgVV1AeaN+BCjD3+5BbeSi0hs/zcG2s9xm3h4NmDixgMUg6UaoP0d/2+/ vIS3BGNAFmflvMJjohvacFKBaYhjya6LrdxNtGO9SpsYbwb8G+LLRtg42P9POPKf1A2e8Q 2QayOa1U3hRTHHoqOp53MkzD8l8w0L7E9fENwzBFsUM+GGiDm6M+gjqDo8ZdZw== 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 4PCMLM6dXMzk2p; Thu, 9 Feb 2023 16:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 319GBN4m005429; Thu, 9 Feb 2023 16:11:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 319GBNop005428; Thu, 9 Feb 2023 16:11:23 GMT (envelope-from git) Date: Thu, 9 Feb 2023 16:11:23 GMT Message-Id: <202302091611.319GBNop005428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4a35f2056381 - stable/13 - netinet6: honor blackhole/unreach routes in the non-fastforwading code. 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a35f20563812b2d21784989651878e3a2d837d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4a35f20563812b2d21784989651878e3a2d837d8 commit 4a35f20563812b2d21784989651878e3a2d837d8 Author: Alexander V. Chernikov AuthorDate: 2023-01-22 16:57:36 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-09 15:46:09 +0000 netinet6: honor blackhole/unreach routes in the non-fastforwading code. Currently, under the conditions specified below, IPv6 ingress packet processing can ignore blackhole/reject flag on the prefix. The packet will instead be looped locally till TTL expiration and a single ICMPv6 unreachable message will be send to the source even in case of RTF_BLACKHOLE. The following conditions needs hold to make the scenario happen: * IPv6 forwarding is enabled * Packet is not fast-forwarded * Destination prefix has either RTF_BLACKHOLE or RTF_REJECT flag Fix this behavior by checking for the blackhole/reject flags in ip6_forward(). Reported by: Dmitriy Smirnov Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D38164 MFC after: 3 days (cherry picked from commit 30dd227cff75bdabaac2002a2b17095f3392a485) --- sys/netinet6/ip6_forward.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index d4306eea416f..7e4b08672726 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -196,6 +196,15 @@ again: goto bad; } + if (nh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) { + IP6STAT_INC(ip6s_cantforward); + if ((nh->nh_flags & NHF_REJECT) && (mcopy != NULL)) { + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_REJECT, 0); + } + goto bad; + } + /* * Source scope check: if a packet can't be delivered to its * destination for the reason that the destination is beyond the scope