← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1188845] Re: Valid IP addresses cannot be determined if a 'non-root' CIDR is used

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

** Changed in: neutron
    Milestone: None => havana-2

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

Title:
  Valid IP addresses cannot be determined if a 'non-root' CIDR is used

Status in OpenStack Neutron (virtual network service):
  Fix Released

Bug description:
  When the CIDR provided is something like 10.0.0.254/24.  This value is
  syntactically the same as 10.0.0.0/24.  They are the same because the
  /24 indicated that the last 8 digits (it is a 32 digit space - so 32 -
  8 == 24) should be dropped and the first address used.  This notation
  is not common, as the first address is typically used.  However, there
  are scenarios where this type of notation is common.  Example, I have
  an IP Address and the subnet, so I just mesh the two together...

  Currently, Quantum doesn't handle this approach to creating a subnet.
  Instead, it fails:

  In the following manner:

  2013-06-03 06:31:16,364 - quantum.api.v2.resource - ERROR - create failed
  Traceback (most recent call last):
    File "/usr/lib/python2.6/site-packages/quantum/api/v2/resource.py", line 85, in resource
      result = method(request=request, **args)
    File "/usr/lib/python2.6/site-packages/quantum/api/v2/base.py", line 372, in create
      obj = obj_creator(request.context, **kwargs)
    File "/usr/lib/python2.6/site-packages/quantum/db/db_base_plugin_v2.py", line 1296, in create_port
      ips = self._allocate_ips_for_port(context, network, port)
    File "/usr/lib/python2.6/site-packages/quantum/db/db_base_plugin_v2.py", line 703, in _allocate_ips_for_port
      p['fixed_ips'])
    File "/usr/lib/python2.6/site-packages/quantum/db/db_base_plugin_v2.py", line 598, in _test_fixed_ips_for_port
      raise q_exc.InvalidInput(error_message=msg)
  InvalidInput: Invalid input for operation: IP address 10.0.0.10 is not a valid IP for the defined networks subnets.
  [root@z3-9-5-126-163 quantum]#

  This is because the code in quantum/db/db_base_plugin_v2.py  in
  _check_subnet_ip does the following:

          if (ip != net.network and
                  ip != net.broadcast and
                  net.netmask & ip == net.ip):
              return True
          return False

  It is assuming that net.ip will always be the root IP address.  I
  believe that this can be resolved by just applying net.netmask to
  net.ip as well as net.netmask.  This approach worked in the various
  combinations I tried.

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