From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:47:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 566DB5CC521; Sat, 10 Apr 2021 13:47:54 +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 4FHbt22262z3M8V; Sat, 10 Apr 2021 13:47:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2E0631279E; Sat, 10 Apr 2021 13:47:54 +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 13ADlsoI027945; Sat, 10 Apr 2021 13:47:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADlsox027944; Sat, 10 Apr 2021 13:47:54 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:47:54 GMT Message-Id: <202104101347.13ADlsox027944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: c3a456defaf2 - main - Always use inp fib in the inp_lookup_mcast_ifp(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3a456defaf28df8d6f47704d606248f6c22146c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:47:54 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c3a456defaf28df8d6f47704d606248f6c22146c commit c3a456defaf28df8d6f47704d606248f6c22146c Author: Alexander V. Chernikov AuthorDate: 2021-04-05 19:58:57 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-10 13:47:49 +0000 Always use inp fib in the inp_lookup_mcast_ifp(). inp_lookup_mcast_ifp() is static and is only used in the inp_join_group(). The latter function is also static, and is only used in the inp_setmoptions(), which relies on inp being non-NULL. As a result, in the current code, inp_lookup_mcast_ifp() is always called with non-NULL inp. Eliminate unused RT_DEFAULT_FIB condition and always use inp fib instead. Differential Revision: https://reviews.freebsd.org/D29594 Reviewed by: kp MFC after: 2 weeks --- sys/netinet/in_mcast.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index 392856785dd2..f0827fcf3451 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -1865,8 +1865,7 @@ inp_getmoptions(struct inpcb *inp, struct sockopt *sopt) * specific physical links in the networking stack, or which need * to join link-scope groups before IPv4 addresses are configured. * - * If inp is non-NULL, use this socket's current FIB number for any - * required FIB lookup. + * Use this socket's current FIB number for any required FIB lookup. * If ina is INADDR_ANY, look up the group address in the unicast FIB, * and use its ifp; usually, this points to the default next-hop. * @@ -1887,8 +1886,8 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, struct rm_priotracker in_ifa_tracker; struct ifnet *ifp; struct nhop_object *nh; - uint32_t fibnum; + KASSERT(inp != NULL, ("%s: inp must not be NULL", __func__)); KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); KASSERT(IN_MULTICAST(ntohl(gsin->sin_addr.s_addr)), ("%s: not multicast", __func__)); @@ -1901,8 +1900,7 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, if_ref(ifp); IN_IFADDR_RUNLOCK(&in_ifa_tracker); } else { - fibnum = inp ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB; - nh = fib4_lookup(fibnum, gsin->sin_addr, 0, NHR_NONE, 0); + nh = fib4_lookup(inp->inp_inc.inc_fibnum, gsin->sin_addr, 0, NHR_NONE, 0); if (nh != NULL) { ifp = nh->nh_ifp; if_ref(ifp);