]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Fix non-transitive ext communities
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 13 Dec 2017 14:57:44 +0000 (15:57 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 13 Dec 2017 14:57:44 +0000 (15:57 +0100)
nest/a-set.c
nest/attrs.h
proto/bgp/attrs.c

index a2fb695313f32f8a25305e80e2a3c3708846f037..048e522db746c6be8a74c83a8dd175d5ae723387 100644 (file)
@@ -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)
index f66d4f04dbb9d25b4a9aeac4db8230b532a742f9..102f378a9a9ca65c161f939212ab04fbcb05c9ac 100644 (file)
@@ -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
index dea3c4a6b4d4e3663428388e2c985b6a591db0ce..fdc981ca9e38d8a569a9b77c475d3561b7a06eee 100644 (file)
@@ -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