From nobody Wed Nov 5 07:15:45 2025 X-Original-To: dev-commits-src-branches@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 4d1c6p1zKcz6FkD8; Wed, 05 Nov 2025 07:15:46 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d1c6p0VXBz3Jxb; Wed, 05 Nov 2025 07:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762326946; 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=9RVVOyH4t3W5ZXRx5r0WVPRap71EwycFn/VLqwWIJwI=; b=Cnm4p4SfLeXIvuyLwfid5WyaRgCb5KO7TPO4hQKjn5ITD42mgA6R9wKDrk8r123L/g2FV2 WRdvMXV1x8Vbl+oHGt934x8q9bzx3acv5Orh9HaOwby1Khv/mLYC5aEyV0NYW5LUKK7MuC WD0bVCOAc4zPqCrmz8kWRPhNEbeuoLal5JhwfUnQNcKxSX/4hwdbTP4h+LtXfR6C6Yw4As RFpgzgSO5yKG+eAffrVO8yKRuvH6HLjMe8lIz1h/QDNreYpALazCYakShS3dCE5BFQLF0Q KkWVVkoLZdMv8PuRgMZVxxAca4lbOMKl/sMYn9zIyqcE1YktGMRbAWCP+d+3Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762326946; 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=9RVVOyH4t3W5ZXRx5r0WVPRap71EwycFn/VLqwWIJwI=; b=n8T1vZ+GMnHWD26ZCcCF3VvZed9i5jFUd1kmdc+Ueq0hRhr2p7sV2pJ0em8oV2/nY/olvS R/tQuMSickRt6yFfzif90a8Im6t6G6qyF0Int6veaJ8jwmMg3TpYAMeA9AMDFpSsbxGGm+ bk9nwamDasqsiIkq/wE64POomNrjGT3YbHVaQeXWCW14gBbCn79bF2LBMQmVG+g4FCNkeA hlxmjOcgChKXyLHP/HoqgYsQr9e3joFw8qEVomN6WjXFK3KQiO2VHk1crsJg5Yd3/lqv/y G7Vg6Ozh3zjId/epCoM4hQa0Y765XqSWXSIOOK4kPhmypEf5VYoy9wxcGxge/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762326946; a=rsa-sha256; cv=none; b=IydDtNAeuzHGFIIdBi5fI6hsF5jSO/hHjf+ZpPmIZZwdONahnzw2YzSo3a5oZ55DXubG+z MRgC2uw8eXE51wPVwnZKxwzakL35WRa7nvQU1lOrHLzyZaeQFk5vXNQlGMZS7PvUcb+u72 r1mia6SxUr/AmKNp8A+x1lkq6xMFOd1uhNGW4xEu2rp6bOuKlbuigUtmOMf6lmI/Ce5wCt Wlke3oBR91WmaaofPPymZpctbjTyDwpxfYoBrfae9o7epjA5GSQsMHSHsz+ZjTD4FdVW7D 0yEQRrur1tlvZ0KVN87VTt5GrQ9VMQNMFrA24sTYriiRxKZDf+o3mXIwTgBlYg== 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 4d1c6n6wTwzY97; Wed, 05 Nov 2025 07:15:45 +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 5A57Fj7W088822; Wed, 5 Nov 2025 07:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A57Fjoq088819; Wed, 5 Nov 2025 07:15:45 GMT (envelope-from git) Date: Wed, 5 Nov 2025 07:15:45 GMT Message-Id: <202511050715.5A57Fjoq088819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Maxim Sobolev Subject: git: 7f4c2bf8ea6c - stable/14 - netinet: provide "at offset" variant of the in_delayed_cksum() API List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sobomax X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7f4c2bf8ea6cdbdcca1eccce9508206e2cf05cce Auto-Submitted: auto-generated The branch stable/14 has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=7f4c2bf8ea6cdbdcca1eccce9508206e2cf05cce commit 7f4c2bf8ea6cdbdcca1eccce9508206e2cf05cce Author: Maxim Sobolev AuthorDate: 2025-08-25 22:12:56 +0000 Commit: Maxim Sobolev CommitDate: 2025-11-05 07:14:04 +0000 netinet: provide "at offset" variant of the in_delayed_cksum() API The need for such a variant comes from the fact that we need to re-calculate checksum aftet ng_nat(4) transformations while getting mbufs from the layer 2 (ethernet) directly. Reviewed by: markj, tuexen Approved by: tuexen Sponsored by: Sippy Software, Inc. Differential Revision: https://reviews.freebsd.org/D49677 (cherry picked from commit 5feb38e37847c10af86f5c75dc768518973c6aaa) --- sys/netinet/ip_output.c | 13 ++++++++++--- sys/netinet/ip_var.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 66051c9c711c..e3ef8e2c7dd9 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1045,14 +1045,14 @@ done: } void -in_delayed_cksum(struct mbuf *m) +in_delayed_cksum_o(struct mbuf *m, uint16_t iph_offset) { struct ip *ip; struct udphdr *uh; uint16_t cklen, csum, offset; - ip = mtod(m, struct ip *); - offset = ip->ip_hl << 2 ; + ip = (struct ip *)mtodo(m, iph_offset); + offset = iph_offset + (ip->ip_hl << 2); if (m->m_pkthdr.csum_flags & CSUM_UDP) { /* if udp header is not in the first mbuf copy udplen */ @@ -1079,6 +1079,13 @@ in_delayed_cksum(struct mbuf *m) *(u_short *)mtodo(m, offset) = csum; } +void +in_delayed_cksum(struct mbuf *m) +{ + + in_delayed_cksum_o(m, 0); +} + /* * IP socket option processing. */ diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 3220679d749f..a1402f4fa268 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -259,6 +259,7 @@ VNET_DECLARE(struct pfil_head *, inet_local_pfil_head); #define PFIL_INET_LOCAL_NAME "inet-local" void in_delayed_cksum(struct mbuf *m); +void in_delayed_cksum_o(struct mbuf *m, uint16_t o); /* Hooks for ipfw, dummynet, divert etc. Most are declared in raw_ip.c */ /*