From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer <michael.tremer@ipfire.org> To: location@lists.ipfire.org Subject: Re: Problem with 'loc_as_get_name()' Date: Fri, 23 Oct 2020 18:27:43 +0100 Message-ID: <A10A8B0E-A291-416A-8E24-D70AF98DE9E4@ipfire.org> In-Reply-To: <9fdd2b0e-056e-1e5a-ce2c-e03c26cc37d9@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5443419094707683356==" List-Id: <location.lists.ipfire.org> --===============5443419094707683356== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, > On 23 Oct 2020, at 17:29, Gisle Vanem <gisle.vanem(a)gmail.com> wrote: >=20 > Michael Tremer wrote: >=20 >> In your code, you are creating a new AS which is not what you want. >=20 > I figured that after I sent my previous message. >=20 >> struct loc_network* network =3D loc_database_lookup_from_string(db, "81.3.= 27.38"); >=20 > I use 'loc_database_lookup()' directly since I do not want to > waste CPU-cycles on 'inet_pton()'. Works fine for me, except > I must always map an IPv4 to a IPv6-mapped address first. >=20 > In my code (and 'location lookup'), e.g. a '37.142.14.15' never works. > But this works '::ffff:37.142.14.15' always: > Network : 37.142.0.0/20 > Country : Israel > Autonomous System : AS12849 - Hot-Net internet services Ltd. We could add a call where you can pass struct in_addr and it automatically co= nverts it. We usually use the IP address as a string input in our own applications so th= at this was never necessary. >> // Copy the name to somewhere >=20 > I found the AS-name can be quite long: > AS49450 - Federal State Budget Institution NATIONAL MEDICAL RESEARCH CENTER= FOR > OBSTETRICS, GYNECOLOGY AND PERINATOLOGY named after academician > V. I. Kulakov of the Ministry of Healthcare of the Russian Federa= tion, >=20 > Longest I found, a whopping 214 characters. > I suppose 'libloc' handle any length? Yes, we do not have any limits on this. It might be good idea to introduce th= at though. That name is beyond reasonable. > Besides, how can I (if possible with libloc/location.py) > figure out all the Peers for an AS? Like what: > https://dnslytics.com/bgp/as39029 (Redpill Linpro AS) >=20 > reports for "IP Prefixes and Peers". For IPv6: > 8473 Bahnhof AB > 2119 Telenor AS > 56655 TerraHost AS > ... You can use location list-networks-by-as. The code for that should tell you h= ow to part that to your own application. Look for the database iterator. > If I do: > location list-networks-by-as --family ipv6 39029 > 2001:67c:21e0::/48 << ! > ... > and: > location list-networks-by-as --family ipv6 8473 > 2001:67c:107c::/48 > 2001:67c:2fb8::/48 << ! this looks close to 2001:67c:21e0:: > ... Yes that might be. Subnets are being allocated like that without any gaps. > Is the relation with an AS and a peer only a routing (BGP) > thing? Where each of the AS'es have a common routing path? I am not sure what you are asking here. A peer can be in a subnet. That subnet might have an ASN (probably will if it= is currently being routed or was recently routed). If one network is only single-homed to another one is outside the scope of th= is library. > I'm just beginning to understand all these concepts. > So sorry for nagging.. Happy to help. Just try to help me helping you by explaining what your goal i= s and I can help you finding the best way to that. It would be great if we could work on upstreaming your changes for Windows so= that they become available for everyone and you no longer need to bundle you= r own version of libloc without receiving bugfixes from upstream. Best. -Michael >=20 > --=20 > --gv --===============5443419094707683356==--