mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Basic route aggregation
Add a new protocol offering route aggregation. User can specify list of route attributes in the configuration file and run route aggregation on the export side of the pipe protocol. Routes are sorted and for every group of equivalent routes new route is created and exported to the routing table. It is also possible to specify filter which will run for every route before aggregation. Furthermore, it will be possible to set attributes of new routes according to attributes of the aggregated routes. This is a work in progress. Original work by Igor Putovny, subsequent cleanups and finalization by Maria Matejka. This is a split-commit of the neighboring aggregator branch with a bit improved lvalue handling, to have easier merge into v3.
This commit is contained in:
committed by
Maria Matejka
parent
ba91f4c831
commit
f42c118aa7
@@ -669,6 +669,29 @@ as_path_filter(struct linpool *pool, const struct adata *path, const struct f_va
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
as_path_compare(const struct adata *path1, const struct adata *path2)
|
||||
{
|
||||
uint pos1 = 0;
|
||||
uint pos2 = 0;
|
||||
uint val1 = 0;
|
||||
uint val2 = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int res1 = as_path_walk(path1, &pos1, &val1);
|
||||
int res2 = as_path_walk(path2, &pos2, &val2);
|
||||
|
||||
if (res1 == 0 && res2 == 0)
|
||||
return 0;
|
||||
|
||||
if (val1 == val2)
|
||||
continue;
|
||||
|
||||
return val1 < val2 ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
as_path_walk(const struct adata *path, uint *pos, uint *val)
|
||||
{
|
||||
|
Reference in New Issue
Block a user