From nobody Thu May 28 05:05:35 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 4gQvZX1qRtz6f3kQ for ; Thu, 28 May 2026 05:05:40 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQvZX18Frz3PZr for ; Thu, 28 May 2026 05:05:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779944740; 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=DIXyQOwfgqYHls6Z1UG4vin1avFr9bUSBdYO72qEYSg=; b=OCnjBDjZ4LJm6xt44B01w8XC5EMN3rh+lLQP4A0X4WUWGLI1521m3SUwHVaBvN05cb40+b Ob3jQd+XHlGwRlPNp6a2gGJ1WNH1x1ZSPmj2mQChcvoOXFgxVpXHR0erYVLSEFXuFl1qKq HhybKKNs+O8IJj2JQ2MfYr/Q4yHS7MZKGL2cpNp/LoDqdc9J+i6R2vlWWf9aRs2dHxAPwk q2HGGK9wp1Q31L+Rkrt1qOoQoPfcwhN4VSFltvTeAdns5tTCN0L0agkBKybBfuAeLU9A55 CXWacKb0rJ8Y/T3+sMrLOZDp+Rl2CnVGER/PTDmKR+RwileQ9h0lqGU3VQ44hg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779944740; a=rsa-sha256; cv=none; b=jNulXXf1CzBUbuAGNX8wa2wOeu2bQYAZzn1h26jScnUQxehDYtXKtjnMLDQL3Ac6tiV0sn k0zmb0DKMHqYzQ10mGiOm2uRC+DOTainBz4HRa7lXRH3fcczKCsFb0jqCwOVTycJ/LrmsP nL7i3mHgu6DMM3BXfXCG2ebfEhubDG9gejUMWG4FaBVPdSGvtrBhxJLpM0OAUM8nIGMiae wymXvGtYH5m/QAOR/Bm7K9kP3MIV0A9cXePfHwKTC5MDfmaa31YFQ5c/jXAD8fKteQP3rn uKOw5MVtZoCD09ZPKguZfezPhZOV5XBErfPyi8VlYaEygSLmfyhs7jM59U7QaQ== 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=1779944740; 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=DIXyQOwfgqYHls6Z1UG4vin1avFr9bUSBdYO72qEYSg=; b=LKtmIjqnX+JYfqRw0KqxLd9SZLl0Ob5r5gzp+4cXoUb+2sphrZjs9hh1/wEYFb3J39ORyJ Gqw9VaQcwAPfxOuPe9oy9Hwo7KCIvjd/RzTAk164nSx7TewTtu8GB9197gQWkr8/BTUYIn si91FkeOiiVC6R4QLNwbDchhVyqn9ILNU/84fs9uGc9skOZbGlk1W2kb3aqybLyOYSiCev 8nc5DZHkj04d0IDDO+eHb01Lsp6KXfqfD7lfEfdtki7PM0L+0/TAzSWj1/yD4DtN974jEU AeNPxa8JzVEJkvU44QPLLTvewGxigmSqm6cByzm1W+hBURgKUalX5FpQR4iFpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQvZX0dLMzXVR for ; Thu, 28 May 2026 05:05:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e417 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 05:05:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: ca91300c0749 - main - inpcb: a pcb may travel only from the wild hash to exact, not vice versa 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca91300c074923cecfe197de16a3318b06876134 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 05:05:35 +0000 Message-Id: <6a17cd1f.3e417.5bc42168@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=ca91300c074923cecfe197de16a3318b06876134 commit ca91300c074923cecfe197de16a3318b06876134 Author: Gleb Smirnoff AuthorDate: 2026-05-28 04:46:27 +0000 Commit: Gleb Smirnoff CommitDate: 2026-05-28 04:46:27 +0000 inpcb: a pcb may travel only from the wild hash to exact, not vice versa The only possible way to exercise in_pcbrehash() is to bind(2) and then connect(2). The second branch was a dead code since fdb987bebddf. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57241 --- sys/netinet/in_pcb.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 66d2c610139f..84b175b42eec 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2805,7 +2805,6 @@ in_pcbrehash(struct inpcb *inp) struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; struct inpcbhead *head; uint32_t hash; - bool connected; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); @@ -2815,34 +2814,24 @@ in_pcbrehash(struct inpcb *inp) #ifdef INET6 if (inp->inp_vflag & INP_IPV6) { + MPASS(!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)); hash = INP6_PCBHASH(&inp->in6p_faddr, inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask); - connected = !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr); } else #endif { + MPASS(!in_nullhost(inp->inp_faddr)); hash = INP_PCBHASH(&inp->inp_faddr, inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask); - connected = !in_nullhost(inp->inp_faddr); } /* See the comment in in_pcbinshash(). */ - if (connected && (inp->inp_flags & INP_INLBGROUP) != 0) + if ((inp->inp_flags & INP_INLBGROUP) != 0) in_pcbremlbgrouphash(inp); - /* - * When rehashing, the caller must ensure that either the new or the old - * foreign address was unspecified. - */ - if (connected) { - CK_LIST_REMOVE(inp, inp_hash_wild); - head = &pcbinfo->ipi_hash_exact[hash]; - CK_LIST_INSERT_HEAD(head, inp, inp_hash_exact); - } else { - CK_LIST_REMOVE(inp, inp_hash_exact); - head = &pcbinfo->ipi_hash_wild[hash]; - CK_LIST_INSERT_HEAD(head, inp, inp_hash_wild); - } + CK_LIST_REMOVE(inp, inp_hash_wild); + head = &pcbinfo->ipi_hash_exact[hash]; + CK_LIST_INSERT_HEAD(head, inp, inp_hash_exact); } void