diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-02 09:12:36 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-02 09:12:36 -0800 |
commit | fed73592cfd6fd2f87aad1669d1b9ebecfa03cdc (patch) | |
tree | 593d14ce30f866ab334d2662be3972c8a8ea016e | |
parent | 831abebf172d4350849aecca838547f8878f36d1 (diff) | |
download | vyatta-cfg-quagga-fed73592cfd6fd2f87aad1669d1b9ebecfa03cdc.tar.gz vyatta-cfg-quagga-fed73592cfd6fd2f87aad1669d1b9ebecfa03cdc.zip |
Static host-name mapping changes
Fix help text (Bug 5254) and allow IPV6 static mapping (Bug 5298)
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | scripts/check-ipv4-ipv6.pl | 12 | ||||
-rw-r--r-- | templates/system/static-host-mapping/host-name/node.def | 8 | ||||
-rw-r--r-- | templates/system/static-host-mapping/host-name/node.tag/inet/node.def | 9 | ||||
-rw-r--r-- | templates/system/static-host-mapping/node.def | 2 |
5 files changed, 27 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 4946ff83..7dc9ac06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,7 @@ sbin_SCRIPTS += scripts/dns-forwarding/vyatta-dns-forwarding.pl sbin_SCRIPTS += scripts/dynamic-dns/vyatta-dynamic-dns.pl sbin_SCRIPTS += scripts/vyatta-system-nameservers sbin_SCRIPTS += scripts/vyatta-interfaces.pl +sbin_SCRIPTS += scripts/check-ipv4-ipv6.pl sbin_SCRIPTS += scripts/vyatta-bonding.pl sbin_SCRIPTS += scripts/vyatta-raid-event sbin_SCRIPTS += scripts/vyatta-update-arp-params diff --git a/scripts/check-ipv4-ipv6.pl b/scripts/check-ipv4-ipv6.pl new file mode 100644 index 00000000..0816ebee --- /dev/null +++ b/scripts/check-ipv4-ipv6.pl @@ -0,0 +1,12 @@ +#! /usr/bin/perl + +# Trivial script to check for valid IPv4 or IPv6 address + +use strict; +use NetAddr::IP; + +foreach my $addr (@ARGV) { + die "$addr: not valid a valid IPv4 or IPv6 address\n" + unless new NetAddr::IP $addr; +} + diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def index bd9cfab1..edd286c8 100644 --- a/templates/system/static-host-mapping/host-name/node.def +++ b/templates/system/static-host-mapping/host-name/node.def @@ -1,8 +1,12 @@ tag: type: txt -help: Set to map DNS names to system interfaces -syntax:expression: pattern $VAR(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $VAR(@)" +help: Set to map host name to address + +syntax:expression: pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$" + ; "invalid host name $VAR(@)" + commit:expression: $VAR(./inet) != ""; "IP address for the static mapping must be set" + end: sudo sh -c " touch /etc/hosts sed -i '/ $VAR(@) .*#vyatta entry/d' /etc/hosts diff --git a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def index af274398..63e611a8 100644 --- a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def +++ b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def @@ -1,2 +1,7 @@ -type: ipv4 -help: Set Internet address [REQUIRED] +type: txt +help: Set address [REQUIRED] +syntax:expression: exec "/opt/vyatta/sbin/check-ipv4-ipv6.pl $VAR(@)" + +comp_help: Possible completions: + <ipv4> Set IPv4 address + <ipv6> Set IPv6 address diff --git a/templates/system/static-host-mapping/node.def b/templates/system/static-host-mapping/node.def index fbc69aa7..33f33a4c 100644 --- a/templates/system/static-host-mapping/node.def +++ b/templates/system/static-host-mapping/node.def @@ -1,2 +1,2 @@ priority: 400 -help: Set to map DNS names to system interfaces +help: Set to map host names to addresses |