From nobody Mon Feb 20 16:24:25 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 4PL76K44G9z3t2bV; Mon, 20 Feb 2023 16:24: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 4PL76K3d7Sz4D76; Mon, 20 Feb 2023 16:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910265; 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=awHrR4sTByWmchjbqeMOVS61h5kEo94KMejM1GD9tRU=; b=pNlvoSkY/pcyQ6cjPf9P54VrJL6jxzan0EGhd14Jv+X0p8HhrtN54zO8pkM48RVyeMpqTA sarT1yxmHtjGNjt2jBIcggrbrWJ/LQsPBay4e7OZSy0uf32h8sDvL4HPrhbWoDyOSHjHQa Mh8m8n7L9aKI+y157kAFs7ewtXKKUHULDKqaqPMqyq4H5EJEOhvLbjaMnbVI8r/N0+B/24 RRRe/2Fr4+1QNV7+J1PJwg4Fu6PCgvy/4rNJtEbwCHGI9qxatrEsoFk6fHQ+IUgzPgAkZr UTQrnX6IZ643RNQzvXewTJR7CvYymWBux0keODDsQhuhuvFIM453hcs7RCBi4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910265; 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=awHrR4sTByWmchjbqeMOVS61h5kEo94KMejM1GD9tRU=; b=LFUchTR8bwLvjcGIO1STkz4cGXYMjwDW2/ma+lme73t3ADoCk07xrDzFFT3BJeYbFGMOpx 0oRmi5vdzimS+TLQuiwgwzZMhRITqXMT18mdxvEmV6VjHpUhHFJUrjpOWc77eAY/Vd9JLR YgdLC67ACT+ay/iU44I5Bb8wqVTrpxSEFAttfj114H2MKT9lzjxxrFrtknPq2bZ+eMBpVR XxNDicR2HyNPEyYBlAascrX3NNBtDiHYeBlwYCae0k/JIDlhs/rYFc4Av1wghiL7dzwShL FR/cgNvQr8X83XsN45kH9OQz967gEk+0e3XsfIlpPGiVXhszca37Ok2uaAkDdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910265; a=rsa-sha256; cv=none; b=H8sUG4CBD91/LB0BJ/VPZu+o2HPJuBNwlEVrzHBdQxIRwdCWP27/dOpHzdIJ45GHq+pW33 OB86hgYJdiKaJ5GLVivJtnYpJrjcFBLxLQPx4NDl+cF/GyfST6irsJbQ8aR+znFdgViu7M glO/npN/C/6dyySoG78bK/kE7tE4GmlwolSXrKonOah2JqEbYeVFRGIEgr97u7qTlAoo5p JYv8wpp04dv9PyBHEn7hhwr7y+ZT8J+wucHhk6MblFKGiDErEhd0ca8UPSPx2x3dMpD/se xcde0QCbUjWcFgmR/0inNQnil4cqLkgZyXz8cu4cBwmltZPpYvVBu1aZHx4CTw== 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 4PL76K2dtZznKx; Mon, 20 Feb 2023 16:24:25 +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 31KGOPge064718; Mon, 20 Feb 2023 16:24:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGOPJ3064717; Mon, 20 Feb 2023 16:24:25 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:25 GMT Message-Id: <202302201624.31KGOPJ3064717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5a33e9990b67 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a33e9990b6745b5b659229ab33661b4811f8ddb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5a33e9990b6745b5b659229ab33661b4811f8ddb commit 5a33e9990b6745b5b659229ab33661b4811f8ddb Author: Mark Johnston AuthorDate: 2023-02-03 15:57:37 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:09 +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 (cherry picked from commit 2589ec0f365777faacf36bd1eb24706538836b17) --- 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 d9247f50d32b..55fa795457cb 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1499,6 +1499,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 cb7d10f68c48..1289ba7c5d2f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1544,7 +1544,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); } @@ -1664,7 +1663,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); } @@ -1750,7 +1748,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 bc7c0a2bebf5..02fd3dff2ad7 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -500,7 +500,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 5166c0a2cbbc..ff7227cb99f3 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1019,7 +1019,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); } @@ -1155,7 +1154,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); } @@ -1316,7 +1314,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 */