diff options
Diffstat (limited to 'lib/route.h')
-rw-r--r-- | lib/route.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/route.h b/lib/route.h index 3b368696..be72bb16 100644 --- a/lib/route.h +++ b/lib/route.h @@ -89,7 +89,6 @@ typedef struct rta { u16 source:7; /* Route source (RTS_...) */ u16 scope:4; /* Route scope (SCOPE_... -- see ip.h) */ u16 dest:4; /* Route destination type (RTD_...) */ - word pref; struct nexthop nh; /* Next hop */ } rta; @@ -181,10 +180,6 @@ struct ea_class_ref { struct ea_class *class; }; -#define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other - protocol-specific metric is availabe */ -extern struct ea_class ea_gen_igp_metric; - void ea_register_init(struct ea_class *); struct ea_class_ref *ea_register_alloc(pool *, struct ea_class); @@ -290,6 +285,23 @@ static inline void ea_set_attr_data(ea_list **to, const struct ea_class *def, uint flags, void *data, uint len) { ea_set_attr(to, EA_LITERAL_STORE_ADATA(def, flags, data, len)); } +/* + * Common route attributes + */ + +/* Preference: first-order comparison */ +extern struct ea_class ea_gen_preference; +static inline u32 rt_get_preference(rte *rt) +{ return ea_get_int(rt->attrs->eattrs, &ea_gen_preference, 0); } + +/* IGP metric: second-order comparison */ +extern struct ea_class ea_gen_igp_metric; +u32 rt_get_igp_metric(rte *rt); +#define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other + protocol-specific metric is availabe */ + + +/* Next hop structures */ #define NEXTHOP_MAX_SIZE (sizeof(struct nexthop) + sizeof(u32)*MPLS_MAX_LABEL_STACK) @@ -319,6 +331,4 @@ void rta_dump(rta *); void rta_dump_all(void); void rta_show(struct cli *, rta *); -u32 rt_get_igp_metric(rte *rt); - #endif |