From nobody Fri Feb 3 16:50:38 2023 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 4P7hVQ6r83z3kW02; Fri, 3 Feb 2023 16:50:38 +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 4P7hVQ4GqDz3v6W; Fri, 3 Feb 2023 16:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443038; 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=e6LbVIaNfX+fXEpTF8MEI3ecq7oDQLY5UyvyW4LDo70=; b=ZzT4zJAI/d7ET60PZb7BiqiDR93IGV+z+YIP42dpSHIJbQdnqomfWv7aDu5UgvnU26Ypnt HGIF5GN2I9R5cX2a8a58gFcgK3AcEWLa8AxYTQfuLQG0Bx80fnhpB3jLj6YPzQdkz6BKtp KEkpJjflks53kmDNoR355dqxv9t1hJTtKwib2o/ejqgUnp0450o2L9wPyJW7SQB2owGaUH hpiAM9DnGOlEy/jV5foH6uP9AhCmxqtEUFijMA0uOZg4nFKjgOSIPa1wxfIT3oCr6nYqrD i5UP9ckRLHxstonLf1FKKDKhKfv4CN2FE/0fNCrQoEMoZxQK/OHHRL9EEjikiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443038; 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=e6LbVIaNfX+fXEpTF8MEI3ecq7oDQLY5UyvyW4LDo70=; b=c+DDyRpgJPEMlXBKXioarayOcTPVrXL60961kKErAOARqX/EC37eTe2/tKL55YC/qLbiAh HP/9rznk+vE/ccuOacDxoe+cnJzUL8ohudVaVB53Xpp3IMT9DhvMZpTGh1Oq0C66tYf1sg iNnyegGE5Nvas3MmRsRK+txYcT6G7C4oHgpv1X7erFpqvP8yAd/BOROS6/75T5gGln1Ha+ 3ybLOgjUkQy3dwGaHJ2e0F596gCjc7viTn6AnFusvQ+j3K+oWSwSfMqiyj26Ke3+lXtQ7n ZMmB1U9h/17gVqKk2yGXcEdP9Nu8IxV8oaBvCYb5ek7geLhgenOt+YPynOtJRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675443038; a=rsa-sha256; cv=none; b=Rb9mpDnU0B4yiAKO5tyN8azTBbG8za3hzfUJ5bmNL96DIc1V6RmmgYmcQ5iNY/1O5yVbHG txW9pRmRCo1Y+krqSs1OQ08//6LixfJsB6RzCKZi2lFy+8Ol1tJR6kRIoewoKgLoYEGjpq wyVPHE0wEIZ4IiEAwC18jFce51A/9A7FhQXza+Pvmeium/TrQDEFJ5tahw7E1L2SrWwy0O N2i0TPQUr8j6fegClLB5CGpx22l7z6BhSqvvqFmLhp8J7y2lNO9EqvRzBZxtkOHoNd9Vzc Am6TuFXMpJbECrZysbOBDpVCmy2qu1vOjmtMRBbFILCo/RFR7R+ZEXLexXJrFg== 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 4P7hVQ36CRzhls; Fri, 3 Feb 2023 16:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 313GoccR009226; Fri, 3 Feb 2023 16:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313GocuI009225; Fri, 3 Feb 2023 16:50:38 GMT (envelope-from git) Date: Fri, 3 Feb 2023 16:50:38 GMT Message-Id: <202302031650.313GocuI009225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2589ec0f3657 - main - pcb: Move an assignment into in_pcbdisconnect() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2589ec0f365777faacf36bd1eb24706538836b17 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2589ec0f365777faacf36bd1eb24706538836b17 commit 2589ec0f365777faacf36bd1eb24706538836b17 Author: Mark Johnston AuthorDate: 2023-02-03 15:57:37 +0000 Commit: Mark Johnston CommitDate: 2023-02-03 16:48:25 +0000 pcb: Move an assignment into in_pcbdisconnect() All callers of in_pcbdisconnect() clear the local address, so let's just do that in the function itself. Note that the inp's local address is not a parameter to the inp hash functions. No functional change intended. Reviewed by: glebius MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38362 --- sys/netinet/in_pcb.c | 1 + sys/netinet/udp_usrreq.c | 3 --- sys/netinet6/in6_pcb.c | 3 ++- sys/netinet6/udp6_usrreq.c | 3 --- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index ce8a58883be4..954fe5482076 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1460,6 +1460,7 @@ in_pcbdisconnect(struct inpcb *inp) INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); + inp->inp_laddr.s_addr = INADDR_ANY; inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; in_pcbrehash(inp); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 19c163e95094..4efeb6a0e8e7 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1457,7 +1457,6 @@ udp_abort(struct socket *so) if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1567,7 +1566,6 @@ udp_close(struct socket *so) if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1644,7 +1642,6 @@ udp_disconnect(struct socket *so) } INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 0a4ae51cb5ef..51d29399e99b 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -511,7 +511,8 @@ in6_pcbdisconnect(struct inpcb *inp) INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); - bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr)); + memset(&inp->in6p_laddr, 0, sizeof(inp->in6p_laddr)); + memset(&inp->in6p_faddr, 0, sizeof(inp->in6p_faddr)); inp->inp_fport = 0; /* clear flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 92cd4ab9cd39..b79a00280110 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -976,7 +976,6 @@ udp6_abort(struct socket *so) if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1093,7 +1092,6 @@ udp6_close(struct socket *so) if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1240,7 +1238,6 @@ udp6_disconnect(struct socket *so) INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */