diff options
Diffstat (limited to 'templates/traceroute')
-rw-r--r-- | templates/traceroute/node.tag/node.def | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/templates/traceroute/node.tag/node.def b/templates/traceroute/node.tag/node.def index 55acbb7..83a3f31 100644 --- a/templates/traceroute/node.tag/node.def +++ b/templates/traceroute/node.tag/node.def @@ -6,9 +6,21 @@ help: Track network path to specified <hostname|IPv4 address> allowed: vyatta-allowed-hosts -run: if /usr/bin/host $2 &>/dev/null - then - /usr/bin/traceroute $2 - else - echo Cannot identify $2 +run: + if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv4 $2 + then + /usr/bin/traceroute $2 + echo + else + if cat /etc/resolv.conf | grep -q nameserver + then + if /usr/bin/host $2 &> /dev/null + then + /usr/bin/traceroute $2 + else + echo "Invalid IP address or host name '$2'" + fi + else + echo "Either enter a valid IPv4 address or configure Domain Name Server to resolve host names" + fi fi |