Issue with AAAA records formatting

Bug #1919495 reported by Charles Decoux
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Triaged
Medium
Unassigned

Bug Description

Code used to format IPv6 address for AAAA records in `base.py`[1] in following cases:
* Address contains `::`;
* One to four of the first nibbles in a group of four: `2001:db8:2::1`.
The test[2] relating to this part of the code is also incorrect: representing the IP `1762:B03::1:AF18` would result in the same `octet0` to `octet3` while the address is different.
A more canonical approach of the representation would be as follows:
```python
expect = {'octet0': '1762', 'octet1': '0000', 'octet2': '0000', 'octet3': '0000'
          'octet4': '0000', 'octet5': '0B03', 'octet6': '0001'
          'octet7': 'AF18', 'ip_version': 6,
          'ip_address': '1762--B03-1-AF18'}
```

References:
1. https://github.com/openstack/designate/blob/stable/victoria/designate/notification_handler/base.py#L119
2. https://github.com/openstack/designate/blob/stable/victoria/designate/tests/test_notification_handler/test_base.py#L38

Revision history for this message
Michael Johnson (johnsom) wrote :

Frankly Designate should not be using regex to parse these addresses at all.

It should use python ipaddress module and normalize the address (explode for example) and use __format__ on the IPv6Address object to manipulate it for other required representations.

Changed in designate:
status: New → Triaged
importance: Undecided → Medium
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.