Commit 6bd9cd76 authored by Michael Tremer's avatar Michael Tremer

database: Restart flatten algorithm from the top when a network was dropped

We used to simply take the first element from the stack after we have
split a network. That is wrong because it is not passing through any
filters and no further subnet checks. It could have therefore been
that the tree was not entirely flat.
Reported-by: default avatarArne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 92202e5a
......@@ -1380,11 +1380,10 @@ static int __loc_database_enumerator_next_network_flattened(
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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment