From nobody Sun Jan 22 18:50:36 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 4P0MkN5Yx5z3NNwW; Sun, 22 Jan 2023 18:50:36 +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 4P0MkN53zKz3nWr; Sun, 22 Jan 2023 18:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674413436; 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=o0xn2f/wuAguJUUtPOE2uKmd1UaiRtHd3e8Y5cI65t4=; b=SVBpjDT6080I+/l/BVfleS5fPsphcqVnMgWRVZbbEABC55mdvQv0tlw+i9hBD16dXJ2ay0 4yR4ypJ30mU8xH9CLkNh6754Q5AziifEfrqZit41FkE0fF3FCgux/ICOB6bpu7KQ0maiMT xcDsHaH4rRm5uUIjeC5OXWmhiyhn68DG/oML3SvWnjEmVcYgZvfvs9PwsOZpcNoKK/jYKU 0dyd6NdoC83C7HLiS5gB+3gShSaJeAZrFHlW/9aAEJPBWYccbYLsVc3ugFPaxewlZerhjG GkW9kxKrhi3ArnuYZ8WPJPDv/IMcF2+hTD0G8Ku2XeJjVHupSDhdhWaK3D8tYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674413436; 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=o0xn2f/wuAguJUUtPOE2uKmd1UaiRtHd3e8Y5cI65t4=; b=XOsMgFcsz4gODibpqPveMS6ATE8tWmnwicSFHW34FySCCj/en+84uCQ62RHUpIcewh2BQP dHRJvwJXU1oxcdzKK2xQHaJ7u5HvgdOnveC7cIKat5L4osmMo3NGoC2LEWDqrSAckwfMB1 9+c1rdVkqHLIZ9MuFM2w/Hswk0BaI3nWM1LXsraT/y81l4Eif/xn8P2OZ32NUPJK5Srfoc OCJmG+R/hsHKPAF9x9bBsIRpFpEQZoGgE9rRgO1k8cYd3SBa7DNZzGIQikdjXn9NFF1E2L TNDHwERTEdUGsz2g1GJpWVIkR6PcRc762Z0L/28iGP38Lvu2vhAybDAy/WMEKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674413436; a=rsa-sha256; cv=none; b=ys0zf1sp+qsiBsOzdFl/XJ0tPnwboWM+jAYvI8nohdvf1HWTVKa5KjH0UAnAgSGTEJSQlN dnnYtn0O497XcQYh7LauxSskrRZTgw67BoLZEdRUYBmsy/hhNmp4SEkHr0m+DrroQ9V9Pk q2SDEux0UfOAG9KslnKIltSRAjLmyuuz6o7e65NreaDHIoR9wrpAhxiG7bBQaQxA/EiPtV nzuqG9fVQcO0YEjfdj5aSBZkQSyomzY4ehkGWTCeiIkIoGKRkkpyeFwmm5UZvdx74LNTUG TjFs15SfTxpeF/kvlNA2AXHi5IXBw7y/DSYSjHjSkpMTtMSNtATYzj5YqmIsrQ== 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 4P0MkN46nzz10lT; Sun, 22 Jan 2023 18:50:36 +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 30MIoaOV062909; Sun, 22 Jan 2023 18:50:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30MIoaxl062908; Sun, 22 Jan 2023 18:50:36 GMT (envelope-from git) Date: Sun, 22 Jan 2023 18:50:36 GMT Message-Id: <202301221850.30MIoaxl062908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 30dd227cff75 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 30dd227cff75bdabaac2002a2b17095f3392a485 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=30dd227cff75bdabaac2002a2b17095f3392a485 commit 30dd227cff75bdabaac2002a2b17095f3392a485 Author: Alexander V. Chernikov AuthorDate: 2023-01-22 16:57:36 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-01-22 18:48:07 +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 --- 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 5173415afda6..39c93ac35427 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