summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/protocols-static.xml.in14
-rwxr-xr-xsrc/conf_mode/protocols_static.py9
2 files changed, 23 insertions, 0 deletions
diff --git a/interface-definitions/protocols-static.xml.in b/interface-definitions/protocols-static.xml.in
index e89433022..033c7759e 100644
--- a/interface-definitions/protocols-static.xml.in
+++ b/interface-definitions/protocols-static.xml.in
@@ -26,6 +26,20 @@
</constraint>
</properties>
<children>
+ <leafNode name="description">
+ <properties>
+ <help>Table description</help>
+ <constraint>
+ <!--
+ iproute2 only considers the first "word" until whitespace in the name field
+ but does not complain about special characters.
+ We put an artificial limit here to make table descriptions potentially valid node names
+ to avoid quoting and simplify future syntax changes if we decide to make any.
+ -->
+ <regex>[a-zA-Z0-9_\-]+</regex>
+ </constraint>
+ </properties>
+ </leafNode>
#include <include/static/static-route.xml.i>
#include <include/static/static-route6.xml.i>
</children>
diff --git a/src/conf_mode/protocols_static.py b/src/conf_mode/protocols_static.py
index 58e202928..cbbc476a7 100755
--- a/src/conf_mode/protocols_static.py
+++ b/src/conf_mode/protocols_static.py
@@ -98,6 +98,15 @@ def generate(static):
return None
def apply(static):
+ ## Put routing table names in /etc/iproute2/rt_tables
+ with open("/etc/iproute2/rt_tables.d/vyos.conf", 'w') as f:
+ print("# Generated by VyOS (protocols_static.py), do not edit by hand", file=f)
+ for t in static['table']:
+ if 'description' in static['table'][t]:
+ print(f"{t}\t{static['table'][t]['description']}", file=f)
+
+ ## Inject routes into FRR
+
static_daemon = 'staticd'
zebra_daemon = 'zebra'