summaryrefslogtreecommitdiff
path: root/templates/traceroute
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-06-23 17:56:44 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-06-23 17:56:44 +0000
commit4a9dadf356a83ee0270d3848c506d1ca969d2565 (patch)
tree9cc15906af28cc36d1751726db95b0b893ca2b71 /templates/traceroute
parent7a93bacf5b49f599ffedd11c10d8d156e2c85111 (diff)
downloadvyatta-op-4a9dadf356a83ee0270d3848c506d1ca969d2565.tar.gz
vyatta-op-4a9dadf356a83ee0270d3848c506d1ca969d2565.zip
Fix Bug 2871 Internal errors reported with traceroute
use host command to resolve only if input is not a valid IP address also, if name server not configured, prompt user and ask to only enter valid IPv4 address
Diffstat (limited to 'templates/traceroute')
-rw-r--r--templates/traceroute/node.tag/node.def22
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