From nobody Thu May 28 05:05:35 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 4gQvZR2gS0z6f3SR for ; Thu, 28 May 2026 05:05:35 +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 4gQvZR1qCcz3P7v for ; Thu, 28 May 2026 05:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779944735; 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=BJHga3/CjhhFp2CfW69FzAp38cip835O+77GcyBL/i6vxg61P2jBKlrsPPleU8V13fv6ux tEkE2Oqdb/ZEO8HyfL1FJYMyjpiLSRyrXh850c9JPLHsYULEPiyC6VO1jNFSdAqDk0iX+6 1cC5VouwcptjqdcdstdG0YLvhfvZGV4h9OsrXDf2GB6cuJylU3PQwhoQfiHWNQCZhh9TC+ Fkg8CkdSYkrmhi4Xn435NQKDKQwBk9cFu8F+PW/JhdG0XAG5Dnl9z7CT4YjSBV2SENdy/n tadKDhKngfXPH0qrQR5x7zydpIfgPO+5w2vBs+krfa86gcseyzYxO5lZ7pkpbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779944735; a=rsa-sha256; cv=none; b=svQOEtNQeeOZLhhmJ6iZDt1SIBT2/4qsZgNg9R/tD0whOEzu/gIkHDbAdwgHg41Y77NYTh Qq5qtw21Pz4aU5Sta1dXEMyogU0lLCf9hacIX+EWxLoj0PSbeD8ODF1CJpDblnlWvKtEiX cJ77FHm+hjAuqYoRawfDrMpWV6yUNlMfySZIoUI56vFFqslXSuVVOf/5OdM2JwagrI6ggo yDX8HBsNW+cKCFPfOajHsrEq3mwCbwalQNhfu+qfC3XHJejnvvvs21B7l0Cuj8gQpDqgTM d7S2cOnHjuEPJ8XgsY2RwgwKB+F1AF6DsheuGZ2TLiqfvI8dEA1ShD+YmbhntQ== 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=1779944735; 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=ZAy8KuMIjDgEer/3rYNQaK+EO7uJxBQwP+7wOz6JD8Phw9Vya/JR/1cwWWPfjPusWQm1BR ujcghJHLUIO3nXEI4SXbTBHkGbBlNupho02BO55LdsRX4/RYFhNXE6a4oonJQof1FIYL0L 3+Lk4BwZIcwlExvlgX4G7fBAyVa+eAZUaln1kldpd5pjsBbylBQnKa3Ccs6EjOgpjiUuCC FwO6HYRrRKvAiWBW0ZWTLx8Ux1nh+UAe7nheWV8QDPykNJRt3o1YckspDKpaIHI8fwQGyJ IwkjVIF8PuP86wQ8FcnG+fmxlqN0qdjQcH97pYq7V/43wGewYufVCDs5ym1Xhw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQvZR0c1BzXmn for ; Thu, 28 May 2026 05:05:35 +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 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: 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