Bug 13861 - libloc-0.9.18 fails to find some ASN info
Summary: libloc-0.9.18 fails to find some ASN info
Status: VERIFIED
Alias: None
Product: IPFire
Classification: Unclassified
Component: --- (show other bugs)
Version: 2
Hardware: unspecified Unspecified
: - Unknown - - Unknown -
Assignee: Michael Tremer
QA Contact: Adolf Belka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-27 12:31 UTC by Adolf Belka
Modified: 2025-07-01 10:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adolf Belka 2025-06-27 12:31:38 UTC
With libloc-0.9.17 running the command

location lookup 104.18.203.90

gives

104.18.203.90:
  Network                 : 104.16.0.0/12
  Country                 : United States of America
  Autonomous System       : AS13335 - Cloudflare, Inc.
  Anycast                 : yes


with libloc-0.9.18 you get

Nothing found for 104.18.203.90



The IP is for www.clamav.net The same happens with their second IP and also with the IP for archlinux.org

These are the two websites that I happened to find having the problem. Majority I have tried work fine but there could be more depending on what causes the issue to occur in libloc-0.9.18

This was also confirmed on a local build of libloc-0.9.18 which gave the same result.

As libloc-0.9.18 was not shipped when it was merged then any user doing upgrades from a system that was installed earlier than CU193 will still be running with libloc-0.9.17

Any user doing a fresh install with CU193 or later will have libloc-0.9.18 installed.
Comment 1 Michael Tremer 2025-06-27 12:36:09 UTC
Which version of the database have you been testing this against?
Comment 2 Adolf Belka 2025-06-27 12:41:57 UTC
The good and bad result that I mention in the description were both done with the same database version which was

-bash-5.2$ location version
Fri, 27 Jun 2025 04:42:16 GMT
Comment 3 Adolf Belka 2025-06-27 12:43:44 UTC
In my earlier faultfinding I also tested out various older databases back to 2025-01-01 and got the same result.
Comment 4 Michael Tremer 2025-06-27 13:48:56 UTC
http://git.ipfire.org/?p=people/ms/libloc.git;a=commit;h=95d271bb90b4cebe81c288a95a2336aa63bac4d7

Author: Michael Tremer <michael.tremer@ipfire.org>

database: Fix backtracking after no match was found at the end of the tree

This is a rare bug which only appears if the tree has not been 100%
optimised which might happen because it would not be worth the effort to
remove all dead ends all of the time.

Therefore, we could be reaching a node which is not an actual leaf but
still not find our network. In that case, we will have to go backwards
slightly to check if there has been a less specific match (but a match
nonetheless).

This was broken in commit 9e72b8a0c56403ca7d23c6a767d66038e0d63c14 when
the return code for no match was changed to zero.

Fixes: #13861 - libloc-0.9.18 fails to find some ASN info
Reported-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Comment 5 Michael Tremer 2025-06-27 13:50:36 UTC
Hello Adolf,

thank you for posting such an interesting problem. It has indeed been a problem in the lookup algorithm which terminated too early and did not perform any backtracking.

This patch should fix the problem:

> https://git.ipfire.org/?p=location/libloc.git;a=commitdiff;h=95d271bb90b4cebe81c288a95a2336aa63bac4d7

Please let me know if this fixes the problem for you, too.
Comment 6 Adolf Belka 2025-06-27 14:29:12 UTC
I did the local build of libloc on my desktop machine again but this time with your patch also applied.

Can confirm that after this both the Clamav IP's and the Archlinux one all get asn responses back.
Comment 7 Adolf Belka 2025-06-27 20:35:03 UTC
The fix patch has been sent to the dev mailing list to apply to the existing version of libloc so a new version does not have to be created.

https://lists.ipfire.org/development/20250627195351.3341456-1-adolf.belka@ipfire.org/T/#t

https://patchwork.ipfire.org/project/ipfire/list/?series=5007
Comment 9 Adolf Belka 2025-07-01 10:24:48 UTC
Have tested out running location lookup with the two IP's from www.clamav.net and with the IP from archlinux.org

In all cases location lookup gives the expected feedback.

This verifies that the fix is in CU196 Testing.