← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2112453] [NEW] subnet create with subnet-pool and --gateway none creates gateway ip

 

Public bug reported:

Using the "--gateway none" Option while creating a subnet from a subnet
pool does not work, it will create a gateway IP regardless. Additionally
providing a cidr via "--subnet-range " will make it work, no gateway.

Providing subnet-range defeats the purpose of pools in our case. We can
update the subnet to disable the gateway in an additional step.

$ openstack subnet create --subnet-pool subnetpool  --gateway none  --network network subnet
+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| allocation_pools     | 10.40.0.66-10.40.0.94                |
| cidr                 | 10.40.0.64/27                        |
| created_at           | 2025-06-04T09:41:44Z                 |
| description          |                                      |
| dns_nameservers      |                                      |
| dns_publish_fixed_ip | False                                |
| enable_dhcp          | True                                 |
| gateway_ip           | 10.40.0.65                           |
| host_routes          |                                      |
| id                   | 2dfdc96a-2cd7-46ba-8f3a-aac4ab5e5d6e |
| ip_version           | 4                                    |
| ipv6_address_mode    | None                                 |
| ipv6_ra_mode         | None                                 |
| name                 | subnet                               |
| network_id           | ff3312cc-3423-42d0-91cb-cbaed2dd367d |
| project_id           | ba45f7b4569e4e368320a2efbf80f6ac     |
| revision_number      | 0                                    |
| segment_id           | None                                 |
| service_types        |                                      |
| subnetpool_id        | e91584e4-6c38-4074-b7e7-f0c470108587 |
| tags                 |                                      |
| updated_at           | 2025-06-04T09:41:44Z                 |
+----------------------+--------------------------------------+

My guess is that in [1] there is an incomplete check if "--gateway none" was explicitly set, thus resulting in 'is_any_subnetpool_request = not (cidr or gateway_ip)' be true in that case and calling AnySubnetRequest. 
In [2] was a check introduced to ensure a provided gateway ip is within a subnet, but it seems gateway none wasnt included to verify.

class SubnetRequestFactory:
    """Builds request using subnet info"""

    @classmethod
    def get_request(cls, context, subnet, subnetpool):
        cidr = subnet.get('cidr')
        cidr = cidr if validators.is_attr_set(cidr) else None
        gateway_ip = subnet.get('gateway_ip')
        gateway_ip = gateway_ip if validators.is_attr_set(gateway_ip) else None
        subnet_id = subnet.get('id', uuidutils.generate_uuid())

        is_any_subnetpool_request = not (cidr or gateway_ip)
        if is_any_subnetpool_request:


[1] https://github.com/openstack/neutron/blob/master/neutron/ipam/requests.py
[2] https://bugs.launchpad.net/neutron/+bug/1904436

** 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/2112453

Title:
  subnet create with subnet-pool and --gateway none creates gateway ip

Status in neutron:
  New

Bug description:
  Using the "--gateway none" Option while creating a subnet from a
  subnet pool does not work, it will create a gateway IP regardless.
  Additionally providing a cidr via "--subnet-range " will make it work,
  no gateway.

  Providing subnet-range defeats the purpose of pools in our case. We
  can update the subnet to disable the gateway in an additional step.

  $ openstack subnet create --subnet-pool subnetpool  --gateway none  --network network subnet
  +----------------------+--------------------------------------+
  | Field                | Value                                |
  +----------------------+--------------------------------------+
  | allocation_pools     | 10.40.0.66-10.40.0.94                |
  | cidr                 | 10.40.0.64/27                        |
  | created_at           | 2025-06-04T09:41:44Z                 |
  | description          |                                      |
  | dns_nameservers      |                                      |
  | dns_publish_fixed_ip | False                                |
  | enable_dhcp          | True                                 |
  | gateway_ip           | 10.40.0.65                           |
  | host_routes          |                                      |
  | id                   | 2dfdc96a-2cd7-46ba-8f3a-aac4ab5e5d6e |
  | ip_version           | 4                                    |
  | ipv6_address_mode    | None                                 |
  | ipv6_ra_mode         | None                                 |
  | name                 | subnet                               |
  | network_id           | ff3312cc-3423-42d0-91cb-cbaed2dd367d |
  | project_id           | ba45f7b4569e4e368320a2efbf80f6ac     |
  | revision_number      | 0                                    |
  | segment_id           | None                                 |
  | service_types        |                                      |
  | subnetpool_id        | e91584e4-6c38-4074-b7e7-f0c470108587 |
  | tags                 |                                      |
  | updated_at           | 2025-06-04T09:41:44Z                 |
  +----------------------+--------------------------------------+

  My guess is that in [1] there is an incomplete check if "--gateway none" was explicitly set, thus resulting in 'is_any_subnetpool_request = not (cidr or gateway_ip)' be true in that case and calling AnySubnetRequest. 
  In [2] was a check introduced to ensure a provided gateway ip is within a subnet, but it seems gateway none wasnt included to verify.

  class SubnetRequestFactory:
      """Builds request using subnet info"""

      @classmethod
      def get_request(cls, context, subnet, subnetpool):
          cidr = subnet.get('cidr')
          cidr = cidr if validators.is_attr_set(cidr) else None
          gateway_ip = subnet.get('gateway_ip')
          gateway_ip = gateway_ip if validators.is_attr_set(gateway_ip) else None
          subnet_id = subnet.get('id', uuidutils.generate_uuid())

          is_any_subnetpool_request = not (cidr or gateway_ip)
          if is_any_subnetpool_request:


  [1] https://github.com/openstack/neutron/blob/master/neutron/ipam/requests.py
  [2] https://bugs.launchpad.net/neutron/+bug/1904436

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