mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check. Automerge-Triggered-By: GH:gpshead
This commit is contained in:
parent
c10392e7dd
commit
83f0f8d62f
3 changed files with 13 additions and 1 deletions
|
@ -2339,6 +2339,12 @@ class IpaddrUnitTest(unittest.TestCase):
|
|||
self.assertEqual(ipaddress.ip_address('::ffff:c0a8:101').ipv4_mapped,
|
||||
ipaddress.ip_address('192.168.1.1'))
|
||||
|
||||
def testIpv4MappedPrivateCheck(self):
|
||||
self.assertEqual(
|
||||
True, ipaddress.ip_address('::ffff:192.168.1.1').is_private)
|
||||
self.assertEqual(
|
||||
False, ipaddress.ip_address('::ffff:172.32.0.0').is_private)
|
||||
|
||||
def testAddrExclude(self):
|
||||
addr1 = ipaddress.ip_network('10.1.1.0/24')
|
||||
addr2 = ipaddress.ip_network('10.1.1.0/26')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue