Commit ec331acf authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

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.
parent 5ce881be
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -716,6 +716,8 @@ 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)
{
  if (!s->proto->is_interior)
  {
    struct adata *ad = ec_set_del_nontrans(s->pool, a->u.ptr);

@@ -725,6 +727,14 @@ bgp_export_ext_community(struct bgp_export_state *s, eattr *a)
    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
bgp_decode_ext_community(struct bgp_parse_state *s, uint code UNUSED, uint flags, byte *data, uint len, ea_list **to)