]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
libloc: Import latest fixes from upstream
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Dec 2020 17:05:43 +0000 (17:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Dec 2020 17:05:43 +0000 (17:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/patches/libloc-0.9.4-upstream.patch

index a224baec2d0eafaa45c22e10f429f956eee997c8..a6ec1066b4d0532b8167c1e8b36df5066da2d2c7 100644 (file)
@@ -487,7 +487,7 @@ index 2ba93e6..7aac0db 100644
        if (!c)
                return -ENOMEM;
 diff --git a/src/database.c b/src/database.c
-index fa1dad0..7100298 100644
+index fa1dad0..4b8bf1d 100644
 --- a/src/database.c
 +++ b/src/database.c
 @@ -38,8 +38,10 @@
@@ -876,7 +876,7 @@ index fa1dad0..7100298 100644
                        be32toh(n->one), 1, node->depth + 1);
  
                if (r)
-@@ -1175,56 +1261,145 @@ LOC_EXPORT int loc_database_enumerator_next_network(
+@@ -1175,54 +1261,142 @@ LOC_EXPORT int loc_database_enumerator_next_network(
                        if (r)
                                return r;
  
@@ -970,7 +970,7 @@ index fa1dad0..7100298 100644
 -                      return 0;
 +                      loc_network_unref(subnet);
 +                      continue;
-               }
++              }
 +
 +              // If this is not a subnet, we push it back onto the stack and break
 +              r = loc_network_list_push(enumerator->stack, subnet);
@@ -979,7 +979,7 @@ index fa1dad0..7100298 100644
 +                      loc_network_list_unref(subnets);
 +
 +                      return r;
-+              }
+               }
 +
 +              loc_network_unref(subnet);
 +              break;
@@ -987,17 +987,18 @@ index fa1dad0..7100298 100644
  
 -      // Reached the end of the search
 +      DEBUG(enumerator->ctx, "Found %zu subnet(s)\n", loc_network_list_size(subnets));
-+
+-      // Mark all nodes as non-visited
+-      for (unsigned int i = 0; i < enumerator->db->network_nodes_count; i++)
+-              enumerator->networks_visited[i] = 0;
 +      // We can abort here if the network has no subnets
 +      if (loc_network_list_empty(subnets)) {
 +              loc_network_list_unref(subnets);
-+
+-      return 0;
 +              return 0;
 +      }
--      // Mark all nodes as non-visited
--      for (unsigned int i = 0; i < enumerator->db->network_nodes_count; i++)
--              enumerator->networks_visited[i] = 0;
++
 +      // If the network has any subnets, we will break it into smaller parts
 +      // without the subnets.
 +      struct loc_network_list* excluded = loc_network_exclude_list(*network, subnets);
@@ -1027,13 +1028,12 @@ index fa1dad0..7100298 100644
 +      loc_network_list_unref(subnets);
 +      loc_network_list_unref(excluded);
 +
-+      // Replace network with the first one from the stack
++      // Drop the network and restart the whole process again to pick the next network
 +      loc_network_unref(*network);
-+      *network = loc_network_list_pop_first(enumerator->stack);
-       return 0;
- }
++
++      return __loc_database_enumerator_next_network_flattened(enumerator, network);
++}
++
 +LOC_EXPORT int loc_database_enumerator_next_network(
 +              struct loc_database_enumerator* enumerator, struct loc_network** network) {
 +      // Do not do anything if not in network mode
@@ -1045,11 +1045,9 @@ index fa1dad0..7100298 100644
 +              return __loc_database_enumerator_next_network_flattened(enumerator, network);
 +
 +      return __loc_database_enumerator_next_network(enumerator, network, 1);
-+}
-+
+ }
  LOC_EXPORT int loc_database_enumerator_next_country(
-               struct loc_database_enumerator* enumerator, struct loc_country** country) {
-       *country = NULL;
 diff --git a/src/libloc.sym b/src/libloc.sym
 index b8296eb..ee333f1 100644
 --- a/src/libloc.sym