0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 07:31:54 +00:00

Nest: Fix bitfield attributes

Fix missing route lookup, causing crash when accessing route attribute.

Also fix additional space in bitfield formatting.
This commit is contained in:
Ondrej Zajicek 2024-03-28 19:46:24 +01:00
parent f47ca71d77
commit 4036da3732
2 changed files with 8 additions and 3 deletions

View File

@ -1248,6 +1248,7 @@ ea_list_unref(ea_list *l)
void
ea_format_bitfield(const struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max)
{
byte *start = buf;
byte *bound = buf + bufsize - 32;
u32 data = a->u.data;
int i;
@ -1268,6 +1269,10 @@ ea_format_bitfield(const struct eattr *a, byte *buf, int bufsize, const char **n
if (data)
bsprintf(buf, "%08x ", data);
if (buf != start)
buf--;
*buf = 0;
return;
}

View File

@ -54,7 +54,7 @@ attr_bit: KRT_FEATURE_ECN { $$ = f_new_dynamic_attr_bit(0, "krt_features"); } ;
attr_bit: KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr_bit(3, "krt_features"); } ;
/* Using attribute bits in filters (moved here to not confuse Bison on *BSD) */
lvalue: attr_bit { $$ = (struct f_lval) { .type = F_LVAL_ATTR_BIT, .fab = $1 }; };
lvalue: attr_bit { $$ = (struct f_lval) { .type = F_LVAL_ATTR_BIT, .fab = $1, .rte = f_new_inst(FI_CURRENT_ROUTE), }; };
CF_CODE