]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
mtr v0.71 v0.71
authorRoger Wolff <r.e.wolff@bitwizard.nl>
Fri, 24 Mar 2006 00:00:00 +0000 (00:00 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:45:38 +0000 (20:45 +0000)
 - Some IPV6 fixes, introduce packet size cmdline option.  (was
   already present as a cmdline argument)

source: ftp://ftp.bitwizard.nl/mtr/mtr-0.71.tar.gz

configure.in
mtr.8
mtr.c
net.c

index 0cf10f817a935bb70786a22c333947faa6554bdf..b1563efe26972109980d95446478e2123c5f241b 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.70)
+AM_INIT_AUTOMAKE(mtr, 0.71)
 
 
 AC_SUBST(GTK_OBJ)
@@ -87,7 +87,9 @@ AC_CHECK_FUNCS(seteuid)
 
 AC_CHECK_FUNC(res_mkquery, , 
   AC_CHECK_LIB(bind, res_mkquery, , 
-   AC_CHECK_LIB(resolv, res_mkquery, , AC_MSG_ERROR(No resolver library found))))
+   AC_CHECK_LIB(resolv, res_mkquery, ,
+     AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
+LIBS="$LIBS -lresolv"
 
 AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR))
 AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
diff --git a/mtr.8 b/mtr.8
index d6708590410958e42c8dc8873d06282f4ba9445e..af67d7f644b2ab10087a42e7fe4f5604274dcfda 100644 (file)
--- a/mtr.8
+++ b/mtr.8
@@ -8,7 +8,7 @@ mtr \- a network diagnostic tool
 .SH SYNOPSIS
 .B mtr 
 [\c
-.B \-hvrctglsni46\c
+.B \-hvrctglspni46\c
 ]
 [\c
 .B \-\-help\c
@@ -44,7 +44,7 @@ mtr \- a network diagnostic tool
 .B \-\-interval\ SECONDS\c
 ]
 [\c
-.B \-\-psize\ BYTES | -p BYTES\c
+.B \-\-psize\ BYTES | -s BYTES\c
 ]
 .B HOSTNAME [PACKETSIZE]
 
@@ -124,7 +124,7 @@ both the machines on the network and the reliability of
 those machines.  Each cycle lasts one second.
 
 .TP
-.B \-p\ BYTES
+.B \-s\ BYTES
 .TP
 .B \-\-psize\ BYTES
 .TP
@@ -167,7 +167,7 @@ was built for this to work.  See the GTK+ web page at
 for more information about GTK+.
 
 .TP
-.B \-s
+.B \-p
 .TP
 .B \-\-split
 .br
diff --git a/mtr.c b/mtr.c
index 40bbb6aa580155972de194f2cdcb6c8b5fb1c059..4b32c163a6fc5bf0706123f88ed6789bba8c596f 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -368,10 +368,10 @@ int main(int argc, char **argv)
   }
 
   if (PrintHelp) {
-    printf("usage: %s [-hvrctglsni46] [--help] [--version] [--report]\n"
+    printf("usage: %s [-hvrctglspni46] [--help] [--version] [--report]\n"
           "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n"
            "\t\t[--raw] [--split] [--no-dns] [--address interface]\n" /* BL */
-           "\t\t[--psize=bytes/-p=bytes]\n"            /* ok */
+           "\t\t[--psize=bytes/-bytes]\n"            /* ok */
           "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]);
     exit(0);
   }
diff --git a/net.c b/net.c
index f341fed544670410793348d4f939d60768a83031..2a4b4627709eaf0b976f7f8a1427c083a8312588 100644 (file)
--- a/net.c
+++ b/net.c
@@ -334,6 +334,14 @@ void net_process_ping(int seq, void * addr, struct timeval now)
   int oldavg;  /* usedByMin */
   int oldjavg; /* usedByMin */
   int i;       /* usedByMin */
+#ifdef ENABLE_IPV6
+  char addrcopy[sizeof(struct in6_addr)];
+#else
+  char addrcopy[sizeof(struct in_addr)];
+#endif
+
+  /* Copy the from address ASAP because it can be overwritten */
+  addrcpy( (void *) &addrcopy, addr, af );
 
   if (seq < 0 || seq >= MaxSequence)
     return;
@@ -351,22 +359,22 @@ void net_process_ping(int seq, void * addr, struct timeval now)
   if ( addrcmp( (void *) &(host[index].addr),
                (void *) &unspec_addr, af ) == 0 ) {
     // should be out of if as addr can change
-    addrcpy( (void *) &(host[index].addr), addr, af );
+    addrcpy( (void *) &(host[index].addr), addrcopy, af );
     display_rawhost(index, (void *) &(host[index].addr));
 
   /* multi paths by Min */
-    addrcpy( (void *) &(host[index].addrs[0]), addr, af );
+    addrcpy( (void *) &(host[index].addrs[0]), addrcopy, af );
   } else {
     for( i=0; i<MAXPATH; ) {
-      if( addrcmp( (void *) &(host[index].addrs[i]), addr,
+      if( addrcmp( (void *) &(host[index].addrs[i]), (void *) &addrcopy,
                    af ) == 0 ||
           addrcmp( (void *) &(host[index].addrs[i]),
                   (void *) &unspec_addr, af ) == 0 ) break;
       i++;
     }
-    if( addrcmp( (void *) &(host[index].addrs[i]), addr, af ) != 0 && 
+    if( addrcmp( (void *) &(host[index].addrs[i]), addrcopy, af ) != 0 && 
         i<MAXPATH ) {
-      addrcpy( (void *) &(host[index].addrs[i]), addr, af );
+      addrcpy( (void *) &(host[index].addrs[i]), addrcopy, af );
     }
   /* end multi paths */
   }
@@ -925,8 +933,10 @@ int net_set_interfaceaddress (char *InterfaceAddress)
 
 void net_close(void)
 {
-  close(sendsock);
-  close(recvsock);
+  if (sendsock4 >= 0) close(sendsock4);
+  if (recvsock4 >= 0) close(recvsock4);
+  if (sendsock6 >= 0) close(sendsock6);
+  if (recvsock6 >= 0) close(recvsock6);
 }