[2.5] get_source_address() raises StopIteration if a /128 IPv6 network is passed in

Bug #1789721 reported by Mike Pontillo on 2018-08-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Critical
Mike Pontillo
2.3
High
Mike Pontillo
2.4
Critical
Mike Pontillo

Bug Description

This Python console session shows the issue:

>>> from netaddr import IPNetwork
>>> def f(ipn):
... return next(ipn.iter_hosts())
...
>>> f(IPNetwork('127.0.0.1/8'))
IPAddress('127.0.0.1')
>>> f(IPNetwork('127.0.0.1/32'))
IPAddress('127.0.0.1')
>>> f(IPNetwork('fe80::1/64'))
IPAddress('fe80::1')
>>> f(IPNetwork('fe80::1/128'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
StopIteration

This leads to errors in MAAS such as the following:

https://paste.ubuntu.com/p/D9zKJcb8qK/

Related branches

Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers