SLAAC IPv6 addressing doesn't work with more than one subnet

Bug #1358709 reported by Sagi (Sergey) Shnaidman
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Xu Han Peng
Juno
Fix Released
Undecided
Unassigned

Bug Description

When network has more than one IPv6 SLAAC (or dhcp-stateless) subnets, the port receives SLAAC address only from first one, the second address is from fixed IPs range.

Scenario:
1) create a network and two SLAAC subnets:
~$ neutron net-create net12
~$ neutron subnet-create net12 --ipv6-ra-mode=slaac --ipv6-address-mode=slaac --ip-version=6 2003::/64
| allocation_pools | {"start": "2003::2", "end": "2003::ffff:ffff:ffff:fffe"} |
| cidr | 2003::/64 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 2003::1 |
| host_routes | |
| id | 220b7e4e-b30a-4d5c-847d-58df72bf7e8d |
| ip_version | 6 |
| ipv6_address_mode | slaac |
| ipv6_ra_mode | slaac |
| name | |
| network_id | 4cfe1699-a10d-4706-bedb-5680cb5cf27f |
| tenant_id | 834b2e7732cb4ad4b3df81fe0b0ea906 |

~$ neutron subnet-create --name=additional net12 --ipv6-ra-mode=slaac --ipv6-address-mode=slaac --ip-version=6 2004::/64
| allocation_pools | {"start": "2004::2", "end": "2004::ffff:ffff:ffff:fffe"} |
| cidr | 2004::/64 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 2004::1 |
| host_routes | |
| id | e48e5d96-565f-45b1-8efc-4634d3ed8bf8 |
| ip_version | 6 |
| ipv6_address_mode | slaac |
| ipv6_ra_mode | slaac |
| name | additional |
| network_id | 4cfe1699-a10d-4706-bedb-5680cb5cf27f |
| tenant_id | 834b2e7732cb4ad4b3df81fe0b0ea906 |

Now let's create port in this network:

~$ neutron port-create net12
Created a new port:
+-----------------------+--------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:vnic_type | normal |
| device_id | |
| device_owner | |
| fixed_ips | {"subnet_id": "220b7e4e-b30a-4d5c-847d-58df72bf7e8d", "ip_address": "2003::f816:3eff:fe55:6297"} |
| | {"subnet_id": "e48e5d96-565f-45b1-8efc-4634d3ed8bf8", "ip_address": "2004::2"} |
| id | 12c29fd4-1c68-4aea-88c6-b89d73ebac2c |
| mac_address | fa:16:3e:55:62:97 |
| name | |
| network_id | 4cfe1699-a10d-4706-bedb-5680cb5cf27f |
| security_groups | 65e77cc0-879c-4ed0-b647-d27d36844e0b |
| status | DOWN |
| tenant_id | 834b2e7732cb4ad4b3df81fe0b0ea906 |

As we see we get SLAAC IP from first subnet and fixed IP from second one.
Expected is to get SLAAC IPs from both subnets.

Changed in neutron:
assignee: nobody → Eugene Nikanorov (enikanorov)
importance: Undecided → Medium
Changed in neutron:
status: New → Confirmed
Revision history for this message
Baodong (Robert) Li (baoli) wrote :

the problem seems to be in _allocate_ips_for_port() in db_base_plugin_v2.py, with the statement:
       v6.remove(subnet)

v6 is the loop iterator, and its item shouldn't be removed while looping over it.

Another thing is that it used to be allocating one IP from each address family. The behavior seems to be changed by this code. Multiple prefixes are being addressed by the blueprint: https://blueprints.launchpad.net/neutron/+spec/multiple-ipv6-prefixes

Revision history for this message
Dane LeBlanc (leblancd) wrote :

This should be addresses with the changes for multiple-ipv6-prefixes blueprint:
https://review.openstack.org/#/c/113339/

Revision history for this message
Xu Han Peng (xuhanp) wrote :

I have a fix available if no one is working on this bug right now.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/147076

Changed in neutron:
assignee: Eugene Nikanorov (enikanorov) → Xu Han Peng (xuhanp)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/147076
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=1dac7c43471f18ea83784986b5ffeab83e26323b
Submitter: Jenkins
Branch: master

commit 1dac7c43471f18ea83784986b5ffeab83e26323b
Author: Xu Han Peng <email address hidden>
Date: Wed Jan 14 14:15:49 2015 +0800

    Fix IP allocation for multiple slaac subnets

    Currently when one network contains multiple IPv6 slaac
    subnets, the IP allocation for the port on this network
    is not correct. Only the first fixed ip is based on EUI64.
    This is caused by a wrong usage of removing element in list.

    Change-Id: I1b0a478997371afeae34c0536d5fed7a18223f63
    Closes-Bug:1358709

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/149065

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/juno)

Reviewed: https://review.openstack.org/149065
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=755f2ad747bf72bb27ff356ebca8d40a53022937
Submitter: Jenkins
Branch: stable/juno

commit 755f2ad747bf72bb27ff356ebca8d40a53022937
Author: Xu Han Peng <email address hidden>
Date: Wed Jan 14 14:15:49 2015 +0800

    Fix IP allocation for multiple slaac subnets

    Currently when one network contains multiple IPv6 slaac
    subnets, the IP allocation for the port on this network
    is not correct. Only the first fixed ip is based on EUI64.
    This is caused by a wrong usage of removing element in list.

    Change-Id: I1b0a478997371afeae34c0536d5fed7a18223f63
    Closes-Bug:1358709
    (cherry picked from commit 1dac7c43471f18ea83784986b5ffeab83e26323b)

tags: added: in-stable-juno
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/167129

Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-2 → 2015.1.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Kyle Mestery (<email address hidden>) on branch: master
Review: https://review.openstack.org/167129
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.