← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1953139] [NEW] On IPv6 overlay networks linuxbridge vxlans are created always on loopback device

 

Public bug reported:

Neutron looks up for vxlan parent devices by IFA_LABEL attribute returned from pyroute2.
If I set up IPv4 overlay network, this works without issues.

But when I setup an IPv6 overlay, always the device with index 0
(usually "lo") is being returned by get_devices_with_ip because the
device structure returned for IPv6 addresses doesn't contain IFA_LABEL.

If IFA_LABEL is not found, neutron ip_lib.py tries to find the name of the 'owner' of the address by device index (index is already known here):
for ip_address in ip_addresses:
        index = ip_address['index']
        name = get_attr(ip_address, 'IFA_LABEL') or devices.get(index)
        if not name:
            device = get_devices_info(namespace, index=index)
            if not device:
                continue
            name = device[0]['name']

However priviliged/agent/linux/ip_lib.py get_link_devices() doesn't use
the index kwarg correctly, and returns all devices in the system, and
the code above always returns the first device in the list.

My solution is now to transform get_link_devices() to pass arguments to
ip.get_links() correctly:

--- ip_lib.py.orig      2021-12-03 10:28:40.312266929 +0000
+++ ip_lib.py   2021-12-03 10:26:33.337486559 +0000
@@ -564,7 +564,10 @@
     """
     try:
         with get_iproute(namespace) as ip:
-            return make_serializable(ip.get_links(**kwargs))
+            if "index" in kwargs:
+                return make_serializable(ip.get_links(kwargs['index']))
+            else:
+                return make_serializable(ip.get_links(**kwargs))
     except OSError as e:
         if e.errno == errno.ENOENT:
             raise NetworkNamespaceNotFound(netns_name=namespace)

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1953139

Title:
  On IPv6 overlay networks linuxbridge vxlans are created always on
  loopback device

Status in neutron:
  New

Bug description:
  Neutron looks up for vxlan parent devices by IFA_LABEL attribute returned from pyroute2.
  If I set up IPv4 overlay network, this works without issues.

  But when I setup an IPv6 overlay, always the device with index 0
  (usually "lo") is being returned by get_devices_with_ip because the
  device structure returned for IPv6 addresses doesn't contain
  IFA_LABEL.

  If IFA_LABEL is not found, neutron ip_lib.py tries to find the name of the 'owner' of the address by device index (index is already known here):
  for ip_address in ip_addresses:
          index = ip_address['index']
          name = get_attr(ip_address, 'IFA_LABEL') or devices.get(index)
          if not name:
              device = get_devices_info(namespace, index=index)
              if not device:
                  continue
              name = device[0]['name']

  However priviliged/agent/linux/ip_lib.py get_link_devices() doesn't
  use the index kwarg correctly, and returns all devices in the system,
  and the code above always returns the first device in the list.

  My solution is now to transform get_link_devices() to pass arguments
  to ip.get_links() correctly:

  --- ip_lib.py.orig      2021-12-03 10:28:40.312266929 +0000
  +++ ip_lib.py   2021-12-03 10:26:33.337486559 +0000
  @@ -564,7 +564,10 @@
       """
       try:
           with get_iproute(namespace) as ip:
  -            return make_serializable(ip.get_links(**kwargs))
  +            if "index" in kwargs:
  +                return make_serializable(ip.get_links(kwargs['index']))
  +            else:
  +                return make_serializable(ip.get_links(**kwargs))
       except OSError as e:
           if e.errno == errno.ENOENT:
               raise NetworkNamespaceNotFound(netns_name=namespace)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1953139/+subscriptions



Follow ups