#62 - ASN is still empty when databases have values#68
#62 - ASN is still empty when databases have values#68nhi-vanye wants to merge 2 commits intoIronholds:masterfrom
Conversation
This has only been tested with a icommercial MMDB from DB-IP.com
Fixed accessing the extended attributes (i.e. ASN)
|
|
||
| IntegerVector maxmind_bindings::asn(MMDB_s *data, CharacterVector ip_addresses){ | ||
| return mmdb_getint32(data, ip_addresses, "autonomous_system_number", NULL); | ||
| return mmdb_getint32(data, ip_addresses, "traits", "autonomous_system_number", NULL); |
There was a problem hiding this comment.
I don't think these changes would work with the MaxMind GeoIP2 ISP, ASN, or Connection-Type databases. They do not use the nested traits map.
There was a problem hiding this comment.
The original bug was for a "MaxMind Enterprise" database - which was also using the "traits" map.
How would you like issues between different layouts handled? I don't have access to other sources...
I've solved my issue, so I'm okay if its only a partial fix as I'm unlikely to use different database vendors...But making it clean for others would be good...
There was a problem hiding this comment.
There are test databases for the types MaxMind provides.
Yeah, I am not exactly sure what the best fix is given what this code looks like. I guess one option is to check both locations. Another would be to check the database type and do the right thing based on that.
The official MaxMind libraries generally return a structured objects with separate lookup methods for the different database types or as nested maps for the lower-level APIs.
Fixed lookup of "trait" records" (i.e. ASN, ASO, Connection etc)
Also added "user_type" which is the type (i.e. Hosting, Corporate)
This has only been testes with a full commercial binary MMDB database from db-ip.com.