From nobody Tue Jan 02 19:07:23 2024 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 4T4MmY14Njz565qX; Tue, 2 Jan 2024 19:07:25 +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 4T4MmY0MBRz4KKv; Tue, 2 Jan 2024 19:07:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704222445; 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=jDCQd1gc27xRAzUmDoBOftnMc2SFmqtNX0/Za2ppBGo=; b=OB1/IKWPuXqYZ77BbDuDri1VtumiafEM0iilPRrG9Hz3Ncpbr8Zzvr8N4ntVqskmTq3m4J RZlqE/Tf3a+0PJBmEoscdJz2eJHuGGKvFOj+gkHQq9lNoy8o4lDfWZ3tfSR/Q8sN/EPgVz K3qI+sKo7kAhUlQ+nWP8Te+6hT5TMIqrcDYr05OycKPpCQyUSG85B++zw5szRDLIGCzDMW rzbs8GQDRcVEPOV2oRQn1MMvLP574TnmSIZni5BVu6HTuu0j9YvX3YLFf2n6Nm32ePpoWm qtFcFkmu6JjO4iekI7XbflF4luO5ewS9uUAbp+9YAG5Qu/zsJ33iSAUiZhyI6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704222445; a=rsa-sha256; cv=none; b=OO+Yl3QFtY8FykGa05Epw0PdpA9TOr/KB8MoPlAwuG96JkujHVrNmz0V8byuNtzbD8Cle1 fUU1g0SEf5Uydty6hItlNA9zoXnSUQt2Bwcal/muGXNdqS1z/tGs8pgNPUsF2e2bnxgZIr 1acfqdad2ZK7pTR6TlA0y4GPaPd01wiZc5/mq0IsLo3NjggvbnrouDlrit5xyFi8Sx6ocS q6NKXAfVfMsFZSo8Lkhy1V/uivIO0/0PEbd4tYdUhVwpDSzKKW6JNgwsey+RMaRJGG3yTS O6srBuAhlQE5TaMOC3pTMsBrsW1f55A7JlyKPu0f2YkpX9xwS4wLZ+l1z2taIg== 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=1704222445; 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=jDCQd1gc27xRAzUmDoBOftnMc2SFmqtNX0/Za2ppBGo=; b=u/H7dnoi+cpSu3SvWtjFswQ5Q/K5R75mOICpvF/5EC4gz1mfxdnN3CG4jJtTei/5OIOci5 t7QTwOE2nY2PLiRqvTSlD4Ru54pLfrGWPugwtcEa0aRHJxu3ZIfrZX4HCMqV7IgPdUA6Ff AQSIihUYIEf4mEHdDO16VwWE3rjl/FfOWQbRbxu+NKthVVMw3lRjUoaBoQnuDrvnAt7UtX 9RElWOH/PM4Otm40DkUSP1s2E8f/v+q6elkJx1tC6d2StkOWnHCWNvfy7vzaX3HB6QCrMx NgN0jbyOErRrHHlK72dJ62XxTDGquWpWFUnpFl8HlPaT693tCLzhSLYDfLHq8g== 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 4T4MmX54n0z1CHX; Tue, 2 Jan 2024 19:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 402J7NGi053829; Tue, 2 Jan 2024 19:07:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 402J7NNW053826; Tue, 2 Jan 2024 19:07:23 GMT (envelope-from git) Date: Tue, 2 Jan 2024 19:07:23 GMT Message-Id: <202401021907.402J7NNW053826@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: 7bad06cd0d8b - stable/13 - tcp: always set tcp_tun_port to a correct value 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7bad06cd0d8bf63a47cee1b209fd6c1864fb2da5 Auto-Submitted: auto-generated The branch stable/13 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7bad06cd0d8bf63a47cee1b209fd6c1864fb2da5 commit 7bad06cd0d8bf63a47cee1b209fd6c1864fb2da5 Author: Gleb Smirnoff AuthorDate: 2023-12-19 19:24:17 +0000 Commit: Gleb Smirnoff CommitDate: 2024-01-02 19:07:15 +0000 tcp: always set tcp_tun_port to a correct value The tcp_tun_port field that is used to pass port value between UDP and TCP in case of tunneling is a generic field that used to pass data between network layers. It can be contaminated on entry, e.g. by a VLAN tag set by a NIC driver. Explicily set it, so that it is zeroed out in a normal not-tunneled TCP. If it contains garbage, tcp_twcheck() later can enter wrong block of code and treat the packet as incorrectly tunneled one. On main and stable/14 that will end up with sending incorrect responses, but on stable/13 with ipfw(8) and pcb-matching rules it may end up in a panic. This is a minimal conservative patch to be merged to stable branches. Later we may redesign this. PR: 275169 Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D43065 (cherry picked from commit 513f2e2e7180202167ca2963d815d2a4c3ac0af9) --- sys/netinet/tcp_input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index d3145881ecf9..9a5b9b05f210 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -690,6 +690,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port) to.to_flags = 0; TCPSTAT_INC(tcps_rcvtotal); + m->m_pkthdr.tcp_tun_port = port; #ifdef INET6 if (isipv6) { ip6 = mtod(m, struct ip6_hdr *);