From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D9FBC433E3 for ; Mon, 29 Jun 2020 19:55:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52F0D2078A for ; Mon, 29 Jun 2020 19:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593460540; bh=zKVcYxZ7pwGdvdRzSRYHpqasgfwum5iG35R7JTeTdwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BrTBSi+yGiOorJTJAMw+I6Z4FT6ayhwbNm0F2yjdp4pdDW1YRovDAnSHbk7j7wz/6 5uH/gbjlsIQy9TMB1VIrtP/15yz0uruY0Qf0mFxLFPGuA8Yw1b4/WFiRMDM0pDDKYn pTX+cVOF4/x9s/9VrDsiK1E1+tjzxsUtG/MuLRoA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387770AbgF2Tzh (ORCPT ); Mon, 29 Jun 2020 15:55:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:47706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387653AbgF2TkY (ORCPT ); Mon, 29 Jun 2020 15:40:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2DCDC24819; Mon, 29 Jun 2020 15:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444336; bh=zKVcYxZ7pwGdvdRzSRYHpqasgfwum5iG35R7JTeTdwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SL6EKP+IrXcI47CvrO73xRr4SRpiU/3HA0se+KvOKGJmaBsriRE0bvJPuhcsnKr9S 1e9kFwSnnNY3UIqNANM+wvTmLdPNPp9jAyze/J53RQzeY71hzg1UW5urWBiFNppxOZ 7bcn+SDsDB0dAUDx0OUQ3dhAuGQ+QIDt0pP0Kezg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: guodeqing , David Ahern , "David S . Miller" , Greg Kroah-Hartman Subject: [PATCH 5.4 011/178] net: Fix the arp error in some cases Date: Mon, 29 Jun 2020 11:22:36 -0400 Message-Id: <20200629152523.2494198-12-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629152523.2494198-1-sashal@kernel.org> References: <20200629152523.2494198-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.50-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.50-rc1 X-KernelTest-Deadline: 2020-07-01T15:25+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: guodeqing [ Upstream commit 5eea3a63ff4aba6a26002e657a6d21934b7e2b96 ] ie., $ ifconfig eth0 6.6.6.6 netmask 255.255.255.0 $ ip rule add from 6.6.6.6 table 6666 $ ip route add 9.9.9.9 via 6.6.6.6 $ ping -I 6.6.6.6 9.9.9.9 PING 9.9.9.9 (9.9.9.9) from 6.6.6.6 : 56(84) bytes of data. 3 packets transmitted, 0 received, 100% packet loss, time 2079ms $ arp Address HWtype HWaddress Flags Mask Iface 6.6.6.6 (incomplete) eth0 The arp request address is error, this is because fib_table_lookup in fib_check_nh lookup the destnation 9.9.9.9 nexthop, the scope of the fib result is RT_SCOPE_LINK,the correct scope is RT_SCOPE_HOST. Here I add a check of whether this is RT_TABLE_MAIN to solve this problem. Fixes: 3bfd847203c6 ("net: Use passed in table for nexthop lookups") Signed-off-by: guodeqing Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 01588eef0cee2..b1b3220917ca0 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1100,7 +1100,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table, if (fl4.flowi4_scope < RT_SCOPE_LINK) fl4.flowi4_scope = RT_SCOPE_LINK; - if (table) + if (table && table != RT_TABLE_MAIN) tbl = fib_get_table(net, table); if (tbl) -- 2.25.1