summaryrefslogtreecommitdiff
path: root/proto/pipe/pipe.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-06-22 12:45:42 +0200
committerMaria Matejka <mq@ucw.cz>2022-06-24 15:49:08 +0200
commit9c9059fd172dcc2f8805529de4b3174f280c109c (patch)
treeb0e642405a9485b0f571d8414720a072aac7b404 /proto/pipe/pipe.c
parent050b4b4e5e6d4c05345bed2ec62c865258b4e7ee (diff)
Allowed optimized exporting of a subprefix tree
Added an option for export filter to allow for prefiltering based on the prefix. Routes outside the given prefix are completely ignored. Config is simple: export in <net> <filter>;
Diffstat (limited to 'proto/pipe/pipe.c')
-rw-r--r--proto/pipe/pipe.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c
index d12e6731..351db36b 100644
--- a/proto/pipe/pipe.c
+++ b/proto/pipe/pipe.c
@@ -123,6 +123,12 @@ pipe_postconfig(struct proto_config *CF)
if (cc->table->addr_type != cf->peer->addr_type)
cf_error("Primary table and peer table must have the same type");
+ if (cc->out_subprefix && (cc->table->addr_type != cc->out_subprefix->type))
+ cf_error("Export subprefix must match table type");
+
+ if (cf->in_subprefix && (cc->table->addr_type != cf->in_subprefix->type))
+ cf_error("Import subprefix must match table type");
+
if (cc->rx_limit.action)
cf_error("Pipe protocol does not support receive limits");
@@ -142,6 +148,7 @@ pipe_configure_channels(struct pipe_proto *p, struct pipe_config *cf)
.channel = cc->channel,
.table = cc->table,
.out_filter = cc->out_filter,
+ .out_subprefix = cc->out_subprefix,
.in_limit = cc->in_limit,
.ra_mode = RA_ANY,
.debug = cc->debug,
@@ -153,6 +160,7 @@ pipe_configure_channels(struct pipe_proto *p, struct pipe_config *cf)
.channel = cc->channel,
.table = cf->peer,
.out_filter = cc->in_filter,
+ .out_subprefix = cf->in_subprefix,
.in_limit = cc->out_limit,
.ra_mode = RA_ANY,
.debug = cc->debug,