Hi,
On 23 Oct 2020, at 17:29, Gisle Vanem gisle.vanem@gmail.com wrote:
Michael Tremer wrote:
In your code, you are creating a new AS which is not what you want.
I figured that after I sent my previous message.
struct loc_network* network = loc_database_lookup_from_string(db, "81.3.27.38");
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.
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 converts it.
We usually use the IP address as a string input in our own applications so that this was never necessary.
// Copy the name to somewhere
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 Federation,
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 that 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)
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 how 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 this 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 is 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 your own version of libloc without receiving bugfixes from upstream.
Best. -Michael
-- --gv