From: Roger Wolff Date: Wed, 9 Jun 1999 00:00:00 +0000 (+0000) Subject: mtr v0.38 X-Git-Tag: v0.38^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dd176040b515bf46f3a3f02ffa8eeb3f64c7c8d;p=thirdparty%2Fmtr.git mtr v0.38 - Fixed some dubious code in dns.c (noted by someone's lint) source: ftp://ftp.bitwizard.nl/mtr/mtr-0.38.tar.gz --- diff --git a/AUTHORS b/AUTHORS index b3b3a67..23623b4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -17,10 +17,10 @@ Andrew Stesin, Aaron Scarisbrick, Craig Milo Rogers (Rogers@ISI.EDU), - Russell Nelson, - Alexander V. Lukyanov, - Charles Levert, - Bertrand Leconte, + Russell Nelson (rn-mtr@crynwr.com), + Alexander V. Lukyanov (lav@yars.free.net), + Charles Levert (charles@comm.polymtl.ca), + Bertrand Leconte (B.Leconte@mail.dotcom.fr), Anand Kumria, Adam Kramer (l3zqc@qcunix1.acc.qc.edu), Philip Kizer (pckizer@nostrum.com), @@ -31,7 +31,7 @@ Brian Casey, Bill Bogstad (bogstad@pobox.com), Moritz Barsnick (barsnick@gmx.net) - R??? Sparks (rjsparks@nostrum.com) + Robert Sparks (rjsparks@nostrum.com) and anyone who has slipped through the cracks of my mail file. diff --git a/TODO b/TODO index e7374f6..ef55752 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,8 @@ - Allow mtr to log the return packets, for later analysis. Done: 0.25 . Todo: allow the userinterface(s) to work while - still logging to a file. + still logging to a file. Write a "logfile displaying" mode to + mtr. - Request timestamping at the remote site. Andreas Fasbender has an algorithm that will allow us to @@ -31,11 +32,14 @@ - Bugs to fix? - Do something useful if host couldn't be resolved. + -- Done. - Revert to curses mode even if DISPLAY is set, but a problem prevents us from running in X11 mode. --> The problem is that gtk_init simply calls exit for us if it finds a problem. Tricky! Suggestions welcome. + --> Call "gtk_check_init" when available. (i.e. new enough + (1.2?) GTK version). - Nice to have: @@ -44,9 +48,6 @@ - Show state ("looking up host") while doing the DNS lookup for a new host. - - Check why it still tries to go for X11 display if DISPLAY is unset. - (I saw code to handle this) - - Read environment variable "MTR_DEFAULTS" as a commandline before parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.) @@ -59,4 +60,8 @@ 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? + diff --git a/configure.in b/configure.in index 6033665..820f854 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.37) +AM_INIT_AUTOMAKE(mtr, 0.38) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/curses.c b/curses.c index effc12e..82c6628 100644 --- a/curses.c +++ b/curses.c @@ -238,11 +238,10 @@ void mtr_curses_redraw() { move(0, 0); pwcenter("Matt's traceroute [v" VERSION "]"); printw("\n"); + attroff(A_BOLD); printw(LocalHostname); - move(1, maxx - 24); time(&t); - printw(ctime(&t)); - attroff(A_BOLD); + mvprintw(1, maxx-25, ctime(&t)); printw("Keys: "); attron(A_BOLD); printw("D"); attroff(A_BOLD); diff --git a/dns.c b/dns.c index 11143c4..a99d8df 100644 --- a/dns.c +++ b/dns.c @@ -208,10 +208,25 @@ typedef struct { #define getheader_pr(x) ((x->databyte_b >> 6) & 1) #define getheader_ra(x) (x->databyte_b >> 7) +#if 0 + +/* The execution order inside an expression is undefined! That means that + this might work, but then again, it might not... Sun Lint pointed this + one out...*/ + #define sucknetword(x) (((word)*(x) << 8) | (((x)+= 2)[-1])) #define sucknetshort(x) (((short)*(x) << 8) | (((x)+= 2)[-1])) #define sucknetdword(x) (((dword)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1])) #define sucknetlong(x) (((long)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1])) +#else + +#define sucknetword(x) ((word) (((x)[0] << 8) | ((x)[1] << 0))),(x)+=2 +#define sucknetshort(x) ((short) (((x)[0] << 8) | ((x)[1] << 0))),(x)+=2 +#define sucknetdword(x) ((dword) (((x)[0] << 24) | ((x)[1] << 16) | \ + ((x)[2] << 8) | ((x)[3] << 0))),(x)+=4 +#define sucknetlong(x) ((long) (((x)[0] << 24) | ((x)[1] << 16) | \ + ((x)[2] << 8) | ((x)[3] << 0))),(x)+=4 +#endif enum { STATE_FINISHED, @@ -736,7 +751,7 @@ void restell(char *s){ void dorequest(char *s,int type,word id){ packetheader *hp; int r,i; - byte buf[MaxPacketsize+1]; + int buf[(MaxPacketsize/4)+1]; r = res_mkquery(QUERY,s,C_IN,type,NULL,0,NULL,buf,MaxPacketsize); if (r == -1){ restell("Resolver error: Query too large."); diff --git a/gtk.c b/gtk.c index bc9fcd3..925b025 100644 --- a/gtk.c +++ b/gtk.c @@ -165,8 +165,10 @@ void Toolbar_fill(GtkWidget *Toolbar) { GTK_SIGNAL_FUNC(Pause_clicked), NULL); gtk_widget_show(Pause_Button); + /* allow root only to set zero delay */ Adjustment = (GtkAdjustment *)gtk_adjustment_new(WaitTime, - 0.00, 999.99, + getuid()==0 ? 0.00:1.00, + 999.99, 1.0, 10.0, 0.0); Button = gtk_spin_button_new(Adjustment, 0.5, 2); diff --git a/mtr.c b/mtr.c index a561fb8..9335e2c 100644 --- a/mtr.c +++ b/mtr.c @@ -96,6 +96,8 @@ 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; break; } } @@ -131,10 +133,6 @@ void parse_mtr_options (char *string) } - - - - int main(int argc, char **argv) { int traddr; struct hostent *host; diff --git a/net.c b/net.c index 79bfce3..b4f35a0 100644 --- a/net.c +++ b/net.c @@ -326,7 +326,7 @@ int net_max() { int max; max = 0; - for(at = 0; at < MaxHost; at++) { + for(at = 0; at < MaxHost-2; at++) { if(host[at].addr == remoteaddress.sin_addr.s_addr) { return at + 1; } else if(host[at].addr != 0) { @@ -374,7 +374,8 @@ int net_send_batch() { } if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) || - (n_unknown > MAX_UNKNOWN_HOSTS)) { + (n_unknown > MAX_UNKNOWN_HOSTS) || + (batch_at >= MaxHost-2)) { numhosts = batch_at+1; batch_at = 0; return 1;