netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Stephen Suryaputra <ssuryaextr@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: VRF destination unreachable
Date: Tue, 27 Feb 2018 10:09:18 -0700	[thread overview]
Message-ID: <7542e99d-7cc1-ac6d-c266-d75a60047df8@gmail.com> (raw)
In-Reply-To: <CAHapkUgiZwAaG8FA+BcTwc--UYmXQ-cD0-_3Ews7F6-PrCymcw@mail.gmail.com>

On 2/27/18 9:09 AM, Stephen Suryaputra wrote:
> Thanks David for confirming that this is unintended.
> 
> Given that, I think the fix isn't complete because when forwarding
> isn't enabled on the original incoming netdev, the ICMP shouldn't be
> generated. This diff fixes that case:
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index a4f44d8..dc40a94 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -937,13 +937,20 @@ static int ip_error(struct sk_buff *skb)
>         struct net *net;
>         bool send;
>         int code;
> +       int in_dev_forward;

declarations are in reverse xmas tree order. ie., put this new one after
peer.


> 
>         /* IP on this device is disabled. */
>         if (!in_dev)
>                 goto out;
> 
>         net = dev_net(rt->dst.dev);
> -       if (!IN_DEV_FORWARD(in_dev)) {
> +       if (netif_is_l3_master(skb->dev)) {
> +               in_dev_forward = IN_DEV_FORWARD(
> +                       __in_dev_get_rcu(__dev_get_by_index(net,
> IPCB(skb)->iif)));
> +       } else {
> +               in_dev_forward = IN_DEV_FORWARD(in_dev);
> +       }

That looks correct.

> +       if (!in_dev_forward) {
>                 switch (rt->dst.error) {
>                 case EHOSTUNREACH:
>                         __IP_INC_STATS(net, IPSTATS_MIB_INADDRERRORS);
> 
> I can put a formal patch if you like.
> 

please do.

      reply	other threads:[~2018-02-27 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-23 17:49 VRF destination unreachable Stephen Suryaputra
2018-02-23 20:58 ` David Ahern
2018-02-27 16:09   ` Stephen Suryaputra
2018-02-27 17:09     ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7542e99d-7cc1-ac6d-c266-d75a60047df8@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=ssuryaextr@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).