From: Maria Matejka Date: Thu, 14 Nov 2024 21:15:56 +0000 (+0100) Subject: MRT: instead of crashing, ignore non-BGP attributes X-Git-Tag: v2.16~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=946386f2;p=thirdparty%2Fbird.git MRT: instead of crashing, ignore non-BGP attributes --- diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 5bd05fb26..0872ae23f 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1247,7 +1247,11 @@ bgp_export_attrs(struct bgp_export_state *s, ea_list *attrs) static inline int bgp_encode_attr(struct bgp_write_state *s, eattr *a, byte *buf, uint size) { - ASSERT(EA_PROTO(a->id) == PROTOCOL_BGP); + if (EA_PROTO(a->id) != PROTOCOL_BGP) + if (s->ignore_non_bgp_attrs) + return 0; + else + bug("Tried to encode a non-BGP attribute"); uint code = EA_ID(a->id); diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 4cef8caf4..19b443721 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -453,6 +453,7 @@ struct bgp_write_state { int add_path; int mpls; int sham; + int ignore_non_bgp_attrs; eattr *mp_next_hop; const adata *mpls_labels; diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c index 3378bacec..1336837a8 100644 --- a/proto/mrt/mrt.c +++ b/proto/mrt/mrt.c @@ -594,7 +594,10 @@ mrt_table_dump_free(struct mrt_table_dump_state *s) static int mrt_table_dump_step(struct mrt_table_dump_state *s) { - struct bgp_write_state bws = { .as4_session = 1 }; + struct bgp_write_state bws = { + .as4_session = 1, + .ignore_non_bgp_attrs = 1, + }; s->max = 2048; s->bws = &bws;