--- /dev/null
+#!/usr/bin/perl
+
+# Module: VNET+
+# Description: Generate ping packets and count the responses
+# Author: sapanb@cs.princeton.edu
+
+use strict;
+use threads;
+
+#please change to something local
+my $guineapig='planetlab-1.cs.princeton.edu';
+my $numiter=1000;
+
+sub run {
+ system("ping -c $numiter -i 0.1 $guineapig");
+ }
+
+
+sub open_tcpdump {
+ my $filter="icmp and src $guineapig";
+ my $cmdline="/usr/sbin/tcpdump -c $numiter $filter";
+
+ system($cmdline);
+}
+
+sub alhandler {
+ print "[FAILED] tcpdump apparently did not intercept all SYN/ACK packets\n";
+ exit(-1);
+}
+
+print "Starting tcpdump...\n";
+my $tcpdthr=threads->create(\&open_tcpdump);
+sleep 10;
+print "Generating connections...\n";
+run;
+$SIG{ALRM}=\&alhandler;
+alarm(60);
+
+$tcpdthr->join;
+print "[SUCCESS] Test completed OK.\n";
#!/usr/bin/perl
-# Generate a ton of connections and check if we can see syn/ack packets via tcpdump
+# Module: VNET+
+# Description: Trace the route path to a node using two methods: TCP-related ICMP errors, and TTL expiry.
+# Then match the two paths to see that they concord. If there's a slight difference, it's probably OK given that
+# some routers might support one type of error but not the other, and that the routes are not guaranteed to be the
+# same.
+# Dependencies: tcptraceroute, traceroute, which
+# Author: sapanb@cs.princeton.edu
+
+$|=1;
+
+# ********************************************************************************
+# CONFIGURATION
+
+
+# The node that we're going to trace route. It's probably a good idea to change it
+# periodically so that we don't harass the same host.
my $guineapig="vini-veritas.net";
-my $ttraceroute="/usr/sbin/tcptraceroute";
-my $traceroute="/usr/sbin/tracepath";
+
+# Location of traceroute, tcptraceroute
+my $ttraceroute=`which tcptraceroute 2>/dev/null`;
+my $traceroute=`which traceroute 2>/dev/null`;
+
+chop($ttraceroute);
+chop($traceroute);
+
+if ($traceroute !~ /^\//) {
+ $traceroute=`which tracepath 2>/dev/null`;
+ chop($traceroute);
+}
+
+if (!-e "$ttraceroute") {
+ print $ttraceroute."\n";
+ die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
+}
+else {
+ print "Found rcptraceroute. Good.\n";
+}
+
+if ($traceroute !~ /^\//) {
+ die("[FAILED] Please install traceroute in the slice before running this test\n");
+}
+
+my %hash;
sub open_tcptraceroute {
- if (!-e "$ttraceroute") {
- die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
- }
my $cmdline="$ttraceroute $guineapig";
my $out='';
- my %result;
open TT,"$cmdline|";
while (<TT>) {
if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
- $result{$1}=$result{$1}+1;
+ glob %hash;
+ print ">>> $_";
+ $hash{$1}++;
}
}
- return %result;
-
}
sub open_traceroute {
- if (!-e "$traceroute") {
- die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
- }
my $ref=shift;
my $cmdline="$traceroute $guineapig";
my $out='';
- my %result=%$ref;;
+ print $cmdline."\n";
open TT,"$cmdline|";
while (<TT>) {
if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
- $result{$1}=$results{$1}+1;
+ glob %hash;
+ print ">>> $_";
+ $hash{$1}=$hash{$1}+1;
}
}
- return %result;
-
}
sub compare {
my $ref=shift;
- my %a1=%$ref;
my $ret=1;
my $double=0;
my $single=0;
- foreach (keys %a1) {
- print "$_->".$a1{$_}."\n";
- if ($a1{$_}==1) {
- print "Single: $_\n";
+ glob %hash;
+ foreach (keys %hash) {
+ if ($hash{$_}==1) {
$single++;
- } elsif ($a1{$_}==2) {
- print "Double: $_\n";
+ } elsif ($hash{$_}==2) {
+ print "Concorded on $_\n";
$double++;
}
- else { die ("bug in test script");}
+ else { die ("[FAILED] Could not complete test.\n");}
}
return ($single,$double);
}
sub alhandler {
- print "[FAILED] Timed out waiting\n";
+ print "[FAILED] Timed out waiting.\n";
exit(-1);
}
my $s;
my $d;
- %r1=open_tcptraceroute;
- %r1=open_traceroute %r1;
- ($s,$d)=compare(\%r1);
+ open_tcptraceroute;
+ open_traceroute;
+ ($s,$d)=compare;
if ($s==0 && $d>2) {
print "[SUCCESS] traceroute and tcptraceroute reported the same result. $d hops.\n";
exit(0);