traviscross / mtr

Official repository for mtr, a network diagnostic tool
http://www.bitwizard.nl/mtr/
GNU General Public License v2.0
2.64k stars 337 forks source link

hostname still truncated using -w option #414

Open tingwei758 opened 2 years ago

tingwei758 commented 2 years ago

when I do ipv6 traceroute with --show-ips, the ip is still cut off even if I use the -w options.

root@xxx-xxx-xxx-xxx:~# mtr -6 -wb 2600:1407:2800:6d1::18b9
Start: 2021-11-22T12:54:57-0500
HOST: xxx.xxx.xxx.xxx                                                                                            Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 2607:f740:17::1                                                                                           0.0%    10    2.2   0.9   0.6   2.2   0.5
  2.|-- 2607:f740:57::3                                                                                           0.0%    10    0.5   9.1   0.4  86.4  27.1
  3.|-- et-2-0-17-603.cr8-mia1.ip6.gtt.net (2001:668:0:3:ffff:2:0:1b69)                                           0.0%    10    1.0   1.0   0.5   3.3   0.8
  4.|-- 2001:668:0:2:ffff:0:d5c8:77b6                                                                             0.0%    10   27.1  31.3  26.8  48.2   8.5
  5.|-- 2001:668:0:3:ffff:2:0:9f6                                                                                 0.0%    10   26.7  26.8  26.6  26.8   0.1
  6.|-- ae2.r01.lga01.icn.netarch.akamai.com (2600:1488:a140:218::a)                                              0.0%    10   27.8  30.7  27.8  39.6   4.3
  7.|-- ae6.r02.ord01.icn.netarch.akamai.com (2600:1488:5fc3:2::b)                                                0.0%    10   40.7  44.8  40.7  59.7   6.0
  8.|-- ae2.r11.ord01.ien.netarch.akamai.com (2600:1488:a100:502::b)                                              0.0%    10   41.2  41.3  41.2  41.4   0.1
  9.|-- ae2.latisys-ord5.netarch.akamai.com (2600:1488:a100:103::b)                                               0.0%    10   41.1 102.7  41.1 271.9  91.8
 10.|-- g2600-1407-2800-06d1-0000-0000-0000-18b9.deploy.static.akamaitechnologies.com (2                          0.0%    10   41.8  41.7  41.6  41.8   0.1

mtr version: 0.92

yvs2014 commented 2 years ago

it looks like a hostname description exceeds the limit of 80 bytes (defined in "report.c"), so the fast fix could be

diff --git a/ui/report.c b/ui/report.c
index c6add07..0de9268 100644
--- a/ui/report.c
+++ b/ui/report.c
@@ -43,7 +43,7 @@
 #include "utils.h"

 #define MAXLOADBAL 5
-#define MAX_FORMAT_STR 81
+#define MAX_FORMAT_STR 320     /* enough for "%s (%s)": "FQDN=255 (ADDRSTRLEN=45)" */

 void report_open(