On Tue, Dec 12, 2017 at 06:47:44PM +0100, Pier Carlo Chiodi wrote: > Hello, > > while I was running some tests on BIRD 2.0.0 I've noticed that the > handling of RFC8097 extended communities is different from 1.6.3. > > - when 1.6.3 is used on the route server, BIRD treats the community > strictly according to RFC4360: > > If a route has a non-transitivity extended community, then before > advertising the route across the Autonomous System boundary the > community SHOULD be removed from the route. > > - when 2.0.0 is used, the community is treated accordingly to > draft-ietf-sidrops-route-server-rpki-light-02 and is propagated to the > client.
Hi Here is a patch that should fix it. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: [email protected]) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
commit d807ea087f8d60e25eaef8c10168a40ca6545c57 Author: Ondrej Zajicek (work) <[email protected]> Date: Wed Dec 13 15:57:44 2017 +0100 BGP: Fix non-transitive ext communities diff --git a/nest/a-set.c b/nest/a-set.c index a2fb6953..048e522d 100644 --- a/nest/a-set.c +++ b/nest/a-set.c @@ -536,6 +536,13 @@ ec_set_sort(struct linpool *pool, struct adata *src) return dst; } +void +ec_set_sort_x(struct adata *set) +{ + /* Sort in place */ + qsort(set->data, set->length / 8, 8, ec_set_cmp); +} + static int lc_set_cmp(const void *X, const void *Y) diff --git a/nest/attrs.h b/nest/attrs.h index f66d4f04..102f378a 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -197,4 +197,6 @@ struct adata *int_set_sort(struct linpool *pool, struct adata *src); struct adata *ec_set_sort(struct linpool *pool, struct adata *src); struct adata *lc_set_sort(struct linpool *pool, struct adata *src); +void ec_set_sort_x(struct adata *set); /* Sort in place */ + #endif diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index dea3c4a6..fdc981ca 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -550,10 +550,12 @@ bgp_decode_mp_unreach_nlri(struct bgp_parse_state *s, uint code UNUSED, uint fla static void bgp_export_ext_community(struct bgp_export_state *s, eattr *a) { + a->u.ptr = ec_set_del_nontrans(s->pool, a->u.ptr); + if (a->u.ptr->length == 0) UNSET(a); - a->u.ptr = ec_set_sort(s->pool, a->u.ptr); + ec_set_sort_x(a->u.ptr); } static void
