Discussion:
[quagga-dev 16732] Broken MRT RIB dumps with large communities
Colin Petrie
2018-06-26 14:44:16 UTC
Permalink
Hello,

We've noticed that the implementation of Large Communities in Quagga
produces broken MRT RIB dump files when any RIB entries contain Large
Communities.

It looks like a copy/paste problem, in
bgpd/bgp_attr.c/bgp_dump_routes_attr():
if (attr->extra && attr->flag & ATTR_FLAG_BIT
(BGP_ATTR_LARGE_COMMUNITIES)) {
...
stream_putc (s, BGP_ATTR_COMMUNITIES);
...

The problem is that bgpd dumps the Large Communities into the MRT file
with an attribute type code of BGP_ATTR_COMMUNITIES instead of
BGP_ATTR_LARGE_COMMUNITIES

As a result, if the RIB entry also have regular communities, the
resulting MRT file has two community attributes (which is a protocol
violation, to have the same attribute more than once).

In the case of bgpdump, this crashes it with an assert. For some other
parsers, they only display the second attribute (losing the first set of
communities) and parse the large communities as if they were regular
communities.

I've attached a trivial patch to fix this.

I'm currently investigating how to handle this in bgpdump because there
is now existing MRT data (including route-views data) that is affected
by this.

Let me know if you have any questions, etc.

Kind Regards,

Colin Petrie
Systems Engineer
RIPE NCC RIS Project
Balaji Gurudoss
2018-06-28 16:03:07 UTC
Permalink
Hi

Thanks. Applied
Post by Colin Petrie
Hello,
We've noticed that the implementation of Large Communities in Quagga
produces broken MRT RIB dump files when any RIB entries contain Large
Communities.
It looks like a copy/paste problem, in
if (attr->extra && attr->flag & ATTR_FLAG_BIT
(BGP_ATTR_LARGE_COMMUNITIES)) {
...
stream_putc (s, BGP_ATTR_COMMUNITIES);
...
The problem is that bgpd dumps the Large Communities into the MRT file
with an attribute type code of BGP_ATTR_COMMUNITIES instead of
BGP_ATTR_LARGE_COMMUNITIES
As a result, if the RIB entry also have regular communities, the
resulting MRT file has two community attributes (which is a protocol
violation, to have the same attribute more than once).
In the case of bgpdump, this crashes it with an assert. For some other
parsers, they only display the second attribute (losing the first set of
communities) and parse the large communities as if they were regular
communities.
I've attached a trivial patch to fix this.
I'm currently investigating how to handle this in bgpdump because there
is now existing MRT data (including route-views data) that is affected
by this.
Let me know if you have any questions, etc.
Kind Regards,
Colin Petrie
Systems Engineer
RIPE NCC RIS Project
_______________________________________________
Quagga-dev mailing list
https://lists.quagga.net/mailman/listinfo/quagga-dev
Loading...