Download raw body.
bgpd: fix for aspa_table_equal
In some edge cases the aspa_table_equal function may return true even
though the tables are not the same.
The trivial case is:
aspa-set {
customer-as 1 provider-as { 4 5 6 }
customer-as 2 provider-as { 10 11 }
}
vs.
aspa-set {
customer-as 1 provider-as { 5 6 }
customer-as 2 provider-as { 10 11 4 }
}
Right now the code checks the customer-as list comparing just the AS and
then looking at the flat array of all provider-as numbers. Since in the
above case both are the same (AS 4 moved sets but remains in the same
location in the flat array) the function reports equality even though
the tables are not equal.
Checking the number of provider-as per customer-as is enough to fix this.
OK?
--
:wq Claudio
Index: rde_aspa.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_aspa.c,v
diff -u -p -r1.8 rde_aspa.c
--- rde_aspa.c 30 Aug 2026 23:43:22 -0000 1.8
+++ rde_aspa.c 14 Sep 2026 07:29:02 -0000
@@ -459,9 +459,12 @@ aspa_table_equal(const struct rde_aspa *
if (ra->maxset != rb->maxset ||
ra->maxdata != rb->maxdata)
return 0;
- for (i = 0; i < ra->maxset; i++)
+ for (i = 0; i < ra->maxset; i++) {
if (ra->sets[i].as != rb->sets[i].as)
return 0;
+ if (ra->sets[i].num != rb->sets[i].num)
+ return 0;
+ }
if (memcmp(ra->data, rb->data, ra->maxdata * sizeof(ra->data[0])) != 0)
return 0;
bgpd: fix for aspa_table_equal