-
Notifications
You must be signed in to change notification settings - Fork 0
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
v4 ips in v6 database inserted incorrectly #1
Comments
Ok I figured out a workaround:
This translates v4 ips into compatible v6 ips and all the tooling seems to be happy with it |
Thanks for pointing this out. According to the spec the IPv4 addresses are stored as-is (and then one can also include pointers to handle different prefix mappings). As for the workaround, I guess the most important bit is to use the same approach on both sides (when creating the db and when doing the lookup). |
Yeah I saw the same in the spec. I find the spec hard to parse in this area, especially the bits about them including pointers to different mapped sections. If you don't find this a bug perhaps either: |
geoip2 databases contain both v4 and v6 entries.
If we look at the C implementation https://github.com/maxmind/libmaxminddb/blob/main/src/maxminddb.c#L926-L931
We can see that the bits are transposed to the last 4 octets of a v6 address before lookup.
I believe something similar should be done here.
Currently when I write a v4 ip to a v6 database I see something like the following:
Which is wrong for multiple reasons
I believe the bits should be written like ::2:2:3:4
The text was updated successfully, but these errors were encountered: