summaryrefslogtreecommitdiff
path: root/lib/nexthop.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nexthop.h')
-rw-r--r--lib/nexthop.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h
index 781eb93413..20b0cd5227 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -50,6 +50,11 @@ enum blackhole_type {
BLACKHOLE_ADMINPROHIB,
};
+/* IPV[46] -> IPV[46]_IFINDEX */
+#define NEXTHOP_FIRSTHOPTYPE(type) \
+ ((type) == NEXTHOP_TYPE_IFINDEX || (type) == NEXTHOP_TYPE_BLACKHOLE) \
+ ? (type) : ((type) | 1)
+
/* Nexthop label structure. */
struct nexthop_label {
u_int8_t num_labels;
@@ -74,6 +79,10 @@ struct nexthop {
#define NEXTHOP_FLAG_ONLINK (1 << 3) /* Nexthop should be installed onlink. */
#define NEXTHOP_FLAG_MATCHED (1 << 4) /* Already matched vs a nexthop */
#define NEXTHOP_FLAG_FILTERED (1 << 5) /* rmap filtered, used by static only */
+#define NEXTHOP_FLAG_DUPLICATE (1 << 6) /* nexthop duplicates another active one */
+#define NEXTHOP_IS_ACTIVE(flags) \
+ (CHECK_FLAG(flags, NEXTHOP_FLAG_ACTIVE) \
+ && !CHECK_FLAG(flags, NEXTHOP_FLAG_DUPLICATE))
/* Nexthop address */
union {
@@ -141,6 +150,7 @@ extern const char *nexthop_type_to_str(enum nexthop_types_t nh_type);
extern int nexthop_same_no_recurse(const struct nexthop *next1,
const struct nexthop *next2);
extern int nexthop_labels_match(struct nexthop *nh1, struct nexthop *nh2);
+extern int nexthop_same_firsthop (struct nexthop *next1, struct nexthop *next2);
extern const char *nexthop2str(struct nexthop *nexthop, char *str, int size);
extern struct nexthop *nexthop_next(struct nexthop *nexthop);