summaryrefslogtreecommitdiff
path: root/nest/route.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-03-24 12:41:43 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2014-03-24 12:41:43 +0100
commitc980f8002e0f0578d5e715d48d65d9fb9a0c5a70 (patch)
treef1d3be6b0992c7cb0be3694229ffb42dc740ae91 /nest/route.h
parent2e84b4e82dbf8fce0fd12fb0c25d925ffd287970 (diff)
parent227af309e55a59f14d1a5a757f17900164bffc97 (diff)
Merge branch 'bgp-grace'
Diffstat (limited to 'nest/route.h')
-rw-r--r--nest/route.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/nest/route.h b/nest/route.h
index f00f8b2b..82d9e202 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -148,6 +148,10 @@ typedef struct rtable {
struct fib_iterator nhu_fit; /* Next Hop Update FIB iterator */
} rtable;
+#define RPS_NONE 0
+#define RPS_SCHEDULED 1
+#define RPS_RUNNING 2
+
typedef struct network {
struct fib_node n; /* FIB flags reserved for kernel syncer */
struct rte *routes; /* Available routes for this network */
@@ -222,6 +226,8 @@ typedef struct rte {
#define REF_COW 1 /* Copy this rte on write */
#define REF_FILTERED 2 /* Route is rejected by import filter */
+#define REF_STALE 4 /* Route is stale in a refresh cycle */
+#define REF_DISCARD 8 /* Route is scheduled for discard */
/* Route is valid for propagation (may depend on other flags in the future), accepts NULL */
static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_FILTERED); }
@@ -257,6 +263,8 @@ void rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *s
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
void rte_discard(rtable *tab, rte *old);
int rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter *filter);
+void rt_refresh_begin(rtable *t, struct announce_hook *ah);
+void rt_refresh_end(rtable *t, struct announce_hook *ah);
void rte_dump(rte *);
void rte_free(rte *);
rte *rte_do_cow(rte *);
@@ -268,6 +276,15 @@ void rt_feed_baby_abort(struct proto *p);
int rt_prune_loop(void);
struct rtable_config *rt_new_table(struct symbol *s);
+static inline void
+rt_mark_for_prune(rtable *tab)
+{
+ if (tab->prune_state == RPS_RUNNING)
+ fit_get(&tab->fib, &tab->prune_fit);
+
+ tab->prune_state = RPS_SCHEDULED;
+}
+
struct rt_show_data {
ip_addr prefix;
unsigned pxlen;