]> git.ipfire.org Git - people/ms/libloc.git/commit
database: Fix backtracking after no match was found at the end of the tree
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 13:40:12 +0000 (13:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 13:48:34 +0000 (13:48 +0000)
commit95d271bb90b4cebe81c288a95a2336aa63bac4d7
treed765889e358c577e6046ad23c991c594e02e3f63
parentd1120513a30de43308d9ed848f7ef3c6ede6d767
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>
src/database.c