diff options
author | Pete Wicken <2273100+JamoBox@users.noreply.github.com> | 2021-05-17 07:52:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 07:52:36 (GMT) |
commit | 83f0f8d62f279f846a92fede2244beaa0149b9d8 (patch) | |
tree | 3651a35943d97d9cc50cc8efe387c50cf76ad5f6 /Lib/test | |
parent | c10392e7ddb3eafbd11e9ffe335c07648426715f (diff) | |
download | cpython-83f0f8d62f279f846a92fede2244beaa0149b9d8.zip cpython-83f0f8d62f279f846a92fede2244beaa0149b9d8.tar.gz cpython-83f0f8d62f279f846a92fede2244beaa0149b9d8.tar.bz2 |
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
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ipaddress.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 90559ce..ff77bdb 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -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') |