public inbox for location@lists.ipfire.org
 help / color / mirror / Atom feed
From: Gisle Vanem <gisle.vanem@gmail.com>
To: location@lists.ipfire.org
Subject: Re: What generates database.db from database.txt?
Date: Wed, 21 Oct 2020 00:46:10 +0200	[thread overview]
Message-ID: <6ec26d86-805d-dde9-dfbf-db2fbd1c29f5@gmail.com> (raw)
In-Reply-To: <C6922087-3C22-42E7-B2DE-8ACB32892C7A@ipfire.org>

[-- Attachment #1: Type: text/plain, Size: 2750 bytes --]

> 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.

-- 
--gv

  reply	other threads:[~2020-10-20 22:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 15:53 Gisle Vanem
2020-10-20 16:08 ` Michael Tremer
2020-10-20 19:14   ` Gisle Vanem
2020-10-20 20:49     ` Michael Tremer
2020-10-20 22:46       ` Gisle Vanem [this message]
2020-10-21  9:34         ` Michael Tremer
2020-10-21 11:07           ` Gisle Vanem
2020-10-21 13:15             ` Michael Tremer
     [not found] <b63ffe0e-6eca-7168-bb13-07281eff208f@gmail.com>
2020-10-22 10:17 ` Michael Tremer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ec26d86-805d-dde9-dfbf-db2fbd1c29f5@gmail.com \
    --to=gisle.vanem@gmail.com \
    --cc=location@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox