diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2015-07-20 11:12:02 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2015-07-20 17:11:10 +0200 |
commit | 1321e12ac460bd542d3946a0c4a4dacd71157cfa (patch) | |
tree | 7f9470375fdc8fb4bf8c4b76140c6e4686d7e079 /filter/filter.c | |
parent | ffa398b8d8bac4cf6368fe700466cad4ff12fee8 (diff) |
Static: Allows to specify attributes for static routes
The patch adds suport for specifying route attributes together with
static routes, e.g.:
route 10.1.1.0/24 via 10.0.0.1 { krt_advmss = 1200; ospf_metric1 = 100; };
Diffstat (limited to 'filter/filter.c')
-rw-r--r-- | filter/filter.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/filter/filter.c b/filter/filter.c index 3f8968aa..55062aca 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -1527,6 +1527,30 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc return res.val.i; } +/* TODO: perhaps we could integrate f_eval(), f_eval_rte() and f_run() */ + +struct f_val +f_eval_rte(struct f_inst *expr, struct rte **rte, struct linpool *tmp_pool) +{ + struct ea_list *tmp_attrs = NULL; + + f_rte = rte; + f_old_rta = NULL; + f_tmp_attrs = &tmp_attrs; + f_pool = tmp_pool; + f_flags = 0; + + LOG_BUFFER_INIT(f_buf); + + /* Note that in this function we assume that rte->attrs is private / uncached */ + struct f_val res = interpret(expr); + + /* Hack to include EAF_TEMP attributes to the main list */ + (*rte)->attrs->eattrs = ea_append(tmp_attrs, (*rte)->attrs->eattrs); + + return res; +} + struct f_val f_eval(struct f_inst *expr, struct linpool *tmp_pool) { |