summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/f-inst.c12
-rw-r--r--filter/test.conf5
2 files changed, 17 insertions, 0 deletions
diff --git a/filter/f-inst.c b/filter/f-inst.c
index 0867ac4a..49ae993a 100644
--- a/filter/f-inst.c
+++ b/filter/f-inst.c
@@ -308,12 +308,24 @@
case T_PATH_MASK_ITEM:
pm->item[i] = vv(i).val.pmi;
break;
+
case T_INT:
pm->item[i] = (struct f_path_mask_item) {
.asn = vv(i).val.i,
.kind = PM_ASN,
};
break;
+
+ case T_SET:
+ if (vv(i).val.t->from.type != T_INT)
+ runtime("Only integer sets allowed in path mask");
+
+ pm->item[i] = (struct f_path_mask_item) {
+ .set = vv(i).val.t,
+ .kind = PM_ASN_SET,
+ };
+ break;
+
default:
runtime( "Error resolving path mask template: value not an integer" );
}
diff --git a/filter/test.conf b/filter/test.conf
index 04074965..09a4a88a 100644
--- a/filter/test.conf
+++ b/filter/test.conf
@@ -597,11 +597,15 @@ function mkpath(int a; int b)
return [= a b 3 2 1 =];
}
+define set35 = [3 .. 5];
+
function t_path()
bgpmask pm1;
bgppath p2;
+int set set12;
{
pm1 = [= 4 3 2 1 =];
+ set12 = [1, 2];
bt_assert(format(pm1) = "[= 4 3 2 1 =]");
@@ -627,6 +631,7 @@ bgppath p2;
bt_assert(p2 ~ [= * 4 3 * 1 =]);
bt_assert(p2 ~ [= (3+2) (2*2) 3 2 1 =]);
bt_assert(p2 ~ [= 5 [2, 4, 6] 3 [1..2] 1 =]);
+ bt_assert(p2 ~ [= 5 set35 3 set12 set12 =]);
bt_assert(p2 ~ mkpath(5, 4));
bt_assert(p2.len = 5);