Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484873imn; Wed, 27 Jul 2022 11:30:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v04mTpOcGeOyC+tclK6D8QRyHCZufUzT/vKEBLHuEBSXccN7YIqvW5IBeq/4hr4bKt/umR X-Received: by 2002:a17:902:db10:b0:16c:3ecc:eb2f with SMTP id m16-20020a170902db1000b0016c3ecceb2fmr22717387plx.145.1658946622670; Wed, 27 Jul 2022 11:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946622; cv=none; d=google.com; s=arc-20160816; b=IGEblyWeedt448+wA9600BM3IKdmaqxsCX3NP/0L704WZI8VwP0ewzPKwYzENJnqb4 mRTOBePmg50zPZ2ia6odNSxLiQzYtU8xzF5OWPsx0Ez76YvCxiGJiOYJEnqji8s0Rh4v C0rRE1q9O17c7on17HGVkZGPHN2fimz93rD7zFtMSmx1YVKp0N9RhixH5qnbUzpSgRt2 Bp2rOBDeretKV/kVaUL5qK7ahYOpUpLrcBfAKVqTitUdGuaQ0SRkQJtaqYspaOdi1K54 +tHUvsH1hHqbj3QM/tm+L5lc72DSa0GwFt3Ia7LMzKHwpFFzm6x61ykFgd/RXM1cHbC7 BUEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=89jivBmlhzlvaU2yL9+xa56Il3b0/amEmuG0nG34xFU=; b=tf6MyMYuf1ontj1zzTdMXIps+OeeoSGX50B3MANJGotvWC3NBozG4u6djZ92EEEI1F 0e+TL0bNamxkg4gjGOEQc8PKd/J4YdDXdHOJ0ofkt6IJvlnDCgLbnwouFMvqKa5dPKIt 7Rad++LvmKiv1h0XDj0bCGPvaEHckh9ktF7yf9DL6Gkjp6MHIvTAUpEQ6Py+DJ1/TVjI Y2kXOV5D1GMfWuQHElQe28RDQbkkHl6fAliGALeWyoBP/IHdCEIJeW7gdx0TuX/ZID6u oyaTkpEmoy6K+Sz8nhNcfmqUdoXwwSx9hIL9nSC683NeODf4zV5fVSlLLsXtE+U7kU5Z EVQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=16FNtv9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a17090a6b4a00b001f0fb79b75csi2757892pjl.81.2022.07.27.11.30.07; Wed, 27 Jul 2022 11:30:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=16FNtv9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241226AbiG0RAt (ORCPT + 99 others); Wed, 27 Jul 2022 13:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241394AbiG0Q7i (ORCPT ); Wed, 27 Jul 2022 12:59:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0634691EC; Wed, 27 Jul 2022 09:37:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C715601BE; Wed, 27 Jul 2022 16:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23A57C433C1; Wed, 27 Jul 2022 16:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939850; bh=iAiwTopTIPQy7eUcBAtaiuzXfEMLf7WvnhWcgS1CENQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=16FNtv9pDWuwgmQQEn38YhY2v4k5P4wQZBx0UxGslFepwPanc1Tjqa01ywjJ6SYr7 8S2JahsPAaVsrLAFHlsy9Q7kwOir01Ssws02PBwfLyPiROUsqik/GYFV7kPabACP1i MiutUe4v4Q1T2Nbu0+Q6jFtl49ifQaMY6+77wfpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Amit Cohen , Nicolas Dichtel , David Ahern , "David S. Miller" Subject: [PATCH 5.15 003/201] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication Date: Wed, 27 Jul 2022 18:08:27 +0200 Message-Id: <20220727161027.098193723@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161026.977588183@linuxfoundation.org> References: <20220727161026.977588183@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ido Schimmel commit e5ec6a2513383fe2ecc2ee3b5f51d97acbbcd4d8 upstream. mlxsw needs to distinguish nexthops with a gateway from connected nexthops in order to write the former to the adjacency table of the device. The check used to rely on the fact that nexthops with a gateway have a 'link' scope whereas connected nexthops have a 'host' scope. This is no longer correct after commit 747c14307214 ("ip: fix dflt addr selection for connected nexthop"). Fix that by instead checking the address family of the gateway IP. This is a more direct way and also consistent with the IPv6 counterpart in mlxsw_sp_rt6_is_gateway(). Cc: stable@vger.kernel.org Fixes: 747c14307214 ("ip: fix dflt addr selection for connected nexthop") Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops") Signed-off-by: Ido Schimmel Reviewed-by: Amit Cohen Reviewed-by: Nicolas Dichtel Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -5196,7 +5196,7 @@ static bool mlxsw_sp_fi_is_gateway(const { const struct fib_nh *nh = fib_info_nh(fi, 0); - return nh->fib_nh_scope == RT_SCOPE_LINK || + return nh->fib_nh_gw_family || mlxsw_sp_nexthop4_ipip_type(mlxsw_sp, nh, NULL); }