From 1c30b689ddd032ef8000fb7836348a48ba3184ff Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 4 May 2022 14:41:51 +0200 Subject: Moved route source attribute (RTS_*) to eattrs --- lib/route.h | 12 +++++++++--- lib/type_test.c | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/route.h b/lib/route.h index 40ba150d..8fdb5d8b 100644 --- a/lib/route.h +++ b/lib/route.h @@ -85,7 +85,6 @@ typedef struct rta { struct ea_list *eattrs; /* Extended Attribute chain */ struct hostentry *hostentry; /* Hostentry for recursive next-hops */ u16 cached:1; /* Are attributes cached? */ - u16 source:7; /* Route source (RTS_...) */ u16 dest:4; /* Route destination type (RTD_...) */ struct nexthop nh; /* Next hop */ } rta; @@ -131,12 +130,13 @@ static inline int rte_is_reachable(rte *r) typedef struct eattr { word id; /* EA_CODE(PROTOCOL_..., protocol-dependent ID) */ byte flags; /* Protocol-dependent flags */ - byte type:5; /* Attribute type */ + byte type; /* Attribute type */ + byte rfu:5; byte originated:1; /* The attribute has originated locally */ byte fresh:1; /* An uncached attribute (e.g. modified in export filter) */ byte undef:1; /* Explicitly undefined */ - PADDING(unused, 0, 4); + PADDING(unused, 3, 3); union bval u; } eattr; @@ -308,6 +308,12 @@ u32 rt_get_igp_metric(rte *rt); /* From: Advertising router */ extern struct ea_class ea_gen_from; +/* Source: An old method to devise the route source protocol and kind. + * To be superseded in a near future by something more informative. */ +extern struct ea_class ea_gen_source; +static inline u32 rt_get_source_attr(rte *rt) +{ return ea_get_int(rt->attrs->eattrs, &ea_gen_source, 0); } + /* Next hop structures */ #define NEXTHOP_MAX_SIZE (sizeof(struct nexthop) + sizeof(u32)*MPLS_MAX_LABEL_STACK) diff --git a/lib/type_test.c b/lib/type_test.c index 20e7630b..b526db69 100644 --- a/lib/type_test.c +++ b/lib/type_test.c @@ -54,6 +54,7 @@ t_eattr(void) e.id = ~0; e.flags = ~0; e.type = ~0; + e.rfu = ~0; e.originated = ~0; e.fresh = ~0; e.undef = ~0; -- cgit v1.2.3