]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
mtr v0.77 v0.77
authorRoger Wolff <r.e.wolff@bitwizard.nl>
Tue, 1 Jun 2010 00:00:00 +0000 (00:00 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:45:38 +0000 (20:45 +0000)
 - Add feature to show loadbalances on routes by Thales
   <thales@paponline.net>

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

configure.in
report.c

index ff6d51ffe1352961af2c3c8b4ac360cb1c3a9c92..ab5f4cf9e4caebad11aaa3e03c53de4e085761db 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.76)
+AM_INIT_AUTOMAKE(mtr, 0.77)
 
 
 AC_SUBST(GTK_OBJ)
index e87fa07698fe75e127ed6eb48040a68d8e748c32..34ea11489d9ec52767de31b41f9549d70686e38e 100644 (file)
--- a/report.c
+++ b/report.c
@@ -30,6 +30,8 @@
 #include "net.h"
 #include "dns.h"
 
+#define MAXLOADBAL 5
+
 extern int dns;
 extern char LocalHostname[];
 extern char *Hostname;
@@ -50,8 +52,9 @@ void report_open(void)
 
 void report_close(void) 
 {
-  int i, j, at, max;
+  int i, j, at, max, z, w;
   ip_t *addr;
+  ip_t *addr2 = NULL;  
   char name[81];
   char buf[1024];
   char fmt[16];
@@ -99,7 +102,6 @@ void report_close(void)
   at  = net_min();
   for(; at < max; at++) {
     addr = net_addr(at);
-    
     if( addrcmp( (void *) addr, (void *) &unspec_addr, af ) == 0 ) {
       sprintf(name, "???");
     } else {
@@ -113,7 +115,7 @@ void report_close(void)
       }
     }
 
-    snprintf( fmt, sizeof(fmt), " %%2d. %%-%ds", len_hosts);
+    snprintf( fmt, sizeof(fmt), " %%2d.|-- %%-%ds", len_hosts);
     snprintf(buf, sizeof(buf), fmt, at+1, name);
     len = reportwide ? strlen(buf) : len_hosts;  
     for( i=0; i<MAXFLD; i++ ) {
@@ -131,6 +133,30 @@ void report_close(void)
       len +=  data_fields[j].length;
     }
     printf("%s\n",buf);
+
+    /* Thales (thales@paponline.net) -- 
+     * This feature show 'loadbalances' on routes 
+     */
+    
+   /* z is starting at 1 because addrs[0] is the same that addr */
+    for (z = 1; z < MAXPATH ; z++) {
+       addr2 = net_addrs(at, z);
+       int found = 0;
+       if ((addrcmp ((void *) &unspec_addr, (void *) addr2, af)) == 0)
+          break;
+      for (w = 0; w < z; w++)
+        /* Thales -- Ok... checking if there are ips repeated on same hop */
+           if ((addrcmp ((void *) addr2, (void *) net_addrs (at,w), af)) == 0) {
+              found = 1;
+              break;
+           }   
+       if (!found) {
+        if (z == 1)  
+          printf ("    |  `|-- %s\n", strlongip(addr2));
+        else 
+          printf ("    |   |-- %s\n", strlongip(addr2));
+       }
+    }
   }
 }