aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-09-09 02:55:32 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-11-26 18:39:25 +0100
commit5ea39eaa96625ec8274703b1eb2c8f59042a8a32 (patch)
tree0ef3675d3818b86b2ee2c9edaf6663cdf153bbe9 /lib
parentaf02b83b888c693c292960072195f0e1caf1d2a1 (diff)
downloadbird-5ea39eaa96625ec8274703b1eb2c8f59042a8a32.tar.gz
Nest: Use bitmaps to keep track of exported routes
Use a hierarchical bitmap in a routing table to assign ids to routes, and then use bitmaps (indexed by route id) in channels to keep track whether routes were exported. This avoids unreliable and inefficient re-evaluation of filters for old routes in order to determine whether they were exported.
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c7
-rw-r--r--lib/bitmap.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 16bb1464..b6ea5a38 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -27,6 +27,13 @@ bmap_init(struct bmap *b, pool *p, uint size)
}
void
+bmap_reset(struct bmap *b, uint size)
+{
+ b->size = BIRD_ALIGN(size, 4);
+ memset(b->data, 0, b->size);
+}
+
+void
bmap_grow(struct bmap *b, uint need)
{
uint size = b->size * 2;
diff --git a/lib/bitmap.h b/lib/bitmap.h
index df2945a1..0093cd18 100644
--- a/lib/bitmap.h
+++ b/lib/bitmap.h
@@ -17,6 +17,7 @@ struct bmap
};
void bmap_init(struct bmap *b, pool *p, uint size);
+void bmap_reset(struct bmap *b, uint size);
void bmap_grow(struct bmap *b, uint need);
void bmap_free(struct bmap *b);