DHCP server crashes on networks where IPv6 addresses were supplied unshortened

Bug #1266780 reported by Josie H
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Xu Han Peng

Bug Description

Added a subnet as shown below.

neutron subnet-create HA1 fd5f:5d21:845:1e3c::/64 --name HA1SubnetIPv6 --no-gateway --host-route destination=::/0,nexthop=fd5f:5d21:845:1e3c::2 --allocation-pool start=fd5f:5d21:0845:1e3c:ff00:0000:0042:0100,end=fd5f:5d21:0845:1e3c:ff00:0000:0042:0180 --ip-version 6

I wasn't necessarily expecting DHCP to work for IPv6, but it stopped working for IPv4. In the log, I saw that the DHCP server had begun failing with the error:
http://paste.openstack.org/show/60638/

After a little digging in the code, I realised the DHCP agent was trying to re-add an address (for the DHCP server) that already existed. I'm pretty sure the problem happens in init_l3 in interface.py, where desired addresses are compared with existing addresses returned by "ip addr show". Since "show" returns IPv6 addresses in shortened form (i.e. with unnecessary 0s removed), and the starting address I specified when creating the subnet is unshortened, the comparison fails and the agent tries to add the address again, which fails and causes the DHCP agent to abort startup.

Of course, it's possible the failure to convert IPv6 addresses into shortened form (or enforce entry only in shortened form) could have other effects that I haven't observed.

Workaround: Specify all IPv6 addresses in shortened form when setting up subnets. The given Exception stops happening. (Though I've subsequently run into Bug 1257446 which also prevents dual-stack operation.)

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

We can shorten the IPv6 address before comparing it with existing addresses by "netaddr.strategy.ipv6.int_to_str(ip.value)"

I will try to submit a change soon.

Changed in neutron:
assignee: nobody → Xu Han Peng (xuhanp)
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/72880

Changed in neutron:
status: New → In Progress
tags: added: ipv6
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/72880
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=597288b1d1dfd148d1d782230bd258f3c851cbe0
Submitter: Jenkins
Branch: master

commit 597288b1d1dfd148d1d782230bd258f3c851cbe0
Author: Xuhan Peng <email address hidden>
Date: Wed Feb 12 03:41:23 2014 -0500

    Fix unshortened IPv6 address caused DHCP crash

    When unshortened IPv6 address provided to allocation pool, DHCP
    agent crashed because OpenStack is trying to add same IPv6 addresses
    to dhcp tap device.

    The root cause is that current code compares provided unshortened
    IPv6 address with the returned result of "ip addr list", which is
    shortened. So the same IPv6 address is treated as different ones.

    The fix is trying to shorten the provided address before comparison.

    Change-Id: If1e183e65c5ab785b73771d9a3d4b525d38284a9
    Closes-Bug: 1266780

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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