public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info
@ 2025-06-27 19:53 Adolf Belka
  2025-06-27 19:53 ` [PATCH 2/2] core196: Ship libloc Adolf Belka
  2025-06-29 16:12 ` [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Michael Tremer
  0 siblings, 2 replies; 3+ messages in thread
From: Adolf Belka @ 2025-06-27 19:53 UTC (permalink / raw)
  To: development; +Cc: Adolf Belka, Michael Tremer

- Patch added to fix bactracking after no match found bug. When the next version of
   libloc is released then this patch can be removed as the patch will be integrated in
   with that version.
- Update of rootfile not required.
- Tested out on local build of libloc-0.9.18

Fixes: bug13861
Reported-by: Adolf Belka <adolf.belka@ipfire.org>
Suggested-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 lfs/libloc                                    |  1 +
 ...tch_was_found_at_the_end_of_the_tree.patch | 31 +++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch

diff --git a/lfs/libloc b/lfs/libloc
index f2f0aa8a9..e9bbe16ba 100644
--- a/lfs/libloc
+++ b/lfs/libloc
@@ -82,6 +82,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	# https://lists.ipfire.org/pipermail/development/2022-November/014763.html
 	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18-Revert-Install-Perl-files-to-Perl-vendor-directory.patch
 	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18_gettext-0.25_fix.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
 	cd $(DIR_APP) && ./autogen.sh
 	cd $(DIR_APP) && ./configure \
 		--prefix=/usr \
diff --git a/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch b/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
new file mode 100644
index 000000000..6ac9acf3c
--- /dev/null
+++ b/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
@@ -0,0 +1,31 @@
+X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=blobdiff_plain;f=src%2Fdatabase.c;h=c251061cc8a254879491ebe133b1b4f3b58ddf30;hp=0c8608542aaad6e82c4d8602bbeb388ab43225bb;hb=95d271bb90b4cebe81c288a95a2336aa63bac4d7;hpb=d1120513a30de43308d9ed848f7ef3c6ede6d767
+
+diff --git a/src/database.c b/src/database.c
+index 0c86085..c251061 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -907,13 +907,7 @@ static int __loc_database_lookup(struct loc_database* db, const struct in6_addr*
+ 
+ 		// Move on to the next node
+ 		r = __loc_database_lookup(db, address, network, network_address, node_index, level + 1);
+-
+-		// End here if a result was found
+-		if (r == 0)
+-			return r;
+-
+-		// Raise any errors
+-		else if (r < 0)
++		if (r < 0)
+ 			return r;
+ 
+ 		DEBUG(db->ctx, "No match found below level %u\n", level);
+@@ -922,7 +916,7 @@ static int __loc_database_lookup(struct loc_database* db, const struct in6_addr*
+ 	}
+ 
+ 	// If this node has a leaf, we will check if it matches
+-	if (__loc_database_node_is_leaf(node_v1)) {
++	if (!*network && __loc_database_node_is_leaf(node_v1)) {
+ 		r = __loc_database_lookup_handle_leaf(db, address, network, network_address, level, node_v1);
+ 		if (r < 0)
+ 			return r;
+
-- 
2.50.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] core196: Ship libloc
  2025-06-27 19:53 [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Adolf Belka
@ 2025-06-27 19:53 ` Adolf Belka
  2025-06-29 16:12 ` [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Michael Tremer
  1 sibling, 0 replies; 3+ messages in thread
From: Adolf Belka @ 2025-06-27 19:53 UTC (permalink / raw)
  To: development; +Cc: Adolf Belka

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/rootfiles/core/196/filelists/libloc | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 config/rootfiles/core/196/filelists/libloc

diff --git a/config/rootfiles/core/196/filelists/libloc b/config/rootfiles/core/196/filelists/libloc
new file mode 120000
index 000000000..ff4a92429
--- /dev/null
+++ b/config/rootfiles/core/196/filelists/libloc
@@ -0,0 +1 @@
+../../../common/libloc
\ No newline at end of file
-- 
2.50.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info
  2025-06-27 19:53 [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Adolf Belka
  2025-06-27 19:53 ` [PATCH 2/2] core196: Ship libloc Adolf Belka
@ 2025-06-29 16:12 ` Michael Tremer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2025-06-29 16:12 UTC (permalink / raw)
  To: Adolf Belka; +Cc: development

Thank you for submitting this.

This was a very interesting find.

> On 27 Jun 2025, at 20:53, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> - Patch added to fix bactracking after no match found bug. When the next version of
>   libloc is released then this patch can be removed as the patch will be integrated in
>   with that version.
> - Update of rootfile not required.
> - Tested out on local build of libloc-0.9.18
> 
> Fixes: bug13861
> Reported-by: Adolf Belka <adolf.belka@ipfire.org>
> Suggested-by: Michael Tremer <michael.tremer@ipfire.org>
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
> lfs/libloc                                    |  1 +
> ...tch_was_found_at_the_end_of_the_tree.patch | 31 +++++++++++++++++++
> 2 files changed, 32 insertions(+)
> create mode 100644 src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
> 
> diff --git a/lfs/libloc b/lfs/libloc
> index f2f0aa8a9..e9bbe16ba 100644
> --- a/lfs/libloc
> +++ b/lfs/libloc
> @@ -82,6 +82,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> # https://lists.ipfire.org/pipermail/development/2022-November/014763.html
> cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18-Revert-Install-Perl-files-to-Perl-vendor-directory.patch
> cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18_gettext-0.25_fix.patch
> + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
> cd $(DIR_APP) && ./autogen.sh
> cd $(DIR_APP) && ./configure \
> --prefix=/usr \
> diff --git a/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch b/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
> new file mode 100644
> index 000000000..6ac9acf3c
> --- /dev/null
> +++ b/src/patches/libloc-0.9.18_Fix_backtracking_after_no_match_was_found_at_the_end_of_the_tree.patch
> @@ -0,0 +1,31 @@
> +X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=blobdiff_plain;f=src%2Fdatabase.c;h=c251061cc8a254879491ebe133b1b4f3b58ddf30;hp=0c8608542aaad6e82c4d8602bbeb388ab43225bb;hb=95d271bb90b4cebe81c288a95a2336aa63bac4d7;hpb=d1120513a30de43308d9ed848f7ef3c6ede6d767
> +
> +diff --git a/src/database.c b/src/database.c
> +index 0c86085..c251061 100644
> +--- a/src/database.c
> ++++ b/src/database.c
> +@@ -907,13 +907,7 @@ static int __loc_database_lookup(struct loc_database* db, const struct in6_addr*
> + 
> + // Move on to the next node
> + r = __loc_database_lookup(db, address, network, network_address, node_index, level + 1);
> +-
> +- // End here if a result was found
> +- if (r == 0)
> +- return r;
> +-
> +- // Raise any errors
> +- else if (r < 0)
> ++ if (r < 0)
> + return r;
> + 
> + DEBUG(db->ctx, "No match found below level %u\n", level);
> +@@ -922,7 +916,7 @@ static int __loc_database_lookup(struct loc_database* db, const struct in6_addr*
> + }
> + 
> + // If this node has a leaf, we will check if it matches
> +- if (__loc_database_node_is_leaf(node_v1)) {
> ++ if (!*network && __loc_database_node_is_leaf(node_v1)) {
> + r = __loc_database_lookup_handle_leaf(db, address, network, network_address, level, node_v1);
> + if (r < 0)
> + return r;
> +
> -- 
> 2.50.0
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-29 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-27 19:53 [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Adolf Belka
2025-06-27 19:53 ` [PATCH 2/2] core196: Ship libloc Adolf Belka
2025-06-29 16:12 ` [PATCH 1/2] libloc: Fixes bug13861 - libloc-0.9.18 fails to find some ASN info Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox