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_aspath.h b/bgpd/bgp_aspath.h
index 1311f8a..2f0a519 100644
--- a/bgpd/bgp_aspath.h
+++ b/bgpd/bgp_aspath.h
@@ -69,6 +69,7 @@
extern struct aspath *aspath_parse (struct stream *, size_t, int);
extern struct aspath *aspath_dup (struct aspath *);
extern struct aspath *aspath_aggregate (struct aspath *, struct aspath *);
+extern struct aspath *aspath_aggregate_mpath (struct aspath *, struct aspath *);
extern struct aspath *aspath_prepend (struct aspath *, struct aspath *);
extern struct aspath *aspath_filter_exclude (struct aspath *, struct aspath *);
extern struct aspath *aspath_add_seq_n (struct aspath *, as_t, unsigned);