can update the gateway of ipv6 subnet with ipv6 address which has a leading "0" via cli

Bug #1531103 reported by hgangwx
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Wishlist
Unassigned

Bug Description

[Summary]
can update the gateway of ipv6 subnet with ipv6 address which has a leading "0" via cli

[Topo]
devstack all-in-one node

[Description and expect result]
if update the gateway of ipv6 subnet with ipv6 address which has a leading "0",
 should reject leading '0's to avoid ambiguity.

[Reproduceable or not]
reproduceable

[Recreate Steps]
1) create 1 ipv6 subnet:
root@45-59:/opt/stack/devstack# neutron subnet-create net11 2::1/64
--ip-version 6 --name sub11
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| allocation_pools | {"start": "2::2", "end": "2::ffff:ffff:ffff:ffff"} |
| cidr | 2::/64 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 2::1 |
| host_routes | |
| id | e2a09fa2-52ce-4f68-9619-b635529213d0 |
| ip_version | 6 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | sub11 |
| network_id | af909be2-5413-40a0-984f-cd58dc7289c9 |
| subnetpool_id | |
| tenant_id | bc125faaf00041f492eaf10f72a37c2d |
+-------------------+----------------------------------------------------+
root@45-59:/opt/stack/devstack#

2)update the gateway of subnet with needless "0" in the ip address:
root@45-59:/opt/stack/devstack# neutron subnet-update --gateway 2::0001 sub11
Updated subnet: sub11
root@45-59:/opt/stack/devstack#
root@45-59:/opt/stack/devstack# neutron subnet-show sub11
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| allocation_pools | {"start": "2::2", "end": "2::ffff:ffff:ffff:ffff"} |
| cidr | 2::/64 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 2::0001 >>>ISSUE |
| host_routes | |
| id | e2a09fa2-52ce-4f68-9619-b635529213d0 |
| ip_version | 6 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | sub11 |
| network_id | af909be2-5413-40a0-984f-cd58dc7289c9 |
| subnetpool_id | |
| tenant_id | bc125faaf00041f492eaf10f72a37c2d |
+-------------------+----------------------------------------------------+

3) if update the gateway of ipv6 subnet with ipv6 address which has a leading
 "0" via dashboard, no this issue

4) For reference, below is the occurence of updating gateway of ipv4 subnet:
root@45-59:/opt/stack/devstack# neutron subnet-update --gateway 1.0.0.001 sub1
Invalid input for gateway_ip. Reason: '1.0.0.001' is not an accepted IP address,
 '1.0.0.1' is recommended.
root@45-59:/opt/stack/devstack#

[Configration]
reproduceable bug, no need

[logs]
reproduceable bug, no need

[Root cause anlyze or debug inf]
reproduceable bug

[Attachment]
None

Tags: rfe-approved
Changed in neutron:
assignee: nobody → Reedip (reedip-banerjee)
affects: neutron → python-neutronclient
Revision history for this message
Reedip (reedip-banerjee-deactivatedaccount) wrote :

Found a similar bug has been fixed in neutron for IPv4.
This can be added to the same, and the validation can hence be taken care in a single API call

affects: python-neutronclient → neutron
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/267283

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/267283
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.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

New owner needed.

Changed in neutron:
status: In Progress → Incomplete
assignee: Reedip (reedip-banerjee) → nobody
Changed in neutron:
assignee: nobody → Reedip (reedip-banerjee)
status: Incomplete → In Progress
Changed in neutron:
assignee: Reedip (reedip-banerjee) → Brian Haley (brian-haley)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.openstack.org/357670
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=a18de8bb39b1148b40fdd1de68976b4b7f632cd5
Submitter: Jenkins
Branch: master

commit a18de8bb39b1148b40fdd1de68976b4b7f632cd5
Author: Reedip <email address hidden>
Date: Fri Aug 19 14:01:45 2016 +0530

    Add converter to convert IPv6 addresses to canonical format

    With respect to Section-4 of [1], the following patch adds
    a function to compress the extended IPv6 address passed to
    the neutron server to its canonical form. This allows
    compressed IPv6 addresses to be stored and remove any
    leading zeroes in the IPv6 addresses.

    Non-canonical IPv6 address formatted inputs wont be blocked,
    but the addresses would be normalized to canonical formats.

    [1]: http://tools.ietf.org/html/rfc5952

    Partial-Bug: #1531103
    Change-Id: Ic9afa5f90fba783748f7c56e8fba02e06af69748

Changed in neutron:
assignee: Brian Haley (brian-haley) → Reedip (reedip-banerjee)
Changed in neutron:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Revision history for this message
Kevin Benton (kevinbenton) wrote : auto-abandon-script

This bug has had a related patch abandoned and has been automatically un-assigned due to inactivity. Please re-assign yourself if you are continuing work or adjust the state as appropriate if it is no longer valid.

Changed in neutron:
assignee: Reedip (reedip-banerjee) → nobody
status: In Progress → New
tags: added: timeout-abandon
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Kevin Benton (<email address hidden>) on branch: master
Review: https://review.openstack.org/267283
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.

Changed in neutron:
assignee: nobody → Reedip (reedip-banerjee)
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-lib (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Reedip (<email address hidden>) on branch: master
Review: https://review.openstack.org/267283
Reason: Moved to https://review.openstack.org/#/c/493280/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron-lib (master)

Change abandoned by boden (<email address hidden>) on branch: master
Review: https://review.openstack.org/493280
Reason: This patch has been idle for some time and therefore I'm removing it from the queue for housecleaning purposes. If this is still a valid patch, please re-push an updated patch. Thanks.

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

I am not sure I agree with the premise: I think both requests should be allowed (both address formats are valid).

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

Also, this is a backwards incompatible API change. We would need to discuss whether we should allow it first.

tags: added: rfe
removed: timeout-abandon
Changed in neutron:
importance: Undecided → Wishlist
Changed in neutron:
status: In Progress → Triaged
Revision history for this message
Akihiro Motoki (amotoki) wrote :

In IPv6 case, 2::0001 and 2::1 are both valid representation (though 2::1 is a recommended way) and they are identical. IMHO neutron should normalize IPv6 addresses and treat these two as same. That is, even when either of them or other identical addresses are specified, 2::1 should be returned as gateway_ip.

I don't think we should reject an address like 2::0001.

Regarding API backward compat, I am not sure changing 2:0001 to 2::1 is backward incompatible.
I think we have two options: the one is to return normalized IPv6 address, and the other is to return IPv6 address as specified but treat them equally inside neutron. It depends on how we should handle the address format strictly. Personally I am okay to normalize IPv6 address in a response.

In IPv4 case, 1.0.0.001 is rarely used and it is reasonable to consider it as invalid.

Miguel Lavalle (minsel)
tags: added: rfe-approved
removed: rfe
Changed in neutron:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.openstack.org/493280
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=fe389eea25286a067f92a55ea9ad7d73160bbb25
Submitter: Zuul
Branch: master

commit fe389eea25286a067f92a55ea9ad7d73160bbb25
Author: Reedip <email address hidden>
Date: Sat Aug 12 06:25:32 2017 +0000

    Add ipv6 canonical address converter to API

    This patch takes care of converting of IPv6 address
    for gateway-ip, cidr and allocation-pools to canonical
    format.

    Closes-Bug:1531103
    Change-Id: Ibef0bd9a2f7b7dd8ddccc183f17aa31e426c7fd0

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-lib 1.21.0

This issue was fixed in the openstack/neutron-lib 1.21.0 release.

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

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

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

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron-lib/+/918149

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.