Mailing List Archive

Broken MRT RIB dumps with large communities
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
Re: Broken MRT RIB dumps with large communities [ In reply to ]
Hi

Thanks. Applied

On Tue, Jun 26, 2018 at 8:14 PM, Colin Petrie <cpetrie@ripe.net> wrote:

> 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
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>