summaryrefslogtreecommitdiff
path: root/filter/filter.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-08-15 01:06:47 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2013-08-15 01:06:47 +0200
commitbff9ce5130d16af2fd802d42bdb2bff00980c9ae (patch)
tree823dda756311b34c5f2dad4f537671f8d732c9c7 /filter/filter.c
parent8a112d8ba2e77d79468146ec8f54b3c90b6e68e4 (diff)
Extends delete/filter operators to work no bgp_paths.
Diffstat (limited to 'filter/filter.c')
-rw-r--r--filter/filter.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 98bae331..25587e0f 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -1165,7 +1165,34 @@ interpret(struct f_inst *what)
case P('C','a'): /* (Extended) Community list add or delete */
TWOARGS;
- if (v1.type == T_CLIST)
+ if (v1.type == T_PATH)
+ {
+ struct f_tree *set = NULL;
+ u32 key = 0;
+ int pos;
+
+ if (v2.type == T_INT)
+ key = v2.val.i;
+ else if ((v2.type == T_SET) && (v2.val.t->from.type == T_INT))
+ set = v2.val.t;
+ else
+ runtime("Can't delete non-integer (set)");
+
+ switch (what->aux)
+ {
+ case 'a': runtime("Can't add to path");
+ case 'd': pos = 0; break;
+ case 'f': pos = 1; break;
+ default: bug("unknown Ca operation");
+ }
+
+ if (pos && !set)
+ runtime("Can't filter integer");
+
+ res.type = T_PATH;
+ res.val.ad = as_path_filter(f_pool, v1.val.ad, set, key, pos);
+ }
+ else if (v1.type == T_CLIST)
{
/* Community (or cluster) list */
struct f_val dummy;