From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] net: ipv4: Make "ip route get" match iif lo rules again. Date: Mon, 15 Jan 2018 13:54:19 -0500 (EST) Message-ID: <20180115.135419.992724517936932654.davem@davemloft.net> References: <20180111093626.214125-1-lorenzo@google.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, dsahern@gmail.com, rami.rosen@intel.com, nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com To: lorenzo@google.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:50792 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750718AbeAOSyV (ORCPT ); Mon, 15 Jan 2018 13:54:21 -0500 In-Reply-To: <20180111093626.214125-1-lorenzo@google.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Lorenzo Colitti Date: Thu, 11 Jan 2018 18:36:26 +0900 > Commit 3765d35ed8b9 ("net: ipv4: Convert inet_rtm_getroute to rcu > versions of route lookup") broke "ip route get" in the presence > of rules that specify iif lo. > > Host-originated traffic always has iif lo, because > ip_route_output_key_hash and ip6_route_output_flags set the flow > iif to LOOPBACK_IFINDEX. Thus, putting "iif lo" in an ip rule is a > convenient way to select only originated traffic and not forwarded > traffic. > > inet_rtm_getroute used to match these rules correctly because > even though it sets the flow iif to 0, it called > ip_route_output_key which overwrites iif with LOOPBACK_IFINDEX. > But now that it calls ip_route_output_key_hash_rcu, the ifindex > will remain 0 and not match the iif lo in the rule. As a result, > "ip route get" will return ENETUNREACH. > > Fixes: 3765d35ed8b9 ("net: ipv4: Convert inet_rtm_getroute to rcu versions of route lookup") > Tested: https://android.googlesource.com/kernel/tests/+/master/net/test/multinetwork_test.py passes again > Signed-off-by: Lorenzo Colitti Applied and queued up for -stable, thanks!