summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-04-20 12:24:26 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-04 15:39:21 +0200
commit337c04c45e1472d6d9b531a3c55f1f2d30ebf308 (patch)
tree7526f6f33a6a57404ed9b15588b1a3fc3eb40182 /lib
parentd8661a4397e4576ac404661b192dd99d928e7890 (diff)
Moved route preference to eattrs
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 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