diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | scripts/vyatta-encapsulation | 12 | ||||
-rw-r--r-- | templates/interfaces/tunnel/node.tag/encapsulation/node.def | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index 8329e30b..5ac51967 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,6 +72,7 @@ sbin_SCRIPTS += scripts/vyatta-bridge.pl sbin_SCRIPTS += scripts/vyatta-bridgegroup-depedency.pl sbin_SCRIPTS += scripts/vyatta-dhcpv6-client.pl sbin_SCRIPTS += scripts/vyatta-update-grub.pl +sbin_SCRIPTS += scripts/vyatta-encapsulation sbin_PROGRAMS = src/valid_address sbin_PROGRAMS += src/local_ip diff --git a/scripts/vyatta-encapsulation b/scripts/vyatta-encapsulation new file mode 100644 index 00000000..8c64341e --- /dev/null +++ b/scripts/vyatta-encapsulation @@ -0,0 +1,12 @@ +#!/bin/sh + +list="gre gre-bridge ipip sit ipip6 ip6ip6" +if [[ `dpkg -l | grep "vyatta-nhrp" | awk '{print $1}'` = "ii" ]]; then tmp="gre-multipoint"; fi +full_list="${list} ${tmp}" +if [[ -n "$1" ]]; then + for f in ${full_list}; do if [[ "$1" = "$f" ]]; then exit 0; fi; done + echo "Must be (${full_list})" + exit 1; +else + echo ${full_list} +fi diff --git a/templates/interfaces/tunnel/node.tag/encapsulation/node.def b/templates/interfaces/tunnel/node.tag/encapsulation/node.def index bb93e373..b858147c 100644 --- a/templates/interfaces/tunnel/node.tag/encapsulation/node.def +++ b/templates/interfaces/tunnel/node.tag/encapsulation/node.def @@ -1,9 +1,9 @@ type: txt help: Encapsulation of this tunnel interface [REQUIRED] -syntax:expression: $VAR(@) in "ipip", "gre", "sit", "gre-bridge", "ipip6", "ip6ip6", "gre-multipoint"; "Must be (ipip, gre, gre-bridge, gre-multipoint, sit, ipip6, ip6ip6)" +syntax:expression: ((pattern $VAR(@) "^[-a-zA-Z0-9_]+$") && (exec "sudo /opt/vyatta/sbin/vyatta-encapsulation $VAR(@)")) -allowed: echo gre gre-bridge ipip sit ipip6 ip6ip6 gre-multipoint +allowed: sudo /opt/vyatta/sbin/vyatta-encapsulation commit:expression: (!(pattern $VAR(../local-ip/@) ".*:.*") && $VAR(@) == "gre-multipoint") || \ $VAR(@) != "gre-multipoint"; "IPv6 local-ip ($VAR(../local-ip/@)) is forbidden for gre-multipoint encapsulation type." @@ -30,7 +30,7 @@ update:expression: "false" ; \ val_help: gre; Generic Routing Encapsulation val_help: gre-bridge; Generic Routing Encapsulation bridge interface -val_help: gre-multipoint; Multipoint Generic Routing Encapsulation +val_help: gre-multipoint; Multipoint Generic Routing Encapsulation(allowed if the package vyatta-nhrp installed) val_help: ipip; IP in IP encapsulation val_help: sit; Simple Internet Transition encapsulation val_help: ipip6; IP in IP6 encapsulation |