0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-23 09:21:53 +00:00

MRT: instead of crashing, ignore non-BGP attributes

This commit is contained in:
Maria Matejka 2024-11-14 22:15:56 +01:00 committed by Ondrej Zajicek
parent 7ee27418a7
commit 946386f2dd
3 changed files with 10 additions and 2 deletions

View File

@ -1247,7 +1247,11 @@ bgp_export_attrs(struct bgp_export_state *s, ea_list *attrs)
static inline int static inline int
bgp_encode_attr(struct bgp_write_state *s, eattr *a, byte *buf, uint size) 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); uint code = EA_ID(a->id);

View File

@ -453,6 +453,7 @@ struct bgp_write_state {
int add_path; int add_path;
int mpls; int mpls;
int sham; int sham;
int ignore_non_bgp_attrs;
eattr *mp_next_hop; eattr *mp_next_hop;
const adata *mpls_labels; const adata *mpls_labels;

View File

@ -594,7 +594,10 @@ mrt_table_dump_free(struct mrt_table_dump_state *s)
static int static int
mrt_table_dump_step(struct mrt_table_dump_state *s) 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->max = 2048;
s->bws = &bws; s->bws = &bws;