[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2021-04-12 Thread jana


jana  added the comment:

Running into the same problem here. Within the zonefile rfc1035 defines a 
usecase for ipv4, but I can't find anything similar for IPv6. The feature is 
also rather obscure. The zone however is used in the zonefile as origin and in 
bind in the named.conf to refer to which zone is managed where. 

For this you want to provide the reverse network address, minus the irrelevant 
zeros, so 192.168.0.0/24 => 0.168.192.in-addr.arpa and 2001:db8::/32 => 
8.b.d.0.1.0.0.2.ip6.arpa

This would be to me a fitting and convenient interpretation of the function.

------
nosy: +jana
versions: +Python 3.7 -Python 3.5

___
Python tracker 
<https://bugs.python.org/issue30528>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2021-04-12 Thread jana


jana  added the comment:

This code does the trick:

ipn = ipaddress.ip_network("2a0c:ac10::/32")
prefix = ipn.prefixlen
if ipn.version == 6:
rest = int((ipn.max_prefixlen - prefix) / 4)
elif ipn.version == 4:
rest = int((ipn.max_prefixlen - prefix) / 8)
return ipn.network_address.reverse_pointer.split(".", rest)[-1]

--

___
Python tracker 
<https://bugs.python.org/issue30528>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com