summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rwxr-xr-xscripts/policy/vyatta-check-as-prepend.pl6
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def2
3 files changed, 9 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index f6966c4a..bde07934 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,7 @@ cfgdir = $(datadir)/vyatta-cfg/templates
sbin_SCRIPTS = scripts/bgp/vyatta-bgp.pl
sbin_SCRIPTS += scripts/policy/vyatta-policy.pl
sbin_SCRIPTS += scripts/vyatta_quagga_utils.pl
+sbin_SCRIPTS += scripts/policy/vyatta-check-as-prepend.pl
cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \
cpio -0pd
diff --git a/scripts/policy/vyatta-check-as-prepend.pl b/scripts/policy/vyatta-check-as-prepend.pl
new file mode 100755
index 00000000..0da3d8d6
--- /dev/null
+++ b/scripts/policy/vyatta-check-as-prepend.pl
@@ -0,0 +1,6 @@
+#!/usr/bin/perl
+@as_list = split(' ',$ARGV[0]);
+foreach $as (@as_list) {
+ if ($as =~ /[^\d\s]/ || $as < 1 || $as > 65535) { exit 1;}
+}
+exit 0;
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def
index cb444663..f3ca53fb 100644
--- a/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def
@@ -1,5 +1,6 @@
type: txt
help: "Prepend string for a BGP AS-path attribute"
+syntax: exec "/opt/vyatta/sbin/vyatta-check-as-prepend.pl \"$(@)\" "; "Invalid AS path."
commit: $(../../action/) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
update: "/usr/bin/vtysh -c \"configure terminal\" \
-c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
@@ -7,3 +8,4 @@ update: "/usr/bin/vtysh -c \"configure terminal\" \
delete: "/usr/bin/vtysh -c \"configure terminal\" \
-c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
-c \"no set as-path prepend \" "
+#comp_help: Enter a list of AS numbers to prepend. Use double quotes around the list (f.g. "456 64500 45001")