From nobody Fri Feb 03 16:50:36 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 4P7hVN3cB2z3kW20; Fri, 3 Feb 2023 16:50:36 +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 4P7hVN2lhCz3v2M; Fri, 3 Feb 2023 16:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443036; 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=vvCBIYlMfaEGj/riVHr/SlEHpIAtjIcxut6PCTeK0WY=; b=wYgO7rVxLP9jvZd342P4EuYlG7YakrmYmu9S98Y9N5BOdrjFxqFarojcpB47W71AKahmsh d07KRErJEgHtV1y06DpMh64uCz4NKGlRlH+mq6usSnh8vBMOTG6HcIMCE585VkjCl5gCs2 qld9l5Hxwg4FxNd5lyq8sxEUcK8aQoMoV5MiWF37aowyVAqWWpD5/0CKSuntcXvBDDmh9I jVSTyQqzQSmQsoX3qUR6wtfkz3jk7RlTCrSxGcCDY5Fp8D3jRhUsMzDgC2+FILidG0koDc JV5s0AIIuNydWpJmxZOQTKn9Ruzd/eKdjjKywaPBbc69+hpCYxXEfmaeXYLVRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443036; 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=vvCBIYlMfaEGj/riVHr/SlEHpIAtjIcxut6PCTeK0WY=; b=q2MovVWsU9GjizOGiDlnJwMxXbLUWVrufSezo8plX/Ps7NLQ9x7U4H86Hn3Wcab9GZzZEL UqlaAS6HirPSA8sdOddwm4PDxWcLeA5B6XPOFHwE9sSvsT8fyG+xMNTT/dz5ZytWTWSzkZ R2b4hGITkIIzK6+ke/BeMZeLY9QatxrlUWh0ZGxi7WO55YBfqPUjgZjLNhqgeRIx20+xM7 2CoTPJqFdmBCwe+M69txI66gOYs9XSMOiWjHYflTWZVSBoibb2XQlFKeR7tyh0sqcIXxut ZFMGEqUciBK/v6doGoSXAK/YT3rlpSRri8orZblrmH/NzDDcmL2jZvIzBIxl0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675443036; a=rsa-sha256; cv=none; b=e3S60dhWuSIXDqpuXIe6DDTqhkL+hApZ4BGL4G2ldFqr8BIGzEgGE/MHgtF3FRbgEpyykh xIk7A2xVLGb/Q12jwptAD30fgzo0pGkNeTvG1DJ+ChDu0ks2XU+UGK0NtlaUVMqTbvMODB GzKOo0SXiHBZIb7r3uZ8n/E7FaQJz4s/3iZzGDWisoL1wpjI8JOfiE4Wqm5UXG3hMRkW4c 7nC6FzRsiNJY1k9UczxJ8VZn9NBNbLBx+xe0ARhQocIlXSvg+lXhqeNp5MkWI5qm11d5Qx G9uP1XUWVVvh77hd0Vh7o/8HGHJSeaVCPYj9285dy/JKP2Ip5vsBZuyp9/q+XQ== 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 4P7hVN1kmFzhxw; Fri, 3 Feb 2023 16:50:36 +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 313GoaVd009167; Fri, 3 Feb 2023 16:50:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313GoagH009166; Fri, 3 Feb 2023 16:50:36 GMT (envelope-from git) Date: Fri, 3 Feb 2023 16:50:36 GMT Message-Id: <202302031650.313GoagH009166@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: 675e2618ae2d - main - inpcb: Deduplicate some assertions 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: 675e2618ae2d0e9d2c7908c669bba7086bb15b0b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=675e2618ae2d0e9d2c7908c669bba7086bb15b0b commit 675e2618ae2d0e9d2c7908c669bba7086bb15b0b Author: Mark Johnston AuthorDate: 2023-02-03 15:56:26 +0000 Commit: Mark Johnston CommitDate: 2023-02-03 16:48:25 +0000 inpcb: Deduplicate some assertions It makes more sense to check lookupflags in the function which actually uses SMR. No functional change intended. Reviewed by: glebius MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38359 --- sys/netinet/in_pcb.c | 17 +++++------------ sys/netinet6/in6_pcb.c | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index baac2f131df4..23d30d8b968a 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2369,6 +2369,11 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, { struct inpcb *inp; + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + smr_enter(pcbinfo->ipi_smr); inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, lookupflags & INPLOOKUP_WILDCARD, ifp, numa_domain); @@ -2390,12 +2395,6 @@ struct inpcb * in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) { - - KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, - ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, - ("%s: LOCKPCB not set", __func__)); - return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp, M_NODOM)); } @@ -2405,12 +2404,6 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp, struct mbuf *m) { - - KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, - ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, - ("%s: LOCKPCB not set", __func__)); - return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp, m->m_pkthdr.numa_domain)); } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 1f9bd1445479..c3012ffab68f 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1096,6 +1096,11 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, { struct inpcb *inp; + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + smr_enter(pcbinfo->ipi_smr); inp = in6_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, lookupflags & INPLOOKUP_WILDCARD, ifp, numa_domain); @@ -1117,12 +1122,6 @@ struct inpcb * in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp) { - - KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, - ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, - ("%s: LOCKPCB not set", __func__)); - return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp, M_NODOM)); } @@ -1132,12 +1131,6 @@ in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp, struct mbuf *m) { - - KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, - ("%s: invalid lookup flags %d", __func__, lookupflags)); - KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, - ("%s: LOCKPCB not set", __func__)); - return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp, m->m_pkthdr.numa_domain)); }