From 8f0746e26aba3cbe61897083bc7e972391bb643f Mon Sep 17 00:00:00 2001 From: Roger Wolff Date: Sun, 18 Oct 1998 00:00:00 +0000 Subject: [PATCH] mtr v0.22 - Roger has take over maintenance. - mtr now uses an "int" to pass options to the kernel. - Makes things work on Solaris and *BSD I'm told. - mtr doesn't fire off a flurry of packets when a new second comes around. Instead they are spaced evenly around the whole second. This allows people with a relatively slow first link to do meaningful measurements of whatever is behind that. source: ftp://ftp.bitwizard.nl/mtr/mtr-0.22.tar.gz --- AUTHORS | 4 ++++ NEWS | 10 ++++++++++ README | 4 +++- SECURITY | 2 +- TODO | 23 +++++++++++++++++++++++ configure.in | 2 +- curses.c | 2 +- mtr.8 | 2 +- net.c | 47 ++++++++++++++++++++++++++++++++--------------- select.c | 10 +++++++--- 10 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 TODO diff --git a/AUTHORS b/AUTHORS index c3ecbfa..a52bb4c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,9 @@ + Matt Kimball is the primary author of mtr. + Roger Wolff is currently maintaing mtr. + + Bug reports and feature requests should be sent to the mtr mailing list. See the README file for details. diff --git a/NEWS b/NEWS index 08886b9..2e58556 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,15 @@ WHAT'S NEW? + v0.22 + Roger has take over maintenance. + mtr now uses an "int" to pass options to the kernel. + Makes things work on Solaris and *BSD I'm told. + mtr doesn't fire off a flurry of packets when a new + second comes around. Instead they are spaced evenly + around the whole second. This allows people with a + relatively slow first link to do meaningful measurements + of whatever is behind that. + v0.21 mtr now drops root permissions after it acquires the raw sockets it needs. diff --git a/README b/README index 42d7c52..2cae3f6 100644 --- a/README +++ b/README @@ -32,7 +32,8 @@ INSTALLING WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION? - See the mtr web page at 'http://www.mkimball.org/mtr.html'. + See the mtr web page at + http://www.BitWizard.nl/mtr/ Subscribe to the mtr mailing list. All mtr related announcements are posted to the mtr mailing list. To subscribe, send email to @@ -42,3 +43,4 @@ WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION? Bug reports and feature requests should be sent to the mtr mailing list. + diff --git a/SECURITY b/SECURITY index d81a954..a6b48dd 100644 --- a/SECURITY +++ b/SECURITY @@ -21,7 +21,7 @@ from or write to any system files which they wouldn't normally have permission to write to. The only priveledge gained is access to the raw socket descriptors, which would allow the malicious user to listen to all ICMP packets arriving at the system, and send forged packets -with arbitrary ncontents. +with arbitrary contents. If you have further questions or comments about security issues, please direct them to the mtr mailing list. See README for details. diff --git a/TODO b/TODO new file mode 100644 index 0000000..8e45c3c --- /dev/null +++ b/TODO @@ -0,0 +1,23 @@ + +- Stuff to implement: + + - Allow mtr to log the return packets, for later analysis. + + - Request timestamping at the remote site. + Andreas Fasbender has an algorithm that will allow us to + convert these measurements into one-way measurements, not just + round-trip. + + - Allow mtr to also send larger packets. + This will enable us to get a feel for the speed of the links + we're traversing. (Van Jacobson was working on this His tool + was slow, mtr will rock with this feature.... :-) + (Anybody have the statistics experience to tell me how + to do the data analysis?) + + - Allow MTR to keep on getting the icmp host unreachables, and + work through that. Some hosts don't answer PINGs. + +- Bugs to fix? + - ? + diff --git a/configure.in b/configure.in index 482bd5e..7787504 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.21) +AM_INIT_AUTOMAKE(mtr, 0.22) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/curses.c b/curses.c index f49da44..4932e6f 100644 --- a/curses.c +++ b/curses.c @@ -92,7 +92,7 @@ void mtr_curses_hosts(int startstat) { getyx(stdscr, y, x); move(y, startstat); - printw(" %3d%% %4d%4d %5d%5d%7d", + printw(" %3d%% %3d %3d %4d %4d %6d", net_percent(at), net_returned(at), net_xmit(at), net_best(at), net_avg(at), net_worst(at)); diff --git a/mtr.8 b/mtr.8 index 616cfd7..ae2e2ae 100644 --- a/mtr.8 +++ b/mtr.8 @@ -153,7 +153,7 @@ these routers. .PP For the latest version, see the mtr web page at -.BR http://www.mkimball.org/mtr.html . +.BR http://www.bitwizard.nl/mtr/ . .PP Subscribe to the mtr mailing list. All mtr related announcements diff --git a/net.c b/net.c index 1dc7372..1769a41 100644 --- a/net.c +++ b/net.c @@ -342,26 +342,40 @@ void net_end_transit() { } } + +extern float WaitTime; +extern struct timeval intervaltime; +#include +#include + void net_send_batch() { - int at; - int n_unknown = 10; + static int n_unknown = 10; + static int at; - for(at = 0;n_unknown && (at < MaxHost); at++) { - if(host[at].addr == 0) { - net_send_query(at + 1); - n_unknown--; - } else { - net_send_ping(at); - } - - if(host[at].addr == remoteaddress.sin_addr.s_addr) { - break; - } + if(host[at].addr == 0) { + net_send_query(at + 1); + n_unknown--; + } else { + net_send_ping(at); } + + if ((host[at].addr == remoteaddress.sin_addr.s_addr) || + (n_unknown == 0)) { + float wt = WaitTime / (float) at; + + intervaltime.tv_sec = (int)(wt); + intervaltime.tv_usec = 1000000.0 * (wt - floor(wt)); + at = 0; + n_unknown = 10; + return; + } + + at++; } + int net_preopen() { - char trueopt = 1; + int trueopt = 1; sendsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if(sendsock == -1) @@ -370,8 +384,11 @@ int net_preopen() { #ifdef IP_HDRINCL /* FreeBSD wants this to avoid sending out packets with protocol type RAW to the network. */ - if(setsockopt(sendsock, 0, IP_HDRINCL, &trueopt, sizeof(trueopt))) + if(setsockopt(sendsock, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt))) + { + perror("setsockopt(IP_HDRINCL,1)"); return -1; + } #endif recvsock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); diff --git a/select.c b/select.c index f68df52..bf269c0 100644 --- a/select.c +++ b/select.c @@ -34,19 +34,23 @@ extern int MaxPing; extern float WaitTime; double dnsinterval; +struct timeval intervaltime; + void select_loop() { fd_set readfd; int anyset; int action, maxfd; int dnsfd, netfd; int NumPing; - struct timeval lasttime, thistime, selecttime, intervaltime; + struct timeval lasttime, thistime, selecttime; + float wt; NumPing = 0; anyset = 0; gettimeofday(&lasttime, NULL); - intervaltime.tv_sec = (int)WaitTime; - intervaltime.tv_usec = 1000000.0 * (WaitTime - floor(WaitTime)); + wt = WaitTime/10; + intervaltime.tv_sec = (int)wt; + intervaltime.tv_usec = 1000000.0 * (wt - floor(wt)); while(1) { FD_ZERO(&readfd);