netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Subject: Fw: [Bug 203533] New: VxLAN: Cannot create multiple vxlan devices for a given VNI and different source addresses.
Date: Tue, 7 May 2019 08:08:21 -0700	[thread overview]
Message-ID: <20190507080821.3496b560@hermes.lan> (raw)

This is a valid request, not sure if just changing the check is enough
because it also matters where packets match endpoints.


Begin forwarded message:

Date: Mon, 06 May 2019 21:18:30 +0000
From: bugzilla-daemon@bugzilla.kernel.org
To: stephen@networkplumber.org
Subject: [Bug 203533] New: VxLAN: Cannot create multiple vxlan devices for a given VNI and different source addresses.


https://bugzilla.kernel.org/show_bug.cgi?id=203533

            Bug ID: 203533
           Summary: VxLAN: Cannot create multiple vxlan devices for a
                    given VNI and different source addresses.
           Product: Networking
           Version: 2.5
    Kernel Version: 4.9.110
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: IPV4
          Assignee: stephen@networkplumber.org
          Reporter: hasanrazaonline@gmail.com
        Regression: No

When trying to create two vxlan terminations with different source VTEPs, only
one termination is allowed and second netdevice creation fails with EEXIST
error.

root@:~# ip link add vxlan-10 type vxlan id 10 local 10.1.1.1 dstport 4789
root@:~# ip link add vxlan2-10 type vxlan id 10 local 20.1.1.1 dstport 4789
RTNETLINK answers: File exists
root@:~#

It is a valid use-case scenario where a router is terminating multiple VxLAN
endpoints. But this doesn't seem to be allowed in the kernel.

The EEXIST error is coming from here:
vxlan_dev_configure():
...
    list_for_each_entry(tmp, &vn->vxlan_list, next) {
        if (tmp->cfg.vni == conf->vni &&
          | (tmp->default_dst.remote_ip.sa.sa_family == AF_INET6 ||
          |  tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 &&
          | tmp->cfg.dst_port == vxlan->cfg.dst_port &&
          | (tmp->flags & VXLAN_F_RCV_FLAGS) ==
          | (vxlan->flags & VXLAN_F_RCV_FLAGS)) {
            pr_info("duplicate VNI %u\n", be32_to_cpu(conf->vni));
            return -EEXIST;
        }
    }

The uniqueness of vxlan device should be checked with <local-endpoint, vni,
dstport> instead of just <vni, dstport>. Similarly, vxlan_vs_find_vni() should  
lookup vxlan device using <src-addr, vni> instead of just <vni>:
static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, __be32 vni)

As per the code, I can see this issue exists in v5.1 as well.

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2019-05-07 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190507080821.3496b560@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.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 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).