From: Roger Wolff Date: Tue, 7 May 2002 00:00:00 +0000 (+0000) Subject: mtr v0.50 X-Git-Tag: v0.50^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8e02d99ec9955fb1a44afd76f636396ae75440c;p=thirdparty%2Fmtr.git mtr v0.50 - Make "interface address" option work. Changes to "select" loop to allow window resizes (select interruption) to work. Thanks Mike! source: ftp://ftp.bitwizard.nl/mtr/mtr-0.50.tar.gz --- diff --git a/AUTHORS b/AUTHORS index 8284464..fdd5b58 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,11 +15,13 @@ Bohdan Vlasyuk (bohdan@cec.vstu.vinnica.ua) Juha Takala + evtr@ukr.net (Evgeniy Tretyak) David Sward (sward@clark.net) David Stone (stone@AsIf.com) Andrew Stesin Greg Stark (gsstark@mit.edu) Robert Sparks (rjsparks@nostrum.com) + Mike Simons (msimons@moria.simons-clan.com) Aaron Scarisbrick, Craig Milo Rogers (Rogers@ISI.EDU) Russell Nelson (rn-mtr@crynwr.com) diff --git a/NEWS b/NEWS index c056e81..a0cd695 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ WHAT'S NEW? + v0.50 Make "interface address" option work. + Changes to "select" loop to allow window resizes (select + interruption) to work. Thanks Mike! + v0.49 Fix compilation problems on several platforms. v0.48 Draw names in red (GTK) or bold (Curses) if host doesn't @@ -13,7 +17,7 @@ WHAT'S NEW? v0.45 People are pressuring me to release new versions with their changes. That's fine. Now this version just adds dynamic switching between numeric / dns names, and some minor - stuff I forgot. This release serves as a code-sycn-release. + stuff I forgot. This release serves as a code-sync-release. new version with even more new stuff in about two weeks! I'm afraid I don't know how to fix the MaxOS-X compilation problems in the source. Help wanted... @@ -22,7 +26,7 @@ WHAT'S NEW? v0.43 Compile fixes. - v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack. + v0.41 Added afr's patch to allow disabling of gtk without Robn's hack. Made report mode report the newly added extra resolution. v0.40 Fixed some problems with HPUX and SunOS. diff --git a/TODO b/TODO index 2c2b34d..381e6f9 100644 --- a/TODO +++ b/TODO @@ -73,19 +73,28 @@ Oh, Feel free to provide suggestions for this list. At the moment (march 1999) autoconf 2.13 is still too new to require everyone to upgrade. About a year from now we can put this in.... - - Allow a toggle between hostname/IP number display. (for example a - click on the hostname could revert to ip number display in gtk version. - curses: "n" key toggles hostnames/ipnumbers?) - - Implement rfc2317 mechanism to do reverse lookups for networks that have DNS delegations on non-octet boundaries. -- Daniel Bergstrom (noa@melody.se) + - The longer MTR runs, the less meaningful the packet loss + statistic. Or more meaningful, depending on your point of view. + Perhaps MTR should use a circular buffer of some configurable + number of results, and calculate the loss against that. -- Jacob Elder + + - It would be nice if the window size wasn't fixed. If I'm only 5 + hops from the host I'm monitoring, MTR wastes a lot of screen real + estate. -- Jacob Elder + ------------------------------------------------------------------------ Things that shouldn't be on the TODO list because they're done. ;-) + - Allow a toggle between hostname/IP number display. (for example a + click on the hostname could revert to ip number display in gtk version. + curses: "n" key toggles hostnames/ipnumbers?) + - 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 diff --git a/configure.in b/configure.in index 8bf0f5c..4738aab 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.49) +AM_INIT_AUTOMAKE(mtr, 0.50) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/mtr.c b/mtr.c index fec5bd8..467997d 100644 --- a/mtr.c +++ b/mtr.c @@ -217,6 +217,8 @@ int main(int argc, char **argv) { char dummy; extern int sendsock; /* from net.c:115 */ + bzero(&source, sizeof(source)); /* -- Evgeniy Tretyak */ + source.sin_family = AF_INET; source.sin_port = 0; diff --git a/select.c b/select.c index 4b5e5a7..2620b31 100644 --- a/select.c +++ b/select.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "display.h" #include "dns.h" @@ -48,6 +49,7 @@ void select_loop() { struct timeval lasttime, thistime, selecttime; float wt; int dt; + int rv; NumPing = 0; anyset = 0; @@ -78,50 +80,56 @@ void select_loop() { if(netfd >= maxfd) maxfd = netfd + 1; - if(anyset || paused) { - selecttime.tv_sec = 0; - selecttime.tv_usec = 0; + do { + if(anyset || paused) { + selecttime.tv_sec = 0; + selecttime.tv_usec = 0; - select(maxfd, (void *)&readfd, NULL, NULL, &selecttime); - } else { - if(Interactive) - display_redraw(); - - gettimeofday(&thistime, NULL); - - if(thistime.tv_sec > lasttime.tv_sec + intervaltime.tv_sec || - (thistime.tv_sec == lasttime.tv_sec + intervaltime.tv_sec && - thistime.tv_usec >= lasttime.tv_usec + intervaltime.tv_usec)) { - lasttime = thistime; - if(NumPing >= MaxPing && !Interactive) - break; - if (net_send_batch()) - NumPing++; + rv = select(maxfd, (void *)&readfd, NULL, NULL, &selecttime); + } else { + if(Interactive) + display_redraw(); + + gettimeofday(&thistime, NULL); + + if(thistime.tv_sec > lasttime.tv_sec + intervaltime.tv_sec || + (thistime.tv_sec == lasttime.tv_sec + intervaltime.tv_sec && + thistime.tv_usec >= lasttime.tv_usec + intervaltime.tv_usec)) { + lasttime = thistime; + if(NumPing >= MaxPing && !Interactive) + break; + if (net_send_batch()) + NumPing++; + } + + selecttime.tv_usec = (thistime.tv_usec - lasttime.tv_usec); + selecttime.tv_sec = (thistime.tv_sec - lasttime.tv_sec); + if (selecttime.tv_usec < 0) { + --selecttime.tv_sec; + selecttime.tv_usec += 1000000; + } + selecttime.tv_usec = intervaltime.tv_usec - selecttime.tv_usec; + selecttime.tv_sec = intervaltime.tv_sec - selecttime.tv_sec; + if (selecttime.tv_usec < 0) { + --selecttime.tv_sec; + selecttime.tv_usec += 1000000; + } + + if ((selecttime.tv_sec > (time_t)dnsinterval) || + ((selecttime.tv_sec == (time_t)dnsinterval) && + (selecttime.tv_usec > ((time_t)(dnsinterval * 1000000) % 1000000)))) { + selecttime.tv_sec = (time_t)dnsinterval; + selecttime.tv_usec = (time_t)(dnsinterval * 1000000) % 1000000; + } + + rv = select(maxfd, (void *)&readfd, NULL, NULL, &selecttime); } + } while ((rv < 0) && (errno == EINTR)); - selecttime.tv_usec = (thistime.tv_usec - lasttime.tv_usec); - selecttime.tv_sec = (thistime.tv_sec - lasttime.tv_sec); - if (selecttime.tv_usec < 0) { - --selecttime.tv_sec; - selecttime.tv_usec += 1000000; - } - selecttime.tv_usec = intervaltime.tv_usec - selecttime.tv_usec; - selecttime.tv_sec = intervaltime.tv_sec - selecttime.tv_sec; - if (selecttime.tv_usec < 0) { - --selecttime.tv_sec; - selecttime.tv_usec += 1000000; - } - - if ((selecttime.tv_sec > (time_t)dnsinterval) || - ((selecttime.tv_sec == (time_t)dnsinterval) && - (selecttime.tv_usec > ((time_t)(dnsinterval * 1000000) % 1000000)))) { - selecttime.tv_sec = (time_t)dnsinterval; - selecttime.tv_usec = (time_t)(dnsinterval * 1000000) % 1000000; - } - - select(maxfd, (void *)&readfd, NULL, NULL, &selecttime); + if (rv < 0) { + perror ("Select failed"); + exit (1); } - anyset = 0; /* Handle any pending resolver events */