All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: Jack Ma <Jack.Ma@alliedtelesis.co.nz>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: Adding support for VRF traffic passed by mangle table
Date: Mon, 3 Apr 2017 09:24:06 -0400	[thread overview]
Message-ID: <30880eec-7d79-170b-4369-73c4d0ccc4ba@cumulusnetworks.com> (raw)
In-Reply-To: <1491188266363.26046@alliedtelesis.co.nz>

On 4/2/17 10:57 PM, Jack Ma wrote:
> diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
> index c0cc6aa..07168d4 100644
> --- a/net/ipv4/netfilter.c
> +++ b/net/ipv4/netfilter.c
> @@ -46,6 +46,14 @@ int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_t
>                 fl4.flowi4_oif = l3mdev_master_ifindex(dev);

How does the above line (which is part of this block:
        fl4.flowi4_oif = sk ? sk->sk_bound_dev_if : 0;
        if (!fl4.flowi4_oif)
                fl4.flowi4_oif = l3mdev_master_ifindex(dev);

) not work? The dst should be set on the skb at this point and the
device would reference the VRF.


>         fl4.flowi4_mark = skb->mark;
>         fl4.flowi4_flags = flags;
> +
> +       /* Since we have already known this is vrf flow passed by
> +        * mangle table, we wrap the oif with the master interface.
> +        */
> +       if (fl4.flowi4_oif == 0 && fl4.daddr && skb->dev &&
> +           netif_index_is_l3_master(net, skb->dev->ifindex))
> +               fl4.flowi4_oif = skb->dev->ifindex;
> +
>         rt = ip_route_output_key(net, &fl4);
>         if (IS_ERR(rt))
>                 return PTR_ERR(rt);
> 

      reply	other threads:[~2017-04-03 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  2:57 Adding support for VRF traffic passed by mangle table Jack Ma
2017-04-03 13:24 ` 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=30880eec-7d79-170b-4369-73c4d0ccc4ba@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=Jack.Ma@alliedtelesis.co.nz \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.