]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
some running patches
authorR.E. Wolff <R.E.Wolff@BitWizard.nl>
Tue, 5 Feb 2013 12:42:37 +0000 (13:42 +0100)
committerTravis Cross <tc@traviscross.com>
Tue, 5 Feb 2013 13:09:21 +0000 (13:09 +0000)
FORMATS
curses.c
mtr.8
mtr.c
net.c
report.c

diff --git a/FORMATS b/FORMATS
index 5404e87a70edeb4f06ed0b7da38ec34c1b6e8eac..7cddb55975c079fd41a91ac73e7e41f29fefe990 100644 (file)
--- a/FORMATS
+++ b/FORMATS
@@ -29,3 +29,72 @@ t <pos> <pingtime> <timestamp>
 Timestampline is not  yet implemented. Need to find out how to do
 ICMP timestamping first. :-)
 
+
+Someone suggested to put the following text here. As to context: Some
+people are wondering why mtr sometimes reports hosts beyond the
+destination host. 
+
+
+The FINAL host will occasionally be mentioned at position n, n+1, n+2
+etc.
+
+You know traceroute, right? It sends a packet, waits for the reply to
+come back and when it comes back, it sends the next packet.
+
+If say hosts 5-8 do not send "time exceeded" packets, you'll wait a
+4*3 = twelve seconds extra before you get any results on hosts 9 and
+further. MTR doesn't work like that.
+
+In theory we could send out a probe for host 1-40 all at once. But
+this would pose an unnecessary burden on the network. So what we do,
+is we send out probes for a max of 5 hosts beyond where we've seen a
+reply. So in the example above, we'd see a reply from router at
+position 4, then we'd send out 5-9 (and because the max-host is now at
+9, we'll send them out at 1s/9 = 111ms intervals). When the reply from
+host 9 comes back, we'll start probing for host 10-15 (at about 60ms
+intervals). But suppose the network delay upto host 9 is already 200ms
+and suppose our destination host is at position 11. Then by the time
+the packet from host 11 comes back, we'll already have sent probe
+packets for position 12, 13, and 14! Those will come back as
+"destination reached" and be reported by the "raw" mode.
+
+Curses mode will stop showing hosts with position numbers beyond the
+first reply of the destination host. It could gather the information
+about replies to packets sent as probes FURTHER than it actually is
+into the line displayed at its true position, but it doesn't (yet).
+
+In fact the above example is almost completely true:
+
+% mtr -r -n -c 2 152.179.99.218 | tail -5
+ 13.|-- 144.232.18.238 0.0% 2 94.8 95.4 94.8 96.0 0.8
+ 14.|-- 152.63.16.182 0.0% 2 95.1 95.5 95.1 95.8 0.5
+ 15.|-- 152.63.64.106 0.0% 2 163.9 163.9 163.9 164.0 0.1
+ 16.|-- 152.63.50.89 50.0% 2 163.7 163.7 163.7 163.7 0.0
+ 17.|-- 152.179.99.218 50.0% 2 168.2 168.2 168.2 168.2 0.0
+% mtr -l -c 2 152.179.99.218 | grep -v "^[dp]" |tail -7
+h 10 144.232.1.41
+h 11 144.232.4.96
+h 16 152.179.99.218
+h 17 152.179.99.218
+h 18 152.179.99.218
+h 12 144.232.18.238
+h 13 152.63.16.182
+
+As you can see we get the reply from the destination host at position
+16 AFTER we've sent probes for position 17 and 18. When those come
+back, they are reported. That's what raw mode does. It reports the raw
+information.
+
+If you write a backend for the raw mode, it's up to you to
+filter/display the results.
+
+h 10 144.232.1.41
+h 11 144.232.4.96
+h 12 144.232.18.238
+h 13 152.63.16.182
+h 14 152.63.64.106
+h 15 152.63.50.89
+h 16 152.179.99.218
+h 17 152.179.99.218
+h 18 152.179.99.218
+
index 86f8785c0107b0ae0b725335fa990ad93fc4ef03..ed3b33dfac7f4f2ba3bb839a127d23742ecf52ca 100644 (file)
--- a/curses.c
+++ b/curses.c
@@ -266,9 +266,11 @@ int mtr_curses_keyaction(void)
   if (tolower(c) == '?'|| tolower(c) == 'h') {
     mvprintw(2, 0, "Command:\n" );
     printw("  ?|h     help\n" );
+    printw("  p       pause (SPACE to resume)\n" );
     printw("  d       switching display mode\n" );
     printw("  e       toggle MPLS information on/off\n" );
     printw("  n       toggle DNS on/off\n" );
+    printw("  r       reset all counters\n" );
     printw("  o str   set the columns to display, default str='LRS N BAWV'\n" );
     printw("  j       toggle latency(LS NABWV)/jitter(DR AGJMXI) stats\n" );
     printw("  c <n>   report cycle n, default n=infinite\n" );
diff --git a/mtr.8 b/mtr.8
index e78f3065be59e1b31228d9394fdc2ba788ccbcfc..8c26210e22f9bf8de90e0a874e10a7df1c6a513d 100644 (file)
--- a/mtr.8
+++ b/mtr.8
@@ -74,16 +74,20 @@ starts, it investigates the network connection between the host
 .B mtr
 runs on and 
 .BR HOSTNAME . 
-by sending packets with purposly low TTLs. It continues to send
+by sending packets with purposely low TTLs. It continues to send
 packets with low TTL, noting the response time of the intervening
 routers.  This allows 
 .B mtr 
 to print the response percentage and response times of the internet
 route to 
 .BR HOSTNAME . 
-A sudden increase in packetloss or response time is often an indication
+A sudden increase in packet loss or response time is often an indication
 of a bad (or simply overloaded) link. 
 
+.PP
+The results are usually reported as round-trip-response times in miliseconds 
+and the percentage of packetloss. 
+
 .SH OPTIONS
 
 .TP
@@ -151,12 +155,12 @@ those machines.  Each cycle lasts one second.
 .B \-\-psize\ BYTES
 .TP
 .B PACKETSIZE
-These options or a trailing PACKETSIZE on the commandline sets 
+These options or a trailing PACKETSIZE on the command line sets 
 the packet size used for probing.
 It is in bytes inclusive IP and ICMP headers
 
 If set to a negative number, every iteration will use a different, random
-packetsize upto that number. 
+packet size upto that number. 
 .TP
 .B \-t
 .TP
@@ -204,9 +208,29 @@ this adds an extra field to the output.
 .br
 Use this option to specify the fields and their order when loading mtr.
 .br
+Available fields:
+.TS
+center allbox tab(%);
+ll.
+L%Loss ratio
+D%Dropped packets
+R%Received packets
+S%Sent Packets
+N%Newest RTT(ms)
+B%Min/Best RTT(ms)
+A%Average RTT(ms)
+W%Max/Worst RTT(ms)
+V%Standard Deviation
+G%Geometric Mean
+J%Current Jitter
+M%Jitter Mean/Avg.
+X%Worst Jitter
+I%Interarrival Jitter
+.TE
+.br
+
 Example:
 -o "LSD NBAW"
-
 .TP
 .B \-g
 .TP
@@ -218,7 +242,7 @@ to use the GTK+ based X11 window interface (if available).
 GTK+ must have been available on the system when 
 .B mtr 
 was built for this to work.  See the GTK+ web page at 
-.B http://www.gimp.org/gtk/
+.B http://www.gtk.org/
 for more information about GTK+.
 
 .TP
@@ -291,20 +315,14 @@ For the latest version, see the mtr web page at
 .BR http://www.bitwizard.nl/mtr/ .
 
 .PP
-Subscribe to the mtr mailing list.  All mtr related announcements
-are posted to the mtr mailing list.  To subscribe, send email to
-.B majordomo@lists.xmission.com
-with 
-.B subscribe\ mtr
-in the body of the message.  To send a message to the mailing list, mail to 
-.BR mtr@lists.xmission.com .
+The mtr mailinglist was little used and is no longer active. 
 
 .PP
-Bug reports and feature requests should be sent to the mtr
-mailing list.
-
+Bug reports and feature requests should be submitted to the
+launchpad mtr bugtracker. 
 
 .SH "SEE ALSO"
 
 traceroute(8),
-ping(8).
+ping(8)
+TCP/IP Illustrated (Stevens, ISBN 0201633469).
diff --git a/mtr.c b/mtr.c
index 42dfc13da8500021c9dfa800629f25032aadaa4c..fa304d753dc66232d62e2b11f52eea4c7540818c 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -215,8 +215,10 @@ void parse_arg (int argc, char **argv)
        fprintf (stderr, "mtr: wait time must be positive\n");
        exit (1);
       }
-      if (getuid() != 0 && WaitTime < 1.0)
-       WaitTime = 1.0;
+      if (getuid() != 0 && WaitTime < 1.0) {
+        fprintf (stderr, "non-root users cannot request an interval < 1.0 seconds\r\n");
+       exit (1);
+      }
       break;
     case 'f':
       fstTTL = atoi (optarg);
diff --git a/net.c b/net.c
index 0487af4555fa1e9a7e831a8b794225649132e7d9..431ad1e37159f60e7090bedaff5c730c2738280b 100644 (file)
--- a/net.c
+++ b/net.c
@@ -526,7 +526,7 @@ void net_process_ping(int seq, struct mplslen mpls, void * addr, struct timeval
   /* begin addByMin do more stats */
   oldavg = host[index].avg;
   host[index].avg += (totusec - oldavg +.0) / host[index].returned;
-  host[index].var += (totusec - oldavg +.0) * (totusec - host[index].avg);
+  host[index].var += (totusec - oldavg +.0) * (totusec - host[index].avg) / 1000000;
 
   oldjavg = host[index].javg;
   host[index].javg += (host[index].jitter - oldjavg) / host[index].returned;
@@ -771,7 +771,7 @@ int net_gmean(int at)
 int net_stdev(int at) 
 {
   if( host[at].returned > 1 ) {
-    return ( sqrt( host[at].var/(host[at].returned -1.0) ) );
+    return ( 1000.0 * sqrt( host[at].var/(host[at].returned -1.0) ) );
   } else {
     return( 0 );
   }
index 368dc2bfae892b380c83e45e0ff150f2a41067f4..6a8baec15482b3b695894b0e4f448736eb647780 100644 (file)
--- a/report.c
+++ b/report.c
@@ -24,6 +24,7 @@
 #include <sys/socket.h>
 #include <string.h>
 #include <strings.h>
+#include <time.h>
 
 #include "mtr.h"
 #include "report.h"
@@ -45,8 +46,19 @@ extern int af;
 extern int reportwide;
 
 
-void report_open(void) 
+char *get_time_string (void) 
 {
+  time_t now; 
+  char *t;
+  now = time (NULL);
+  t = ctime (&now);
+  t [ strlen (t) -1] = 0; // remove the trailing newline
+  return t;
+}
+
+void report_open(void)
+{
+  printf ("Start: %s\n", get_time_string ());
 }
 
 static size_t snprint_addr(char *dst, size_t dst_len, ip_t *addr)