summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-09-18 01:11:09 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-09-18 01:11:09 +0200
commitdb96fccb31bc0436ec182ff825f592d6c16dc930 (patch)
tree2f171d9ba78f773bab7b2e55973d9f7a713073dd /filter
parent46eb80d5d50a2b284cae19444149d57d857a8e02 (diff)
downloadbird-db96fccb31bc0436ec182ff825f592d6c16dc930.tar
bird-db96fccb31bc0436ec182ff825f592d6c16dc930.zip
Fixes bug in filter rta copy-on-write.
Filters should try to copy-on-write just cached rtas.
Diffstat (limited to 'filter')
-rw-r--r--filter/filter.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 9617482..6356632 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -291,7 +291,6 @@ static struct rte **f_rte, *f_rte_old;
static struct linpool *f_pool;
static struct ea_list **f_tmp_attrs;
static int f_flags;
-static rta *f_rta_copy;
/*
* rta_cow - prepare rta for modification by filter
@@ -299,8 +298,8 @@ static rta *f_rta_copy;
static void
rta_cow(void)
{
- if (!f_rta_copy) {
- f_rta_copy = lp_alloc(f_pool, sizeof(rta));
+ if ((*f_rte)->attrs->aflags & RTAF_CACHED) {
+ rta *f_rta_copy = lp_alloc(f_pool, sizeof(rta));
memcpy(f_rta_copy, (*f_rte)->attrs, sizeof(rta));
f_rta_copy->aflags = 0;
*f_rte = rte_cow(*f_rte);
@@ -686,8 +685,8 @@ interpret(struct f_inst *what)
if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) {
rta_cow();
- l->next = f_rta_copy->eattrs;
- f_rta_copy->eattrs = l;
+ l->next = (*f_rte)->attrs->eattrs;
+ (*f_rte)->attrs->eattrs = l;
} else {
l->next = (*f_tmp_attrs);
(*f_tmp_attrs) = l;
@@ -946,7 +945,6 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc
f_tmp_attrs = tmp_attrs;
f_rte = rte;
f_rte_old = *rte;
- f_rta_copy = NULL;
f_pool = tmp_pool;
inst = filter->root;
res = interpret(inst);
@@ -967,7 +965,6 @@ f_eval_int(struct f_inst *expr)
f_tmp_attrs = NULL;
f_rte = NULL;
f_rte_old = NULL;
- f_rta_copy = NULL;
f_pool = cfg_mem;
res = interpret(expr);
if (res.type != T_INT)