What is your application you are planning to use this in?
Wsock-trace; a Winsock-trace library like I wrote.
And probably more importantly, why does the database that we provide not work for you?
That's one of the things I'm trying to figure out.
LOC_EXPORT int loc_as_set_name(struct loc_as* as, const char* name) {
as->name = strdup(name);
as->name = name ? strdup(name) : strdup(""); return 0;
}
Good catch, but there is more to it. When resetting the name, the original
value wasn’t freed. I added that and pushed it to the main repository:
With that patch, test-as crashes. I did this: --- a/src/as.c 2020-10-20 23:23:34 +++ b/src/as.c 2020-10-20 23:55:51 @@ -142,7 +142,7 @@
int loc_as_match_string(struct loc_as* as, const char* string) { // Match all AS when no search string is set - if (!string) + if (!string || !as->name) return 1;
which no longer crashes. But when building in CRT debug-mode, I note many mem-leaks in e.g. 'test-as.c' and 'test-country.c'.
Some of it is due to the error I get: Could not find country: YY
and you do 'exit(EXIT_FAILURE);' w/o cleaning up. Such a behaviour could probably accumulate leaks over time. But I do not know IPFire.
But I plugged other leaks using: --- a/src/writer.c 2020-10-19 17:35:01 +++ b/src/writer.c 2020-10-20 23:15:20 @@ -155,6 +155,12 @@ if (writer->networks) loc_network_tree_unref(writer->networks);
+ if (writer->as) + free(writer->as); + + if (writer->countries) + free(writer->countries); + // Unref the string pool loc_stringpool_unref(writer->pool);
Never done AFAICS. The leak for 'as.c', I'm not sure how to plug. You ought to check with valgrind etc.
You won’t need it to make the database. You should simply download the binary version of the library and that will be it.
Where? Nothing under https://location.ipfire.org/databases/1/ But a 'adig -t txt _v1._db.location.ipfire.org' says: TXT Fri, 16 Oct 2020 07:54:08 GMT
I fail to find it. But that's another issue.
I am still not sure what you are trying to achieve here. If you are looking for the data, simply run “location update” and the script should download the database, extract it, verify it and you can use it.
Here: py -3 location.py update https://location.ipfire.org/databases/ reported: HTTP Error 404: Not Found Could not download a new database
And have you ever used OpenSSL on Windows? Here: py -3 location.py verify OPENSSL_Uplink(640BC6B0,08): no OPENSSL_Applink
It's pure hell.