diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-10-24 17:47:45 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-10-24 17:50:19 +0200 |
commit | ec331acf48535211fb5b50c87e74bf1c8370283a (patch) | |
tree | d6c774f48c4ba2e842a784b2b698e8d087b6d2f5 | |
parent | 5ce881be82d6698c32e36add9ed6e1643150c3f3 (diff) |
BGP: Fix handling of transitive extended communities
Transitive extended communities should be removed on external sessions,
the old code them in all cases.
Thanks to Jean-Daniel Pauget for the original patch.
-rw-r--r-- | proto/bgp/attrs.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index b8921363..9a4e12d2 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -717,13 +717,23 @@ 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) { - struct adata *ad = ec_set_del_nontrans(s->pool, a->u.ptr); + if (!s->proto->is_interior) + { + struct adata *ad = ec_set_del_nontrans(s->pool, a->u.ptr); - if (ad->length == 0) - UNSET(a); + if (ad->length == 0) + UNSET(a); - ec_set_sort_x(ad); - a->u.ptr = ad; + ec_set_sort_x(ad); + a->u.ptr = ad; + } + else + { + if (a->u.ptr->length == 0) + UNSET(a); + + a->u.ptr = ec_set_sort(s->pool, a->u.ptr); + } } static void |