Received: by 10.192.165.156 with SMTP id m28csp60500imm; Tue, 10 Apr 2018 16:23:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+4cvhTJT04mWSdgD0GnzJju4Uhs+bTkKC9zgWjePc5bEaG8TwA33KfWdCtnEmnt1sydCnr X-Received: by 10.98.14.7 with SMTP id w7mr1986309pfi.50.1523402615319; Tue, 10 Apr 2018 16:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402615; cv=none; d=google.com; s=arc-20160816; b=PR8dzmVODEt03ZuLv/wV2Ow02pw7s40AdwrGF4FvAljLy/RhKex5039MIpFRnIHD+n y4ipNgh2u5Wjbbc5YFI1MYyEdb6B5saw1UD1OfufrA3d9n8uTcJoX+Em4Bi6X39jjkDj e+DI4vDMFbC95es0qrGkeAg90RpR7vAoU7HLSezHiz2IOLWV9VlmraMli0d06/km+JRT RHlH2WyLj1gs5kiww0joYyIekZ7qJxgEr8y5Eky+KqCSL9P1H7ZURIOy5J3NttvOWfxw +6oMXCxzs8tM7IvZxJ2ZcxUlsR6r2oT/U+xokRR02j9z/gXjml/VpbyYQCqWGmDB14jy VWjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yZDFanwnwjK/GCeVQS3dYQEHz1/G7MlapZcauY3SiKw=; b=cl/5HhGveBuc5cIgD5MR/nw+q2oUBCWMB5ms1gDaJBS96fh/p/mqgklPCVmViqewRs 4NCIdAbiyawbBiG6IFVBjnOfuSijdT/d3tqXR+oVKCOoCOGWi/7PJMUtyJAULOwLjANK r947j8jtBiT75FUJh8Lm7mkzCcSO1cypXi0C7hpMo2awBLt7nOqBjtxUNKeh2k87jLU3 NJX75yr5xvtWNe+CyTwA3y42PYA/vN6XtKaW2/0kf0epVm+ohSSPGNaKhDSiAU4BURHM 4mKfSbteKpMb066G258XWJdLILPBwqQYhIGwXhH1Z1PdfzJZIJBnmp9+wWcF7oqiCBHN XDEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si2475134pgq.8.2018.04.10.16.22.58; Tue, 10 Apr 2018 16:23:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755393AbeDJXSG (ORCPT + 99 others); Tue, 10 Apr 2018 19:18:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40380 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754803AbeDJWb2 (ORCPT ); Tue, 10 Apr 2018 18:31:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EAB1BDE0; Tue, 10 Apr 2018 22:31:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Donald Sharp , David Ahern , "David S. Miller" Subject: [PATCH 4.15 126/168] net/ipv6: Fix route leaking between VRFs Date: Wed, 11 Apr 2018 00:24:28 +0200 Message-Id: <20180410212806.062178301@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Ahern [ Upstream commit b6cdbc85234b072340b8923e69f49ec293f905dc ] Donald reported that IPv6 route leaking between VRFs is not working. The root cause is the strict argument in the call to rt6_lookup when validating the nexthop spec. ip6_route_check_nh validates the gateway and device (if given) of a route spec. It in turn could call rt6_lookup (e.g., lookup in a given table did not succeed so it falls back to a full lookup) and if so sets the strict argument to 1. That means if the egress device is given, the route lookup needs to return a result with the same device. This strict requirement does not work with VRFs (IPv4 or IPv6) because the oif in the flow struct is overridden with the index of the VRF device to trigger a match on the l3mdev rule and force the lookup to its table. The right long term solution is to add an l3mdev index to the flow struct such that the oif is not overridden. That solution will not backport well, so this patch aims for a simpler solution to relax the strict argument if the route spec device is an l3mdev slave. As done in other places, use the FLOWI_FLAG_SKIP_NH_OIF to know that the RT6_LOOKUP_F_IFACE flag needs to be removed. Fixes: ca254490c8df ("net: Add VRF support to IPv6 stack") Reported-by: Donald Sharp Signed-off-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -922,6 +922,9 @@ static struct rt6_info *ip6_pol_route_lo struct rt6_info *rt, *rt_cache; struct fib6_node *fn; + if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF) + flags &= ~RT6_LOOKUP_F_IFACE; + rcu_read_lock(); fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr); restart: