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=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 B3CAAC433E1 for ; Thu, 13 Aug 2020 23:22:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C3CE2078B for ; Thu, 13 Aug 2020 23:22:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p/iFoWE1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726591AbgHMXV6 (ORCPT ); Thu, 13 Aug 2020 19:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgHMXV6 (ORCPT ); Thu, 13 Aug 2020 19:21:58 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00843C061757; Thu, 13 Aug 2020 16:21:57 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id j187so6808745qke.11; Thu, 13 Aug 2020 16:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+u0MmkCtPZTVBw/Lv9wsCBJsbHO7QuG+ZcgJP6PkL6g=; b=p/iFoWE1neCsgtURO4UNUixxN+LxpI4pbMfkxCM3eupG4Z4wJUhTgTp3nrWlYcfLld vyLwOGjHvPYzhLvXcVHcufoCqhMYmUk4PjSsKKNVcEvIsy03mvDmThWNK7vVBQYShUSh EoukOvQpcUNSjK72JVMjS/pmULaR0CUfDNgRl+IFWbafIgO8a469NL8fwmFFE5nz4cy5 v18JCCuToQJoUq2B9kJzz/G9JBFmY2Gwx38+9iTRd9YPIpXjhjvJ7EhgUdaaf+G/8AqZ JfVM2UdwclFGwKM3AlQYUADbjDPu3e3w1S388GDEUEaoJTBUPyfdTqAcbjQXbZcWEn2a vgug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+u0MmkCtPZTVBw/Lv9wsCBJsbHO7QuG+ZcgJP6PkL6g=; b=IxDNcFtNPhvlNPWHIgwy2j3i4FmyhYwsdO6Dsn/IBL8vP4UHqAVkJvLxkN1yf4deC0 ZUEoqzFUt7dUnq+h4WXxhiUnN7Uv09fu6asXZOT+aVUMdSXr5IK33KIa0k2NMYG44fOR DINsy6f5q8hER+aJ5S7D4+kGVH1t5kkaUXqO/YK4OlK3iyTFcUYn+fI42JOxtsIqp6Sw j37xbYv00ap7GBQuCpm/pzIoeinuv9fJC5rEi+4KOYPk09oYi6INj740PTTBkCZ8VEdB fZ37uvFjgrQ2YbDAc1F6c58uwuA8ag0+ntUx0Fhi9gvIucWzht0/sKQlS01McvKZzpFc R67w== X-Gm-Message-State: AOAM532K6QOgNHnaOE5qradlFMDSeWMESlF+95ejO9nIHnaO0PKE4hV+ PaHoxdMKI/p81oCIv8zld93uXfkygSc= X-Google-Smtp-Source: ABdhPJxoM5fKcglwbuj3m8EtbrrvHQu7lJx0oEYZ14bXwpCN4ABHBJbjUmQuKCobrIBgeiBewdpo8w== X-Received: by 2002:a05:620a:1653:: with SMTP id c19mr6965009qko.501.1597360916877; Thu, 13 Aug 2020 16:21:56 -0700 (PDT) Received: from ?IPv6:2601:282:803:7700:1557:417:a433:9b3f? ([2601:282:803:7700:1557:417:a433:9b3f]) by smtp.googlemail.com with ESMTPSA id o47sm8780873qtk.19.2020.08.13.16.21.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 16:21:56 -0700 (PDT) Subject: Re: [PATCH 3/3] ipv6/icmp: l3mdev: Perform icmp error route lookup on source device routing table To: Mathieu Desnoyers , David Ahern Cc: linux-kernel@vger.kernel.org, "David S . Miller" , netdev@vger.kernel.org, Hideaki Yoshifuji References: <20200811195003.1812-1-mathieu.desnoyers@efficios.com> <20200811195003.1812-4-mathieu.desnoyers@efficios.com> From: David Ahern Message-ID: <2adc1bd3-53aa-0f3e-d5e4-740d11098685@gmail.com> Date: Thu, 13 Aug 2020 17:21:55 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200811195003.1812-4-mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 8/11/20 1:50 PM, Mathieu Desnoyers wrote: > As per RFC4443, the destination address field for ICMPv6 error messages > is copied from the source address field of the invoking packet. > > In configurations with Virtual Routing and Forwarding tables, looking up > which routing table to use for sending ICMPv6 error messages is > currently done by using the destination net_device. > > If the source and destination interfaces are within separate VRFs, or > one in the global routing table and the other in a VRF, looking up the > source address of the invoking packet in the destination interface's > routing table will fail if the destination interface's routing table > contains no route to the invoking packet's source address. > > One observable effect of this issue is that traceroute6 does not work in > the following cases: > > - Route leaking between global routing table and VRF > - Route leaking between VRFs > > Preferably use the source device routing table when sending ICMPv6 error > messages. If no source device is set, fall-back on the destination > device routing table. > > Link: https://tools.ietf.org/html/rfc4443 > Signed-off-by: Mathieu Desnoyers > Cc: David Ahern > Cc: David S. Miller > Cc: netdev@vger.kernel.org > --- > net/ipv6/icmp.c | 15 +++++++++++++-- > net/ipv6/ip6_output.c | 2 -- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c > index a4e4912ad607..a971b58b0371 100644 > --- a/net/ipv6/icmp.c > +++ b/net/ipv6/icmp.c > @@ -501,8 +501,19 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, > if (__ipv6_addr_needs_scope_id(addr_type)) { > iif = icmp6_iif(skb); > } else { > - dst = skb_dst(skb); > - iif = l3mdev_master_ifindex(dst ? dst->dev : skb->dev); > + struct net_device *route_lookup_dev = NULL; > + > + /* > + * The device used for looking up which routing table to use is > + * preferably the source whenever it is set, which should > + * ensure the icmp error can be sent to the source host, else > + * fallback on the destination device. > + */ > + if (skb->dev) > + route_lookup_dev = skb->dev; top of icmp6_send there is a check that skb->dev is set. > + else if (skb_dst(skb)) > + route_lookup_dev = skb_dst(skb)->dev; > + iif = l3mdev_master_ifindex(route_lookup_dev); > } > > /* > diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c > index c78e67d7747f..cd623068de53 100644 > --- a/net/ipv6/ip6_output.c > +++ b/net/ipv6/ip6_output.c > @@ -468,8 +468,6 @@ int ip6_forward(struct sk_buff *skb) > * check and decrement ttl > */ > if (hdr->hop_limit <= 1) { > - /* Force OUTPUT device used as source address */ > - skb->dev = dst->dev; I *think* this ok. Not clear to me why the forward path would change the skb->dev like that. Goes back to beginning of the git history. > icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 0); > __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); > >