Handling AGGREGATOR in v2.0.7

Nasato Goto goto at mfeed.ad.jp
Tue Apr 14 16:45:29 CEST 2020


Hi all,

I found a bit strange behavior of handling AGGREGATOR attributes in BIRD v2.0.7 route server.
When BIRD receives a route containing AGGREGATOR attribute from 4byte-AS capable peer,
it sends the route with strange AGGREGATOR to 4byte-AS incapable peer.
On the other hand, BIRD can sends AS4_AGGREGATOR attribute correctly.

Here is a scenario what I did.
In the following simple topology, Peer1 and BIRD RS are 4byte-AS capable and Peer2 is 2byte-AS support only.

Peer1 --(r1)--> BIRD RS --(r1’)--> Peer2

Peer1 advertise a route r1 which contains AGGREGATOR attribute. (omitting ATOMIC_AGGREGATE here)
------
r1:
AGGREGATOR:
- Aggregator AS: 650001 (in 4byte)
- Aggregator Origin: x.x.x.x
------

Then, the expected route r1’ advertised from RS to Peer2 should be like:
------
r1’:
AGGREGATOR:
- Aggregator AS: 23456 (AS_TRANS, in 2byte)
- Aggregator Origin: x.x.x.x
AS4_AGGREGATOR:
- Aggregator AS: 650001 (in 4byte)
- Aggregator Origin: x.x.x.x
------

But as far as I see, BIRD sends the route including AGGREGATOR like:
------
r1’:
AGGREGATOR:
- Aggregator AS: 0 (in 2byte)    #here
- Aggregator Origin: y.y.y.y    #and here, not match to original origin x.x.x.x
AS4_AGGREGATOR:
- Aggregator AS: 650001 (in 4byte)
- Aggregator Origin: x.x.x.x
------

This may not confirm to the section 4.2.2 in https://tools.ietf.org/html/rfc6793.
And also, when the AS number in original AGGREGATOR is a “mappable” 4byte-AS number, I see that the AS number in AGGREGATOR advertised from BIRD is set as 65535 (0xFFFF).

Then I tried a small patch, this fixed my problem.
But I’m not sure if it’s appropriate.

------------------------------------------
diff --git a/nest/attrs.h b/nest/attrs.h
index 6fb0a8fa..e0399708 100644
--- a/nest/attrs.h
+++ b/nest/attrs.h
@@ -111,7 +111,7 @@ static inline struct adata *
aggregator_to_old(struct linpool *pool, const struct adata *a)
{
   struct adata *d = lp_alloc_adata(pool, 8);
-  put_u32(d->data, 0xFFFF);
+  put_u32(d->data, AS_TRANS);
   memcpy(d->data + 4, a->data + 4, 4);
   return d;
}
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index b8921363..f2a4d5b2 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -562,6 +562,7 @@ bgp_encode_aggregator(struct bgp_write_state *s, eattr *a, byte *buf, uint size)
     /* Prepare 16-bit AGGREGATOR (from 32-bit one) in a temporary buffer */
     byte *dst = alloca(6);
     len = aggregator_32to16(dst, data);
+    data = dst;
   }

   return bgp_put_attr(buf, size, BA_AGGREGATOR, a->flags, data, len);
------------------------------------------

If further information is needed I will be happy to provide it.


Best regards,

-----
Nasato Goto
JPNAP / INTERNET MULTIFEED CO.
goto at mfeed.ad.jp
-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20200414/6da9ea03/attachment.htm>


More information about the Bird-users mailing list