summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_route.h
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_route.h')
-rw-r--r--ospf6d/ospf6_route.h56
1 files changed, 47 insertions, 9 deletions
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index 2fb2c1d7..0836031b 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -96,7 +96,10 @@ struct ospf6_path
/* Cost */
u_int8_t metric_type;
u_int32_t cost;
- u_int32_t cost_e2;
+ union {
+ u_int32_t cost_e2;
+ u_int32_t cost_config;
+ } u;
};
#define OSPF6_PATH_TYPE_NONE 0
@@ -107,8 +110,13 @@ struct ospf6_path
#define OSPF6_PATH_TYPE_REDISTRIBUTE 5
#define OSPF6_PATH_TYPE_MAX 6
+#define OSPF6_PATH_SUBTYPE_DEFAULT_RT 1
+
+#define OSPF6_PATH_COST_IS_CONFIGURED(path) (path.u.cost_config != OSPF_AREA_RANGE_COST_UNSPEC)
+
#include "prefix.h"
#include "table.h"
+#include "bitfield.h"
struct ospf6_route
{
@@ -136,17 +144,18 @@ struct ospf6_route
/* flag */
u_char flag;
- /* path */
- struct ospf6_path path;
-
- /* nexthop */
- struct ospf6_nexthop nexthop[OSPF6_MULTI_PATH_LIMIT];
-
/* route option */
void *route_option;
/* link state id for advertising */
u_int32_t linkstate_id;
+
+ /* path */
+ struct ospf6_path path;
+
+ /* nexthop */
+ struct list *nh_list;
+
};
#define OSPF6_DEST_TYPE_NONE 0
@@ -164,6 +173,7 @@ struct ospf6_route
#define OSPF6_ROUTE_ACTIVE_SUMMARY 0x10
#define OSPF6_ROUTE_DO_NOT_ADVERTISE 0x20
#define OSPF6_ROUTE_WAS_REMOVED 0x40
+#define OSPF6_ROUTE_BLACKHOLE_ADDED 0x80
struct ospf6_route_table
{
@@ -176,6 +186,8 @@ struct ospf6_route_table
u_int32_t count;
+ bitfield_t idspace;
+
/* hooks */
void (*hook_add) (struct ospf6_route *);
void (*hook_change) (struct ospf6_route *);
@@ -235,8 +247,8 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
((ra)->type == (rb)->type && \
memcmp (&(ra)->prefix, &(rb)->prefix, sizeof (struct prefix)) == 0 && \
memcmp (&(ra)->path, &(rb)->path, sizeof (struct ospf6_path)) == 0 && \
- memcmp (&(ra)->nexthop, &(rb)->nexthop, \
- sizeof (struct ospf6_nexthop) * OSPF6_MULTI_PATH_LIMIT) == 0)
+ ospf6_route_cmp_nexthops (ra, rb) == 0)
+
#define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST))
#define ospf6_linkstate_prefix_adv_router(x) \
@@ -255,9 +267,35 @@ extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id,
extern void ospf6_linkstate_prefix2str (struct prefix *prefix, char *buf,
int size);
+extern struct ospf6_nexthop *ospf6_nexthop_create (void);
+extern void ospf6_nexthop_delete (struct ospf6_nexthop *nh);
+extern void ospf6_free_nexthops (struct list *nh_list);
+extern void ospf6_clear_nexthops (struct list *nh_list);
+extern int ospf6_num_nexthops (struct list *nh_list);
+extern void ospf6_copy_nexthops (struct list *dst, struct list *src);
+extern void ospf6_merge_nexthops (struct list *dst, struct list *src);
+extern void ospf6_add_nexthop (struct list *nh_list, int ifindex,
+ struct in6_addr *addr);
+extern int ospf6_num_nexthops (struct list *nh_list);
+extern int ospf6_route_cmp_nexthops (struct ospf6_route *a,
+ struct ospf6_route *b);
+extern void ospf6_route_zebra_copy_nexthops (struct ospf6_route *route,
+ ifindex_t *ifindices,
+ struct in6_addr **addr,
+ int entries);
+extern int ospf6_route_get_first_nh_index (struct ospf6_route *route);
+
+/* Hide abstraction of nexthop implementation in route from outsiders */
+#define ospf6_route_copy_nexthops(dst, src) ospf6_copy_nexthops(dst->nh_list, src->nh_list)
+#define ospf6_route_merge_nexthops(dst, src) ospf6_merge_nexthops(dst->nh_list, src->nh_list)
+#define ospf6_route_num_nexthops(route) ospf6_num_nexthops(route->nh_list)
+#define ospf6_route_add_nexthop(route, ifindex, addr) \
+ ospf6_add_nexthop(route->nh_list, ifindex, addr)
+
extern struct ospf6_route *ospf6_route_create (void);
extern void ospf6_route_delete (struct ospf6_route *);
extern struct ospf6_route *ospf6_route_copy (struct ospf6_route *route);
+extern int ospf6_route_cmp (struct ospf6_route *ra, struct ospf6_route *rb);
extern void ospf6_route_lock (struct ospf6_route *route);
extern void ospf6_route_unlock (struct ospf6_route *route);