From nobody Tue Feb 07 20:23:38 2023 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 4PBF2L2mcFz3ngS9; Tue, 7 Feb 2023 20:23: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 4PBF2L2H5nz3G5Q; Tue, 7 Feb 2023 20:23:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675801418; 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=Z1JHZjcQ5TZK34d2abDkfyAWchosPFmiXTkIbsqkMO0=; b=Xq2ziuFqzj7tCIDuSXeMy9wXoMr7uUrxc5Rmklb6r+iW+ww8okJ5es6Yc0wierbnZH3PhX UeXzwpu8JyYkQRMn0ZKUdZ+lIfoE9isEiAhcGU3RnsaQrbvS+nErkVGhNtTtGUvKHLZ3dx 2J4K8WKFZSpMz+7HFAMoyyf56O6lbXvo5l0MgIZMKfM2iI12ba3+lT3hqrse/r1J42VyBq HSN8V5ouUI6bSdGfH7i+VTCwe1XsxJgZ/jvLkrsadBEgnQWKo/1t6J0prZpkNVPOB+XJ2Z ENU3G2LEBb+M5QVPg9uNZd7A0mwF/EgVbXpb5Ud4g8OmKIzcb6GoegBqCsHVOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675801418; 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=Z1JHZjcQ5TZK34d2abDkfyAWchosPFmiXTkIbsqkMO0=; b=eAea0WPJT9ltNi676Dhr20d6pXAed0yqV+xuUQbIlBbL4YQ/nCw+J6nUnnOvgFGsGp6+9o CMuDcpHiA4ldaxCv0uSCgG/ecW0UG6U6HKE3vuk2oOoxUcPgEq40LDkbHYrDa/5BKsik+k kOrRtyxbe9BpM5MmFcz7Q+Me/tOpzIgd2nDdmJoAZAcznxFIb2/gQR7alurv1tivJYnq1N zarn5pStgfTThcgfq6oylrpekzWCYdlaiu+B24guCNpmahwUCKGJU5qg0iPcLv57trQSHW tCDPpMlaOSXZTO+68gVc7lnokR6+f+ziw7WY1gJCRgogn4MrdmdbUGySk6ENqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675801418; a=rsa-sha256; cv=none; b=hKHThqzoTDmzLpKP2DeUFfw7k/g8hhxW0jqHF5AexKiyzBapBLwGJd2TONVRVXfszDeLSr kjq9K9mICr+M0LtB5Yuv5UY3RO+zhj5i2zeJi302Un+VBqsz78WfrRjy5YOSLDMRNoIg8z lw3t+zQcpiui9ZBcDmT9It6ar9fNuuCqwmm6tTNF0Ql0d8iQL21/UkzRLGknJYxugacf7T m7f9gFwR6TYx/ovqDFYEpqkTrxmZDMq7qv70sIupA6qXA6QjgL7IFF/iGijGJdiTi/9KTl yQmyUu8ZtaAwb3gfZ7eZYkPVqAis1+uTW7EBuHCOM6P4Rk1KrnfOlN4FR6wn/w== 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 4PBF2L1KcxzVXR; Tue, 7 Feb 2023 20:23: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 317KNc3f051575; Tue, 7 Feb 2023 20:23:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 317KNcxG051571; Tue, 7 Feb 2023 20:23:38 GMT (envelope-from git) Date: Tue, 7 Feb 2023 20:23:38 GMT Message-Id: <202302072023.317KNcxG051571@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: e6aba98fddf8 - main - tcp: Remove a couple of always-false checks from syncache_socket() 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e6aba98fddf8f087de02e2a88a79f1f2a1b89f5e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6aba98fddf8f087de02e2a88a79f1f2a1b89f5e commit e6aba98fddf8f087de02e2a88a79f1f2a1b89f5e Author: Mark Johnston AuthorDate: 2023-02-07 20:12:10 +0000 Commit: Mark Johnston CommitDate: 2023-02-07 20:22:54 +0000 tcp: Remove a couple of always-false checks from syncache_socket() syncache_socket() does some unnecessary work: before connecting the PCB, it saves the local address on the stack and restores it before freeing the PCB in case of an error. However: - There's no need to restore the old address in the error case. - The PCB's local address will always be equal to that of the syncache entry anyway. So just remove this unnecessary code, which appears to date from the introduction of the syncache 20+ years ago. No functional change intended. Reviewed by: tuexen, glebius Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38391 --- sys/netinet/tcp_syncache.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index a1f07ed1aadf..e45fc457f4d6 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -870,7 +870,6 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) } if (sc->sc_inc.inc_flags & INC_ISIPV6) { - struct in6_addr laddr6; struct sockaddr_in6 sin6; sin6.sin6_family = AF_INET6; @@ -878,16 +877,11 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) sin6.sin6_addr = sc->sc_inc.inc6_faddr; sin6.sin6_port = sc->sc_inc.inc_fport; sin6.sin6_flowinfo = sin6.sin6_scope_id = 0; - laddr6 = inp->in6p_laddr; - if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) - inp->in6p_laddr = sc->sc_inc.inc6_laddr; INP_HASH_WLOCK(&V_tcbinfo); error = in6_pcbconnect(inp, &sin6, thread0.td_ucred, false); INP_HASH_WUNLOCK(&V_tcbinfo); - if (error != 0) { - inp->in6p_laddr = laddr6; + if (error != 0) goto abort; - } /* Override flowlabel from in6_pcbconnect. */ inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; inp->inp_flow |= sc->sc_flowlabel; @@ -898,7 +892,6 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) #endif #ifdef INET { - struct in_addr laddr; struct sockaddr_in sin; inp->inp_options = (m) ? ip_srcroute(m) : NULL; @@ -913,16 +906,11 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) sin.sin_addr = sc->sc_inc.inc_faddr; sin.sin_port = sc->sc_inc.inc_fport; bzero((caddr_t)sin.sin_zero, sizeof(sin.sin_zero)); - laddr = inp->inp_laddr; - if (inp->inp_laddr.s_addr == INADDR_ANY) - inp->inp_laddr = sc->sc_inc.inc_laddr; INP_HASH_WLOCK(&V_tcbinfo); error = in_pcbconnect(inp, &sin, thread0.td_ucred, false); INP_HASH_WUNLOCK(&V_tcbinfo); - if (error != 0) { - inp->inp_laddr = laddr; + if (error != 0) goto abort; - } } #endif /* INET */ #if defined(IPSEC) || defined(IPSEC_SUPPORT)