summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-05-30 17:18:03 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-30 17:18:03 +0200
commit1a92ee9d4df265018c0344064019f53bc3afce3a (patch)
tree3eb67d0604086b399618bc525a83ce83deac9eb0 /lib
parent674587d9c84ed70151abc56003c371668079ae31 (diff)
parent337c04c45e1472d6d9b531a3c55f1f2d30ebf308 (diff)
Merge commit '337c04c45e1472d6d9b531a3c55f1f2d30ebf308' into haugesund
Diffstat (limited to 'lib')
-rw-r--r--lib/route.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/route.h b/lib/route.h
index 8253ab8e..66b8b312 100644
--- a/lib/route.h
+++ b/lib/route.h
@@ -91,7 +91,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;
@@ -183,10 +182,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);
@@ -292,6 +287,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(const 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)
@@ -321,6 +333,4 @@ void rta_dump(rta *);
void rta_dump_all(void);
void rta_show(struct cli *, rta *);
-u32 rt_get_igp_metric(const rte *rt);
-
#endif