summaryrefslogtreecommitdiff
path: root/proto/static/config.Y
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-09-22 19:49:15 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-10-04 13:12:05 +0200
commit81a20ca5d8508f7317f2e023a3be5e5da454d740 (patch)
tree92cf4105fbe6d14bcb837235a95117f8df43d1cb /proto/static/config.Y
parent35726051517aaf1869458caed03c7ee1c516721c (diff)
Static: Add syntax for static MPLS labels
Instead of just using route attributes, static routes with static MPLS labels can be defined just by e.g.: route 10.1.1.0/24 mpls 100 via 10.1.2.1 mpls 200;
Diffstat (limited to 'proto/static/config.Y')
-rw-r--r--proto/static/config.Y8
1 files changed, 7 insertions, 1 deletions
diff --git a/proto/static/config.Y b/proto/static/config.Y
index c8862171..215681e8 100644
--- a/proto/static/config.Y
+++ b/proto/static/config.Y
@@ -107,15 +107,21 @@ stat_nexthops:
| stat_nexthops stat_nexthop
;
+stat_mpls:
+ /* empty */
+ | MPLS expr { this_srt->mpls_label = $2; if ($2 >= MPLS_MAX_LABEL) cf_error("MPLS label must be less than 2^20"); }
+ ;
+
stat_route0: ROUTE net_any {
this_srt = cfg_allocz(sizeof(struct static_route));
add_tail(&STATIC_CFG->routes, &this_srt->n);
this_srt->net = $2;
+ this_srt->mpls_label = (uint) -1;
this_srt_cmds = NULL;
this_srt_last_cmd = NULL;
this_srt->mp_next = NULL;
this_snh = NULL;
- }
+ } stat_mpls
;
stat_route: