aboutsummaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-12-28 21:19:27 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-12-28 21:19:27 +0100
commitea3c6c1a15ce9b93f583f96919c70f7a2fd34e98 (patch)
tree35488f8900cdf512f6954200043ef3210426237d /proto
parent9e2635505a08e3453eef487360e49b4b70987ceb (diff)
downloadbird-ea3c6c1a15ce9b93f583f96919c70f7a2fd34e98.tar.gz
Static: Fix handling of 'net' attribute in per-route filters
We need to define 'net' field temporarily as it may be accessed by per-route filters. Thanks to Damian Zaremba for the bugreport.
Diffstat (limited to 'proto')
-rw-r--r--proto/static/static.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 941e916f..31b7f5d6 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -106,8 +106,19 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
e->pflags = 0;
if (r->cmds)
+ {
+ /* Create a temporary table node */
+ e->net = alloca(sizeof(net) + r->net->length);
+ memset(e->net, 0, sizeof(net) + r->net->length);
+ net_copy(e->net->n.addr, r->net);
+
+ /* Evaluate the filter */
f_eval_rte(r->cmds, &e, static_lp);
+ /* Remove the temporary node */
+ e->net = NULL;
+ }
+
rte_update2(p->p.main_channel, r->net, e, a->src);
r->state = SRS_CLEAN;