From nobody Wed Aug 5 13:13:50 2026 X-Original-To: dev-commits-src-main@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 4hFW7y32Jlz6nFl3 for ; Wed, 05 Aug 2026 13:13:50 +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 4hFW7y2ZR5z3bf6 for ; Wed, 05 Aug 2026 13:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785935630; 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=shCSziDBbq2eFj9kf1s7V7tjlmjeIF1GgJsx28VQ4kS1rMn2fYIRyrK9jNmXynxhVb5ZSl adP5JYs/HcB5WnDPKpLfSbfJpIfr8m8bQrBvtSdfc5TpqtLJbXA7b/9Ege1Phcygtgi6qd p/4oknbIoWhZhPdF4mosgW51Q/n5Vcw8twLzkVKyY88aRMW8w/kwnrikwyYEDjeA57hKoY t94BWBoxWobxMl8uN2sZ4ZU6JxuUODIPqqlFU5TEoP9t1cCmoO0kIbaAK/cbIDhFjYgE9Y TP3JQLp/OirDp7d3LmSFPte/F+Y1zKHcIUE6M/+keHkhJ+qzhTgCNmaWee5Mlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785935630; a=rsa-sha256; cv=none; b=m55GB+vnkKR2hHhTlxlylWj4rSvMBMyXaV1eTJ2ygB1+0X9hjgCLHap/TVYUdyOmtAKmmf yI1UNEm2Lv9S6LbxMAJ6X1+nLaojeSWlZ6nGuSW8SxlOYZ5rJ42ScAVRUS/CU345RIha6X obzZsnRgQPdjgJqKa8CUSIR9BnuNXFez8+zBjQssmVs+DiXWp1G+FMxGPxrqHM+D2pX0o+ mQj8B0lgtgWNOOqz6WKNhNQKZapbA2rhEZN107tdY0pUNwJyu7FkSu41EF1PKQmQblBqZM F5QCkplNLuPrUGrYGQSc++3RK/famRUxveUqztoOtCJhgLFT0MIaQ97ggW+AZw== 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=1785935630; 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=SXVxjzmo2aJpUHItfkbZAuaPZYpJ3usWRgVyUHAPsOHwTB9tMnQyQx+j+9u51hMcihhA6O 3o6KHw+qCBYPlXaopa0VxrH8r4ES2AqcEXuV+NeX7JSXCoB2nuYHDbcyTRvm+KXDNcIKID NhNPn4uTE7hqGwqBPeG8sTEXe1e91fk1tz2ZoFx1peBD5FS0kLm6k3pCiJ8VsdPtusRYnL afYWUILo4U09qOuaaI2be7ri72BL12ncDo9n2DXC7vUOx1NO/38sXnei/jP93i50ZjwrCb 6fbnkxoEjMamk5zfvSqCR13hhZDbbGxMXV7FibRbJdGzTbHueEqgBwE0jELfYg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hFW7y1KvKzc5k for ; Wed, 05 Aug 2026 13:13:50 +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 the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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; } } /*