WHAT'S NEW?
+ v0.72 Fix signed/unsigned bug in IPV6 part
+ improved random packet size behaviour. --REW
+ v0.71 Some IPV6 fixes, introduce packet size cmdline option.
+ (was already present as a cmdline argument)
v0.70 Antinio submitted a cumulative patch containing some
nice improvements. He also submitted an automake patch
that causes mtr to no longer compile on my system. I
- Show state ("looking up host") while doing the DNS lookup for a new
host.
- - Read environment variable "MTR_DEFAULTS" as a commandline before
- parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.)
+ - to have a choice of icmp, tcp, and udp pings. -- Matt Martini
- Autoconf 2.13 has a neat function that can be used to find the
res_init function:
hops from the host I'm monitoring, MTR wastes a lot of screen real
estate. -- Jacob Elder
+ - Colors in the curses version. -- Amix
+
+ - If we run a mtr to monitor a connection it would be nice if the time at
+ which mtr was started is print somewhere. -- Sebastian Ganschow
+
+
------------------------------------------------------------------------
slowly (relative to the RTT time to the end host), it can probe
all hosts in the first "round".
-- DONE.
+
+ - Read environment variable "MTR_DEFAULTS" as a commandline before
+ parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.)
+
AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.72)
+AM_INIT_AUTOMAKE(mtr, 0.73)
AC_SUBST(GTK_OBJ)
AC_CHECK_LIB(bind, res_mkquery, ,
AC_CHECK_LIB(resolv, res_mkquery, ,
AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
-LIBS="$LIBS -lresolv"
+# This next line would override the just detected-or-not -lresolv.
+# This apparently hurts BSD. And it's bad practise. So it should go.
+# However, it probably didn't get added for nothing..... Holler if
+# removing it hurts your OS.... -- REW
+#LIBS="$LIBS -lresolv"
AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR))
AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6])
fi])
+AC_CHECK_DECLS(errno, , , [[
+#include <errno.h>
+#include <sys/errno.h>
+]] )
+
+AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[
+#include <netinet/in.h>
+]])
+
+AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[
+#include <netinet/in.h>
+]])
+
dnl Add C flags to display more warnings
AC_MSG_CHECKING(for C flags to get more warnings)
ac_save_CFLAGS="$CFLAGS"
#include <config.h>
#include <strings.h>
+#include <unistd.h>
#ifndef NO_CURSES
#include <ctype.h>
{
int c = getch();
int i=0;
+ float f = 0.0;
char buf[MAXFLD+1];
if(c == 'q')
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
- i = atoi( buf );
- if ( i < 1 ) return ActionNone;
- WaitTime = (float) i;
+ f = atof( buf );
+
+ if (f <= 0.0) return ActionNone;
+ if (getuid() != 0 && f < 1.0)
+ return ActionNone;
+ WaitTime = f;
return ActionNone;
}
#include <netinet/in.h>
+/* Don't put a trailing comma in enumeration lists. Some compilers
+ (notably the one on Irix 5.2) do not like that. -- REW */
enum { ActionNone, ActionQuit, ActionReset, ActionDisplay,
ActionClear, ActionPause, ActionResume, ActionDNS,
- ActionScrollDown, ActionScrollUp, };
+ ActionScrollDown, ActionScrollUp };
enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit,
DisplayRaw, DisplayXML, DisplayCSV, DisplayTXT};
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#define BIND_8_COMPAT
#include <arpa/nameser.h>
#include <netdb.h>
#include <resolv.h>
#define strerror(errno) (((errno) >= 0 && (errno) < sys_nerr) ? sys_errlist[errno] : "unlisted error")
#endif
+#if !HAVE_DECL_ERRNO
/* Hmm, it seems Irix requires this */
extern int errno;
+#endif
extern int af;
"Resource reference",
};
+
+/* Please don't use a trailing comma in enumerations: It doesn't
+ work on all compilers -- REW */
enum {
RR_UNKNOWN,
RR_QUERY,
RR_ANSWER,
RR_AUTHORITY,
- RR_RESOURCE,
+ RR_RESOURCE
};
typedef struct {
STATE_FAILED,
STATE_PTRREQ1,
STATE_PTRREQ2,
- STATE_PTRREQ3,
+ STATE_PTRREQ3
};
#define Is_PTR(x) ((x->state == STATE_PTRREQ1) || (x->state == STATE_PTRREQ2) || (x->state == STATE_PTRREQ3))
}
-//void gtk_set_field_num(GtkCList *List, int row, int ix, char *format, int num) {
-// changed int to dobule byMin
+/* void gtk_set_field_num(GtkCList *List, int row, int ix, char *format, int num) {
+ changed int to dobule byMin */
void gtk_set_field_num(GtkCList *List, int row, int ix, char *format, double num)
{
char str[32];
void gtk_redraw(void)
{
- int at = net_min(); // changed from 0 to net_min for TTL stuff byMin
+ int at = net_min(); /* changed from 0 to net_min for TTL stuff byMin */
int max = net_max();
gtk_clist_freeze(GTK_CLIST(ReportBody));
- while(GTK_CLIST(ReportBody)->rows < max -at) { // byMin
+ while(GTK_CLIST(ReportBody)->rows < max -at) { /* byMin */
gtk_clist_append(GTK_CLIST(ReportBody), Report_Text);
}
gtk_clist_remove(GTK_CLIST(ReportBody), GTK_CLIST(ReportBody)->rows - 1);
}
- // for(at=0; at < max; at++) { // replaced byMin
+ /* for(at=0; at < max; at++) { replaced byMin */
for(; at < max; at++) {
gtk_update_row(GTK_CLIST(ReportBody), at);
}
--- /dev/null
+#include <stdio.h>
+
+typedef int socklen_t;
+
+socklen_t main (int argc, char **argv)
+{
+ printf ("hello world. \n");
+ return 2;
+}
to display numeric IP numbers and not try to resolve the
host names.
+.TP
+.B \-o\ fields\ order
+.TP
+.B \-\-order\ fields\ order
+.br
+Use this option to specify the fields and their order when loading mtr.
+.br
+Example:
+-o "LSD NBAW"
+
.TP
.B \-g
.TP
/* begin ttl windows addByMin */
int fstTTL = 1; /* default start at first hop */
-//int maxTTL = MaxHost-1; /* max you can go is 255 hops */
+/*int maxTTL = MaxHost-1; */ /* max you can go is 255 hops */
int maxTTL = 30; /* inline with traceroute */
/* end ttl window stuff. */
}
/* Now drop to user permissions */
- if (setuid(getuid())) {
+ if (setgid(getgid()) || setuid(getuid())) {
fprintf (stderr, "mtr: Unable to drop permissions.\n");
exit(1);
}
/* Double check, just in case */
- if (geteuid() != getuid()) {
+ if ((geteuid() != getuid()) || (getegid() != getgid())) {
fprintf (stderr, "mtr: Unable to drop permissions.\n");
exit(1);
}
#define UNUSED
#endif
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
int avg; /* average: addByMin */
int gmean; /* geometirc mean: addByMin */
int jitter; /* current jitter, defined as t1-t0 addByMin */
-//int jbest; /* min jitter, of cause it is 0, not needed */
+/*int jbest;*/ /* min jitter, of cause it is 0, not needed */
int javg; /* avg jitter */
int jworst; /* max jitter */
int jinta; /* estimated variance,? rfc1889's "Interarrival Jitter" */
if ( addrcmp( (void *) &(host[index].addr),
(void *) &unspec_addr, af ) == 0 ) {
- // should be out of if as addr can change
+ /* should be out of if as addr can change */
addrcpy( (void *) &(host[index].addr), addrcopy, af );
display_rawhost(index, (void *) &(host[index].addr));
int max;
max = 0;
- // replacedByMin
- // for(at = 0; at < MaxHost-2; at++) {
+ /* replacedByMin
+ for(at = 0; at < MaxHost-2; at++) { */
for(at = 0; at < maxTTL-1; at++) {
if ( addrcmp( (void *) &(host[at].addr),
(void *) remoteaddress, af ) == 0 ) {
n_unknown = MaxHost; /* Make sure we drop into "we should restart" */
}
- if ( // success in reaching target
+ if ( /* success in reaching target */
( addrcmp( (void *) &(host[batch_at].addr),
(void *) remoteaddress, af ) == 0 ) ||
- // fail in consecuitive MAX_UNKNOWN_HOSTS (firewall?)
+ /* fail in consecuitive MAX_UNKNOWN_HOSTS (firewall?) */
(n_unknown > MAX_UNKNOWN_HOSTS) ||
- // or reach limit
+ /* or reach limit */
(batch_at >= maxTTL-1)) {
numhosts = batch_at+1;
batch_at = fstTTL - 1;
name = dns_lookup(addr);
if(name != NULL) {
/* May be we should test name's length */
- sprintf(newLine, "%s %d %d %d %d %d %d", name,
+ snprintf(newLine, sizeof(newLine), "%s %d %d %d %d %d %d", name,
net_loss(at),
net_returned(at), net_xmit(at),
net_best(at) /1000, net_avg(at)/1000,
net_worst(at)/1000);
} else {
- sprintf(newLine, "%s %d %d %d %d %d %d",
+ snprintf(newLine, sizeof(newLine), "%s %d %d %d %d %d %d",
strlongip( addr ),
net_loss(at),
net_returned(at), net_xmit(at),