-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-74713: ipaddress: support reverse pointer generation for network objects #29011
base: main
Are you sure you want to change the base?
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This PR is stale because it has been open for 30 days with no activity. |
Before
After:
Looks like a few zeros missing! |
@MaxwellDupre, I think you may be confusing >>> ipaddress.IPv6Network('2001:db8:1234::/48').reverse_pointer
'4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa'
>>> ipaddress.IPv6Address('2001:db8:1234::').reverse_pointer
'0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa' For example, if you want to create a DNS zone for a /48 network, you want the zone to be defined as If I misunderstood what you meant, please correct me :) |
e7d455f
to
d23771e
Compare
d23771e
to
556bdf7
Compare
556bdf7
to
dd6b08f
Compare
… networks Before this change, DNS reverse pointer generation for network objects produced incorrect results, such as: >>> ipaddress.IPv4Network('192.168.1.0/24').reverse_pointer '0/24.1.168.192.in-addr.arpa' >>> ipaddress.IPv6Network('2001:db8:1234::/48').reverse_pointer '8.4./.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa' This change introduces a more generalised reverse pointer generation algorithm, suitable for both address and network objects. The same code above, after applying this change: >>> ipaddress.IPv4Network('192.168.1.0/24').reverse_pointer '1.168.192.in-addr.arpa' >>> ipaddress.IPv6Network('2001:db8:1234::/48').reverse_pointer '4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa' Getting a reverse pointer for a network, whose prefix size can't be exactly represented in a reverse pointer record, will raise an exception: >>> ipaddress.IPv4Network('192.168.1.0/28').reverse_pointer ipaddress.NetmaskValueError: Reverse pointer cannot be generated for given prefix size >>> ipaddress.IPv6Network('2001:db8:1234::/50').reverse_pointer ipaddress.NetmaskValueError: Reverse pointer cannot be generated for given prefix size
dd6b08f
to
630f24a
Compare
Before this change, DNS reverse pointer generation for network objects produced incorrect results, such as:
This change introduces a more generalised reverse pointer generation algorithm, suitable for both address and network objects.
The same code above, after applying this change:
Getting a reverse pointer for a network, whose prefix size can't be exactly represented in a reverse pointer record, will raise an exception:
My approach is a bit different to other PRs proposed to fix bpo-30528:
https://bugs.python.org/issue30528