4 # Description: Trace the route path to a node using two methods: TCP-related ICMP errors, and TTL expiry.
5 # Then match the two paths to see that they concord. If there's a slight difference, it's probably OK given that
6 # some routers might support one type of error but not the other, and that the routes are not guaranteed to be the
8 # Dependencies: tcptraceroute, traceroute, which
9 # Author: sapanb@cs.princeton.edu
13 # ********************************************************************************
17 # The node that we're going to trace route. It's probably a good idea to change it
18 # periodically so that we don't harass the same host.
19 my $guineapig="vini-veritas.net";
21 # Location of traceroute, tcptraceroute
22 my $ttraceroute=`which tcptraceroute 2>/dev/null`;
23 my $traceroute=`which traceroute 2>/dev/null`;
28 if ($traceroute !~ /^\//) {
29 $traceroute=`which tracepath 2>/dev/null`;
33 if (!-e "$ttraceroute") {
34 print $ttraceroute."\n";
35 die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
38 print "Found rcptraceroute. Good.\n";
41 if ($traceroute !~ /^\//) {
42 die("[FAILED] Please install traceroute in the slice before running this test\n");
47 sub open_tcptraceroute {
48 my $cmdline="$ttraceroute $guineapig";
53 if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
61 my $cmdline="$traceroute $guineapig";
67 if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
68 if ($ref->{$1}) {print $ref->{$1};}
69 $hash{$1}=$hash{$1}+1;
70 if ($ref->{$1}) {print $ref->{$1};}
80 foreach (keys %hash) {
81 print "$_->".$a1{$_}."\n";
84 } elsif ($hash{$_}==2) {
85 print "Concorded on $_\n";
88 else { die ("[FAILED] bug in test script (sorry!).\n");}
91 return ($single,$double);
95 print "[FAILED] Timed out waiting.\n";
99 print "Starting tcptraceroute...\n";
109 print "[SUCCESS] traceroute and tcptraceroute reported the same result. $d hops.\n";
113 print "[PARTIAL SUCCESS] traceroute and tcptraceroute reported $s different hops out of $d.\n";
116 print "[FAILED] traceroute and tcptraceroute reported different results\n";
120 print "Generating connections...\n";
121 $SIG{ALRM}=\&alhandler;