0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Extended route attributes may include also pointers

This commit is contained in:
Maria Matejka 2021-09-14 19:53:03 +02:00
parent d471d5fc7c
commit 6e13df70fd
2 changed files with 6 additions and 5 deletions

View File

@ -501,7 +501,7 @@ typedef struct eattr {
byte flags; /* Protocol-dependent flags */ byte flags; /* Protocol-dependent flags */
byte type; /* Attribute type and several flags (EAF_...) */ byte type; /* Attribute type and several flags (EAF_...) */
union { union {
u32 data; uintptr_t data;
const struct adata *ptr; /* Attribute data elsewhere */ const struct adata *ptr; /* Attribute data elsewhere */
} u; } u;
} eattr; } eattr;
@ -533,6 +533,7 @@ const char *ea_custom_name(uint ea);
#define EAF_TYPE_AS_PATH 0x06 /* BGP AS path (encoding per RFC 1771:4.3) */ #define EAF_TYPE_AS_PATH 0x06 /* BGP AS path (encoding per RFC 1771:4.3) */
#define EAF_TYPE_BITFIELD 0x09 /* 32-bit embedded bitfield */ #define EAF_TYPE_BITFIELD 0x09 /* 32-bit embedded bitfield */
#define EAF_TYPE_INT_SET 0x0a /* Set of u32's (e.g., a community list) */ #define EAF_TYPE_INT_SET 0x0a /* Set of u32's (e.g., a community list) */
#define EAF_TYPE_PTR 0x0d /* Pointer to an object */
#define EAF_TYPE_EC_SET 0x0e /* Set of pairs of u32's - ext. community list */ #define EAF_TYPE_EC_SET 0x0e /* Set of pairs of u32's - ext. community list */
#define EAF_TYPE_LC_SET 0x12 /* Set of triplets of u32's - large community list */ #define EAF_TYPE_LC_SET 0x12 /* Set of triplets of u32's - large community list */
#define EAF_TYPE_UNDEF 0x1f /* `force undefined' entry */ #define EAF_TYPE_UNDEF 0x1f /* `force undefined' entry */
@ -587,7 +588,7 @@ struct ea_walk_state {
eattr *ea_find(ea_list *, unsigned ea); eattr *ea_find(ea_list *, unsigned ea);
eattr *ea_walk(struct ea_walk_state *s, uint id, uint max); eattr *ea_walk(struct ea_walk_state *s, uint id, uint max);
int ea_get_int(ea_list *, unsigned ea, int def); uintptr_t ea_get_int(ea_list *, unsigned ea, uintptr_t def);
void ea_dump(ea_list *); void ea_dump(ea_list *);
void ea_sort(ea_list *); /* Sort entries in all sub-lists */ void ea_sort(ea_list *); /* Sort entries in all sub-lists */
unsigned ea_scan(ea_list *); /* How many bytes do we need for merged ea_list */ unsigned ea_scan(ea_list *); /* How many bytes do we need for merged ea_list */

View File

@ -541,8 +541,8 @@ ea_walk(struct ea_walk_state *s, uint id, uint max)
* by calling ea_find() to find the attribute, extracting its value or returning * by calling ea_find() to find the attribute, extracting its value or returning
* a provided default if no such attribute is present. * a provided default if no such attribute is present.
*/ */
int uintptr_t
ea_get_int(ea_list *e, unsigned id, int def) ea_get_int(ea_list *e, unsigned id, uintptr_t def)
{ {
eattr *a = ea_find(e, id); eattr *a = ea_find(e, id);
if (!a) if (!a)