From: David Ahern Subject: Re: [RFC v4 3/5] vxlan: add support for underlay in non-default VRF Date: Thu, 22 Nov 2018 10:19:32 -0700 Message-ID: <570aef1e-2d72-9248-05c9-2187bddcabb0@cumulusnetworks.com> References: <20181122010713.3995-1-abauvin@scaleway.com> <20181122010713.3995-4-abauvin@scaleway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, akherbouche@scaleway.com To: Alexis Bauvin , roopa@cumulusnetworks.com Return-path: Received: from mail-io1-f48.google.com ([209.85.166.48]:41404 "EHLO mail-io1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387509AbeKWD7x (ORCPT ); Thu, 22 Nov 2018 22:59:53 -0500 Received: by mail-io1-f48.google.com with SMTP id s22so7058471ioc.8 for ; Thu, 22 Nov 2018 09:19:34 -0800 (PST) In-Reply-To: <20181122010713.3995-4-abauvin@scaleway.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/21/18 6:07 PM, Alexis Bauvin wrote: > Creating a VXLAN device with is underlay in the non-default VRF makes > egress route lookup fail or incorrect since it will resolve in the > default VRF, and ingress fail because the socket listens in the default > VRF. > > This patch binds the underlying UDP tunnel socket to the l3mdev of the > lower device of the VXLAN device. This will listen in the proper VRF and > output traffic from said l3mdev, matching l3mdev routing rules and > looking up the correct routing table. > > When the VXLAN device does not have a lower device, or the lower device > is in the default VRF, the socket will not be bound to any interface, > keeping the previous behaviour. > > The underlay l3mdev is deduced from the VXLAN lower device > (IFLA_VXLAN_LINK). > > +----------+ +---------+ > | | | | > | vrf-blue | | vrf-red | > | | | | > +----+-----+ +----+----+ > | | > | | > +----+-----+ +----+----+ > | | | | > | br-blue | | br-red | > | | | | > +----+-----+ +---+-+---+ > | | | > | +-----+ +-----+ > | | | > +----+-----+ +------+----+ +----+----+ > | | lower device | | | | > | eth0 | <- - - - - - - | vxlan-red | | tap-red | (... more taps) > | | | | | | > +----------+ +-----------+ +---------+ > > Signed-off-by: Alexis Bauvin > Reviewed-by: Amine Kherbouche > Tested-by: Amine Kherbouche > --- > drivers/net/vxlan.c | 32 +++++-- > .../selftests/net/test_vxlan_under_vrf.sh | 90 +++++++++++++++++++ > 2 files changed, 114 insertions(+), 8 deletions(-) > create mode 100755 tools/testing/selftests/net/test_vxlan_under_vrf.sh > Reviewed-by: David Ahern Thanks for adding the test case; I'll try it out next week (after the holidays).