bgpd: add aspath_aggregate_mpath that preserves path length
Issue - when two aspaths are aggregated the result will be with
different length if the two paths do not share common prefix.
E.g.: aggregation of 100 101 400 500 and 200 201 400 500 currently
will result in {100,101,200,201,400,500} which is of much shorter
length and is not ok to be readvertised becase may create shortest
path on the internet and cause infinite flapping.
aspath_aggregate_mpath will construct the followin path for the
above example: {100,200} {101,201} 400 500
Signed-off-by: Boian Bonev <bbonev at ipacct.com>
patchwork #994: http://patchwork.quagga.net/patch/994/
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 8e78aaf..48694c6 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -695,7 +695,7 @@
for (mpinfo = bgp_info_mpath_first (new_best); mpinfo;
mpinfo = bgp_info_mpath_next (mpinfo))
{
- asmerge = aspath_aggregate (aspath, mpinfo->attr->aspath);
+ asmerge = aspath_aggregate_mpath (aspath, mpinfo->attr->aspath);
aspath_free (aspath);
aspath = asmerge;