diff options
author | Pavel Machek <pavel@ucw.cz> | 2000-05-30 12:42:39 +0200 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2000-05-30 12:42:39 +0200 |
commit | 26c09e1d25abff7fb88959dc6fbaa7ae5eb295ad (patch) | |
tree | 2a309ee61845f91be7f9f4d58d88246fb64f1278 /filter/filter.c | |
parent | 2d6627a7a5e52f8314520f9aefd82040e24849cb (diff) | |
download | bird-26c09e1d25abff7fb88959dc6fbaa7ae5eb295ad.tar bird-26c09e1d25abff7fb88959dc6fbaa7ae5eb295ad.zip |
Added read-only access to all required fields in rta.
Diffstat (limited to 'filter/filter.c')
-rw-r--r-- | filter/filter.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/filter/filter.c b/filter/filter.c index 246fbf6..e69e9e1 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -200,6 +200,18 @@ static struct ea_list **f_tmp_attrs; static int f_flags; static rta *f_rta_copy; +void +rta_cow(void) +{ + if (!f_rta_copy) { + 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); + (*f_rte)->attrs = f_rta_copy; + } +} + #define runtime(x) do { \ log( L_ERR "filters, line %d: %s", what->lineno, x); \ res.type = T_RETURN; \ @@ -477,13 +489,7 @@ interpret(struct f_inst *what) } if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) { - if (!f_rta_copy) { - 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); - (*f_rte)->attrs = f_rta_copy; - } + rta_cow(); l->next = f_rta_copy->eattrs; f_rta_copy->eattrs = l; } else { |