From nobody Wed Aug 5 13:13:50 2026 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 4hFW834Gj0z6nFMR for ; Wed, 05 Aug 2026 13:13:55 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hFW832btzz3bnD for ; Wed, 05 Aug 2026 13:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785935635; 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=HWmCt297xNDmWYmrbpGTNeGT3+RGDVMOPHzhFhkarxk=; b=y3KtFv2MXjGhlPDJtb9Ub/FCxNmuvrAsR+4vfKN5pffBY+BvH4X6ILUGEWl7nxHi+1zeUa TjqZODhg2Eo2oI2dp0jlfslS1W07XJxw6+g5ajcAOmpF8QEX0RT3XSBWIjceuS1/JAoA9t KtVXQ6DUirlKt1vq2MHUsO29tyaQ2urz9xsyd2Z77ie6JINi9J3Pg+mj9+98B+t37Zmlfr 1x2TD0EoTJ+FoEUORcISbmvVYyx0gG53bpLgmiVx2eOu4VmpTT6OiwEdnbwDbWnXNrlO/B CujkF6YU/TPOAWuEeD8LGzVy4JG3IMTdm8yWjwygmMp9/ohcaLBswOLgpLzmrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785935635; a=rsa-sha256; cv=none; b=r9eVek34wZ6N6wxMenN/md4rEybx4ae79qbS3cIoydshwIomT6PyPEHRGqMkPQ/4P8rz6F 9rrb+yB9Xmeoxffw/FuKt3GhLujvqXAMz1ytUj8+X9skgGJxXlPYImnTDW8AyLte/viRLT GCHzFa8D4KeGkQPxAM8fe+cbm+h7G1ic2pZ9V6wIFLbdgI5o10f1RK0zvwxWBhBfI7N9Xa Hiqc+G5jbvd+D/XczQLaYYN95bteggoRq6foc1bZGybqJqkBw/YxFpmiJSsp/QpQBij5x3 Gm/VeFphMP2+D765P8MO7u0m1lCkbirf0M5gRuE3Jowub+oOq2SE2BO1c2AJdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785935635; 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=HWmCt297xNDmWYmrbpGTNeGT3+RGDVMOPHzhFhkarxk=; b=xJfVNvp2hLCzlOiGAAtMBbsiimtfzL3I2M/bF7aTqngxktXqeuj2zaI0XSw6697YE8eiLt NXRZiLG1R0gE2b2nQBYxpGaWc168NRhcCCvaYZRnEqCmyl/YYpry9Ts0OP+2OBwRAmFrZV s3O0M1rHDAkAUA9X7l5SclSetINXhm7tqiTOefUoDUZe8sDaLDEGUAaImq+tuQUeyZ8gCw jXjUOLC+PLcAlyjFIBxc0rnEP4dKb0krP3ukUh7qjGluAP4JUD0WWPVBmKi8RvFb0GNDzE xNJy3mIdO7nAIUfBOBTeODl66SdXiJiej0UUgoRFDQPvONKwwR4Y//itlZs5dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hFW831NwMzcDB for ; Wed, 05 Aug 2026 13:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 375f2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 05 Aug 2026 13:13:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 196874ce2e97 - main - rawip: Fix handling of checksums in rip6_input() 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 196874ce2e97e3e6425493b1d501e716b356bc36 Auto-Submitted: auto-generated Date: Wed, 05 Aug 2026 13:13:50 +0000 Message-Id: <6a73370e.375f2.32de99f3@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=196874ce2e97e3e6425493b1d501e716b356bc36 commit 196874ce2e97e3e6425493b1d501e716b356bc36 Author: Mark Johnston AuthorDate: 2026-08-04 13:35:35 +0000 Commit: Mark Johnston CommitDate: 2026-08-05 13:09:08 +0000 rawip: Fix handling of checksums in rip6_input() A v6 raw socket may ask the kernel to validate the checksum of an inbound packet. If it does, and the validation fails, we discard the packet, but this isn't really right: other raw sockets may wish to receive a copy of the packet anyway. Rework checksum handling to address this problem, and use a flag to avoid computing the checksum more than once for a given packet. Fixes: de2d47842e880281 ("SMR protection for inpcbs") Reviewed by: pouria, glebius Reported by: Yunzhi Ke MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58559 --- sys/netinet6/raw_ip6.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 8c503f70af0f..dcf3db251629 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -190,7 +190,8 @@ rip6_input(struct mbuf **mp, int *offp, int proto) struct rip6_inp_match_ctx ctx = { .ip6 = ip6, .proto = proto }; struct inpcb_iterator inpi = INP_ITERATOR(&V_ripcbinfo, INPLOOKUP_RLOCKPCB, rip6_inp_match, &ctx); - int delivered = 0, fib; + int cksum, delivered = 0, fib; + bool cksum_computed = false; M_ASSERTPKTHDR(m); NET_EPOCH_ASSERT(); @@ -230,19 +231,22 @@ rip6_input(struct mbuf **mp, int *offp, int proto) */ continue; if (inp->in6p_cksum != -1) { - RIP6STAT_INC(rip6s_isum); - if (m->m_pkthdr.len - (*offp + inp->in6p_cksum) < 2 || - in6_cksum(m, proto, *offp, - m->m_pkthdr.len - *offp)) { - RIP6STAT_INC(rip6s_badsum); + if (m->m_pkthdr.len - (*offp + inp->in6p_cksum) < 2) + continue; + if (!cksum_computed) { + cksum = in6_cksum(m, proto, *offp, + m->m_pkthdr.len - *offp); + cksum_computed = true; + RIP6STAT_INC(rip6s_isum); + if (cksum != 0) + RIP6STAT_INC(rip6s_badsum); + } + if (cksum != 0) { /* - * Drop the received message, don't send an - * ICMP6 message. Set proto to IPPROTO_NONE - * to achieve that. + * Drop the packet, don't send an ICMP6 message. */ - INP_RUNLOCK(inp); proto = IPPROTO_NONE; - break; + continue; } } /*