IPv4-in-IPv6 root node is wrong
g-andrade opened this issue · 3 comments
The definition in question:
Lines 48 to 49 in 8d0019d
Following tentative PR #39 a few months ago and, more recently, evidence of this in #43 .
As per the spec, the root node seems to be ::/96
rather than ::ffff:0:0/96
(which is for IPv4-mapped IPv6 addresses) and I had read it wrong all this time:
https://maxmind.github.io/MaxMind-DB/#ipv4-addresses-in-an-ipv6-tree
Official Python implementation mentioned by @nickjacob in #39, which further suggests this in the way it walks over the IPv6 tree to get the IPv4 root node:
https://github.com/maxmind/MaxMind-DB-Reader-python/blob/b59335627a27b96c6e5a3178632ed0ab77d53cfb/maxminddb/reader.py#L118-L127
This being true, the existing behavior worked purely out of chance: all the databases I had tested so far happened to account for IPv4-mapped IPv6 addresses, and therefore I didn't run into the bug for 6+ years.
Released in 2.3.8, pushed to Hex
If there is a clarification to the specification that can be made, we would be happy to include that. The root node for IPv4 is at ::/96
with the other mapped locations being (optional) pointers to that. All the MaxMind databases are build with these pointers, but third-party databases may have disabled them.