Re: traceroute

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Tue, 27 Aug 1996 12:13:15 +0200

dinesh@newsnet.com.au (Dinesh Pullat) wrote:

> Wish to know whether I can get the traceroute.tcl to PRINT ONLY THE HOST
> NAMES (from /etc/hosts) instead of IP ADDRESSES?

Which traceroute.tcl file do you refer to (and which scotty version?).
I am assuming for now that you refer to the tnm/examples/traceroute
file of scotty-2.1.1. This script usually tries its best to get a host
name and it only displays an IP address if there is no way to resolve
the host name. However, there is a bug in the 2.1.[0-1] versions (I
changed the dns command and did not update all the scripts). Below is
a fix for this bug. (The same problem exists in a couple of other
scripts - scotty-2.1.2 will have all of them fixed.)

Juergen

*** traceroute.old Tue Jul 16 19:31:38 1996
--- traceroute Tue Aug 27 10:14:38 1996
***************
*** 22,28 ****
set trace_ip [lindex $one 0]
set trace_time [lindex $one 1]
if {[catch {netdb hosts name $trace_ip} name]} {
! if {[catch {dns ptr $trace_ip} name]} {
set name $trace_ip
}
}
--- 22,28 ----
set trace_ip [lindex $one 0]
set trace_time [lindex $one 1]
if {[catch {netdb hosts name $trace_ip} name]} {
! if {[catch {dns name $trace_ip} name]} {
set name $trace_ip
}
}
***************
*** 78,84 ****
set ip $argv
if {![regexp "^\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+$" $ip]} {
if {[catch {netdb hosts address $ip} ip]} {
! if {[catch {dns a $ip}]} {
puts stderr "traceroute: $ip"
exit
}
--- 78,84 ----
set ip $argv
if {![regexp "^\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+$" $ip]} {
if {[catch {netdb hosts address $ip} ip]} {
! if {[catch {dns address $ip}]} {
puts stderr "traceroute: $ip"
exit
}