Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4480321rwb; Tue, 6 Sep 2022 08:06:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4OMr2CMZebrJCUmvu3leP8Jj8IOumCFdEA5nG4wNSRjD2jeW9rjVsjhaGGockh0bsFQkGB X-Received: by 2002:a05:6402:e01:b0:442:dd7e:f49d with SMTP id h1-20020a0564020e0100b00442dd7ef49dmr47208665edh.355.1662476801642; Tue, 06 Sep 2022 08:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476801; cv=none; d=google.com; s=arc-20160816; b=D8mL0kP3/FeBjgFGsjCTxsCxkqMer4IhBc/SoYPVe5tHp4gziPPb+lRgT04EwKyu4p /MOfBUNOPAtYNkIEtYPq/rI7wz41SBdIkkRqBHur1MZ0qCXOxDWnXjAXC9jKqcXla4if ecY/winHTdJBtIGjeqbSQ41AMR+RW9eyNZzpBag8HrMvMs/XIChRKn8ku0rfi6VMg4Ev nVD7Q/W0yf2i/aa/rqRyOeraKFJyR5hYaUAEIoqMSX6INvrwDrE85zLZ45j6DWJzqU7D qe+prkWAYs+Kq5slkdfnIyse55vZuhS/1NBBqs6aBWTz98USTZak8OMrAigB53doKvCH wxKQ== 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=anJUKgLmGd+joKh3LU7Q2DFK4Tj0dSad9YFD4TvX1jk=; b=MfqXhoZW1sw1xZXecoelkNPvhbozITDjp7KSVRDs5Nutl3/mpDZMq7z3TJWsPbYDOF ZXy8Jxpb76fch9AEQUve5tPcYSBrsM+cdKzR0Ahbp4la8HCouZiAdPkEHiPsX3jPJ2uL N2i2m0wfhNVr2iNpNFDYm8lXeO9JGASH15E8V6Lbk+SpxkXd6B0taG8s4PTTQHyCj2M0 /wn5/MSsi2xyq8+LJQevdmtxVt2RD2r067iQWKbFZrMRDCVe3vtq1feew4if/iwOa9Z5 1drpPRnoKZQsjSZmPZgWVXlmSOQA/xRC8a9TOk8rXB0Rpi4qSavkaC1d2PUkC4E3FXZF +Qzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1QxLJn5d; 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 fj18-20020a0564022b9200b0044ed87e41f8si363344edb.478.2022.09.06.08.06.15; Tue, 06 Sep 2022 08:06:41 -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=1QxLJn5d; 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 S241696AbiIFOVX (ORCPT + 99 others); Tue, 6 Sep 2022 10:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241855AbiIFOSy (ORCPT ); Tue, 6 Sep 2022 10:18:54 -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 7887529CA3; Tue, 6 Sep 2022 06:49:58 -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 3920961552; Tue, 6 Sep 2022 13:49:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 469CFC4347C; Tue, 6 Sep 2022 13:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472141; bh=CRt/nAFidu2/Fa+kSY83hNUBSE8UekJvMXGOpiPP4Fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1QxLJn5dHe5jZRxF9/Gj9sUF754/XkvIgSQN39EBcB27rCxOI3+5b6DHc9NsI6udg MgUsb1t4J0ZZkVrPdJLAZz6I2F87019DtXxc8wBB0NNfWrHtwf/aGVE549s876d9RP fUVs0TX9adfSQO2UNw9l6qFVIsK7s8aO8UU0ZtjY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Heng Qi , Nicolas Dichtel , David Ahern , Jakub Kicinski Subject: [PATCH 5.19 141/155] ip: fix triggering of icmp redirect Date: Tue, 6 Sep 2022 15:31:29 +0200 Message-Id: <20220906132835.400192625@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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: Nicolas Dichtel commit eb55dc09b5dd040232d5de32812cc83001a23da6 upstream. __mkroute_input() uses fib_validate_source() to trigger an icmp redirect. My understanding is that fib_validate_source() is used to know if the src address and the gateway address are on the same link. For that, fib_validate_source() returns 1 (same link) or 0 (not the same network). __mkroute_input() is the only user of these positive values, all other callers only look if the returned value is negative. Since the below patch, fib_validate_source() didn't return anymore 1 when both addresses are on the same network, because the route lookup returns RT_SCOPE_LINK instead of RT_SCOPE_HOST. But this is, in fact, right. Let's adapat the test to return 1 again when both addresses are on the same link. CC: stable@vger.kernel.org Fixes: 747c14307214 ("ip: fix dflt addr selection for connected nexthop") Reported-by: kernel test robot Reported-by: Heng Qi Signed-off-by: Nicolas Dichtel Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20220829100121.3821-1-nicolas.dichtel@6wind.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/fib_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -389,7 +389,7 @@ static int __fib_validate_source(struct dev_match = dev_match || (res.type == RTN_LOCAL && dev == net->loopback_dev); if (dev_match) { - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; return ret; } if (no_addr) @@ -401,7 +401,7 @@ static int __fib_validate_source(struct ret = 0; if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) { if (res.type == RTN_UNICAST) - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; } return ret;