[netaddr>=1.0.0] Do not use netaddr.core.ZEROFILL flag with IPv6 addresses

Bug #2055173 reported by Rodolfo Alonso
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Rodolfo Alonso

Bug Description

In case of using this flag, that will raise the following exception:
>>> netaddr.IPAddress("200a::1", flags=netaddr.core.ZEROFILL)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/netaddr/ip/__init__.py", line 333, in __init__
    self._value = module.str_to_int(addr, flags)
  File "/usr/local/lib/python3.10/dist-packages/netaddr/strategy/ipv4.py", line 120, in str_to_int
    addr = '.'.join(['%d' % int(i) for i in addr.split('.')])
  File "/usr/local/lib/python3.10/dist-packages/netaddr/strategy/ipv4.py", line 120, in <listcomp>
    addr = '.'.join(['%d' % int(i) for i in addr.split('.')])
ValueError: invalid literal for int() with base 10: '200a::1'

Changed in neutron:
importance: Undecided → Medium
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.opendev.org/c/openstack/neutron-lib/+/910331
Committed: https://opendev.org/openstack/neutron-lib/commit/3a9e39b9ef4d73cc60b534411bc5255e7d280bef
Submitter: "Zuul (22348)"
Branch: master

commit 3a9e39b9ef4d73cc60b534411bc5255e7d280bef
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Fri Feb 23 14:23:58 2024 +0000

    [netaddr>=1.0.0] Do not use netaddr.core.ZEROFILL flag with IPv6

    The flag "netaddr.core.ZEROFILL" cannot be used with IPv6 addresses
    with netaddr>=1.0.0

    Change-Id: I116ea2abbee13a73302ebca9c65707f427a7d9d0
    Closes-Bug: #2055173

Changed in neutron:
status: In Progress → Fix Released
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.