summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:09:31 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:28:33 +0200
commit7a7ac656829223713f9e6bcef63d2b5a5efce7d2 (patch)
tree153afd214a815124b37fcd88c66134d716a390cf /filter
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
parent06edbb67ed807811654e7fd8f0f9b83766430216 (diff)
Merge branch 'master' into int-new-channels
Diffstat (limited to 'filter')
-rw-r--r--filter/config.Y3
-rw-r--r--filter/filter.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 3bb00c13..3e70a63e 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -282,7 +282,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
LEN,
DEFINED,
ADD, DELETE, CONTAINS, RESET,
- PREPEND, FIRST, LAST, MATCH,
+ PREPEND, FIRST, LAST, LAST_NONAGGREGATED, MATCH,
EMPTY,
FILTER, WHERE, EVAL)
@@ -743,6 +743,7 @@ term:
| term '.' MASK '(' term ')' { $$ = f_new_inst(); $$->code = P('i','M'); $$->a1.p = $1; $$->a2.p = $5; }
| term '.' FIRST { $$ = f_new_inst(); $$->code = P('a','f'); $$->a1.p = $1; }
| term '.' LAST { $$ = f_new_inst(); $$->code = P('a','l'); $$->a1.p = $1; }
+ | term '.' LAST_NONAGGREGATED { $$ = f_new_inst(); $$->code = P('a','L'); $$->a1.p = $1; }
/* Communities */
/* This causes one shift/reduce conflict
diff --git a/filter/filter.c b/filter/filter.c
index 6ab0cc93..cc1bb3dc 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -1056,6 +1056,14 @@ interpret(struct f_inst *what)
res.type = T_INT;
res.val.i = as;
break;
+ case P('a','L'): /* Get last ASN from non-aggregated part of AS PATH */
+ ONEARG;
+ if (v1.type != T_PATH)
+ runtime( "AS path expected" );
+
+ res.type = T_INT;
+ res.val.i = as_path_get_last_nonaggregated(v1.val.ad);
+ break;
case 'r':
ONEARG;
res = v1;