summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-07-20 11:12:02 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2015-07-20 17:11:10 +0200
commit1321e12ac460bd542d3946a0c4a4dacd71157cfa (patch)
tree7f9470375fdc8fb4bf8c4b76140c6e4686d7e079 /filter
parentffa398b8d8bac4cf6368fe700466cad4ff12fee8 (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')
-rw-r--r--filter/filter.c24
-rw-r--r--filter/filter.h1
2 files changed, 25 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)
{
diff --git a/filter/filter.h b/filter/filter.h
index 2b2d23c2..e59c8226 100644
--- a/filter/filter.h
+++ b/filter/filter.h
@@ -107,6 +107,7 @@ struct ea_list;
struct rte;
int f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool, int flags);
+struct f_val f_eval_rte(struct f_inst *expr, struct rte **rte, struct linpool *tmp_pool);
struct f_val f_eval(struct f_inst *expr, struct linpool *tmp_pool);
uint f_eval_int(struct f_inst *expr);
u32 f_eval_asn(struct f_inst *expr);