Index of /files/code/mtr-patches

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[   ]mtr-0.81-mpls1.patch 2011-10-23 22:25 15K 
[   ]mtr-0.80-mpls5.patch 2011-05-04 07:10 15K 
[   ]mtr-0.80-mpls4.patch 2011-03-28 12:52 15K 
[   ]mtr-0.80-mpls3.patch 2011-03-27 19:28 11K 
[   ]mtr-0.80-mpls2.patch 2011-03-27 17:49 11K 
[   ]mtr-0.80-mpls1.patch 2011-02-27 16:48 7.9K 
[   ]mtr-0.72-prox5.patch 2008-04-14 10:44 24K 
[   ]mtr-0.72-prox4.patch 2008-04-13 23:02 25K 
[   ]mtr-0.72-prox3.patch 2008-03-27 01:02 17K 
[   ]mtr-0.72-pmtu1.patch 2008-05-15 01:12 6.9K 
[   ]mtr-0.72-mpls1.patch 2008-05-10 21:36 6.4K 

MTR is a neat little utility that provides a continuous ICMP traceroute
via IPv4 or IPv6, and shows some nice ASCII-art graphs of the latency
along the way.  I like it so much that I brushed off my rusty C skills
and added some features.

ICMP Extensions for MPLS
----------------------------------------------------------------
The -mpls patches add support for MPLS extensions to ICMP based on RFC
4950, which seems to be implemented by many major routing vendors (tried
w/Cisco IOS and Junos, at least).  You'll see something like this when
using the curses interface:

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. et3.starfire.prolixium.net        0.0%     8    0.2   0.3   0.2   0.3   0.0
 2. et0-0.e.prolixium.net             0.0%     7    0.7   0.7   0.7   0.8   0.0
 3. 10.201.64.1                       0.0%     7   10.2   9.5   7.6  10.9   1.2
 4. cpe-024-074-253-052.carolina.res  0.0%     7   11.9  10.7   9.1  16.0   2.5
 5. 24.93.64.54                       0.0%     7   13.9  14.0  13.1  15.1   0.6
 6. ae-3-0.cr0.dca10.tbone.rr.com     0.0%     7   20.1  27.4  20.0  53.6  12.1
    107.14.19.20                                                               
 7. ae-2-0.pr0.dca10.tbone.rr.com     0.0%     7   23.6  21.8  20.8  23.6   1.2
 8. ix-4-3-0-0.tcore1.AEQ-Ashburn.as  0.0%     7   26.3  26.6  20.4  50.3  10.6
 9. if-2-2.tcore2.AEQ-Ashburn.as6453  0.0%     7  282.8 284.7 282.8 289.3   2.5
    [MPLS: Lbl 626929 Exp 0 S 1 TTL 1]                                         
10. if-8-1508.tcore2.LVW-LosAngeles.  0.0%     7  276.5 278.3 276.5 281.7   1.8
    [MPLS: Lbl 746113 Exp 0 S 1 TTL 1]                                         
11. if-7-2.tcore2.SVW-Singapore.as64  0.0%     7  288.7 283.8 276.9 294.4   8.2
    [MPLS: Lbl 705764 Exp 0 S 1 TTL 1]                                         
12. if-2-2.tcore1.SVW-Singapore.as64  0.0%     7  243.3 246.9 243.2 256.7   4.6
    [MPLS: Lbl 590514 Exp 0 S 1 TTL 1]                                         
13. if-9-0-0.core1.JSD-Jeddah.as6453  0.0%     7  278.5 277.8 276.9 278.5   0.6
14. ix-3-2-4.core1.JSD-Jeddah.as6453  0.0%     7  301.4 301.7 301.1 303.4   0.9
15. 168.187.0.39                      0.0%     7  311.7 311.8 310.8 313.4   0.9
16. store.kems.net                    0.0%     7  317.7 318.3 316.9 320.8   1.3

The reporting mode works, too:

HOST: destiny                     Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- et3.starfire.prolixium.ne  0.0%     4    0.3   0.3   0.2   0.3   0.1
  2.|-- et0-0.e.prolixium.net      0.0%     4    0.7   0.7   0.7   0.8   0.1
  3.|-- 10.201.64.1                0.0%     4    9.7   9.3   8.0  11.2   1.5
  4.|-- cpe-024-074-253-052.carol  0.0%     4   12.7  10.1   9.0  12.7   1.8
  5.|-- 24.93.64.54                0.0%     4  117.6  40.7  14.3 117.6  51.3
  6.|-- 107.14.19.20               0.0%     4   29.8  24.6  21.0  29.8   4.2
    |  `|-- 66.109.6.80
  7.|-- ae-2-0.pr0.dca10.tbone.rr  0.0%     4   21.7  22.2  20.9  25.1   2.0
  8.|-- ix-4-3-0-0.tcore1.AEQ-Ash  0.0%     4   22.0  23.3  22.0  25.7   1.7
  9.|-- if-2-2.tcore2.AEQ-Ashburn  0.0%     4  283.7 284.0 282.7 286.7   1.8
    |   +-- [MPLS: Lbl 626929 Exp 0 S 1 TTL 1]
 10.|-- if-8-1508.tcore2.LVW-LosA  0.0%     4  276.4 277.6 276.4 280.1   1.7
    |   +-- [MPLS: Lbl 746113 Exp 0 S 1 TTL 1]
 11.|-- if-7-2.tcore2.SVW-Singapo  0.0%     4  276.8 283.1 276.4 302.3  12.8
    |   +-- [MPLS: Lbl 705764 Exp 0 S 1 TTL 1]
 12.|-- if-2-2.tcore1.SVW-Singapo  0.0%     4  244.1 255.1 244.1 284.4  19.6
    |   +-- [MPLS: Lbl 590514 Exp 0 S 1 TTL 1]
 13.|-- if-9-0-0.core1.JSD-Jeddah 25.0%     4  277.0 277.3 277.0 277.5   0.2
 14.|-- ix-3-2-4.core1.JSD-Jeddah 25.0%     4  302.9 302.9 301.3 304.4   1.5
 15.|-- 168.187.0.39              25.0%     4  313.2 311.5 309.7 313.2   1.7
 16.|-- store.kems.net            25.0%     4  317.7 318.6 317.7 319.2   0.7

No GTK support, since I'm not sure who actually finds this useful.

Also, don't use the -mpls1 patch, since it doesn't work right.  The
-mpls2 patch works, but doesn't have IPv6 support.  The -mpls3 patch has
everything.

PMTU Detection
----------------------------------------------------------------
The -pmtu patches enable the DF (don't fragment) bit in sent IP
datagrams and detect, track, and adapt to ICMP type 3 code 4
(destination unreachable, fragmentation needed but don't fragment bit
set) messages that aid in PMTUD (path MTU discovery).  The output is a
little crummy right now, and will depend on whether your host has
actually performed PMTUD for the target.  If it has, you'll see the ICMP
message come from your local machine, as the first hop.  If not, you'll
see it come from the correct hop in the path that's actually going to
lower the MTU.  MTR will then readjust the IP datagram length to the MTU
suggested by the ICMP message.  Here's a good example (IP addresses have
been sanitized, since I didn't do this on my network):

% mtr -t 90.27.118.188 1500

                             My traceroute  [v0.72]
neodymium (0.0.0.0)                                    Thu May 15 01:17:41 2008
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 90.66.42.1                        0.0%    16    0.2   0.3   0.2   0.5   0.1
 2. 90.66.43.4 [PMTU: 1446]           0.0%    15    2.2   1.6   1.5   2.2   0.2
 3. 99.50.161.222                     0.0%    15   79.9  79.8  79.5  80.1   0.2
 4. 90.42.7.1                         0.0%    15   81.1  81.1  80.7  82.2   0.4
 5. 90.27.15.2                        0.0%    15   81.8  81.6  81.4  82.2   0.2
 6. 90.27.118.188                     0.0%    15   83.2  83.6  83.2  84.2   0.3

In the above case, 90.66.20.4 terminates an IPSec VPN to 99.50.161.22,
and therefore lowers the MTU by 54 bytes to account for the overhead.
Here's what happens when you run it again:

% mtr -t 90.27.118.188 1500

                             My traceroute  [v0.72]
neodymium (0.0.0.0)                                    Thu May 15 01:20:24 2008
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 90.66.42.10 [PMTU: 1446]          0.0%    16    0.2   0.3   0.2   0.5   0.1
    90.66.42.1                        0.0%    16    0.2   0.3   0.2   0.5   0.1
 2. 90.66.43.4                        0.0%    15    2.2   1.6   1.5   2.2   0.2
 3. 99.50.161.222                     0.0%    15   79.9  79.8  79.5  80.1   0.2
 4. 90.42.7.1                         0.0%    15   81.1  81.1  80.7  82.2   0.4
 5. 90.27.15.2                        0.0%    15   81.8  81.6  81.4  82.2   0.2
 6. 90.27.118.188                     0.0%    15   83.2  83.6  83.2  84.2   0.3

In this case the first hop, 90.66.42.10, is actually my local machine,
since Linux is telling MTR to lower the MTU to 1446 based on what's in
the IP route cache, before anything even gets on the wire.  If you
tcpdump on lo, you'll see the messages.  To combat this, just do the
following before running MTR:

# ip route flush cache

To view the cache, just do:

% ip route show cache

Maybe I'll fix this in the next patch.

UDP Support
----------------------------------------------------------------
The prox5 patch is my third stab at this.  I initially used the IP ID
field in the IPv4 header to store the sequence numbers (prox3 patch),
but this unfortunately broke IPv6 support, since there's no IP ID field
in the IPv6 header (and the flowlabel field can't be easily read or
written too, apparently).  So, I am using rotating UDP destination ports
like the classic traceroute utility.  This allows up to 100 packets to
be in-flight before they are forgotten about.

The prox5 patch is built off of MTR 0.72, and that can be grabbed via:

ftp://ftp.bitwizard.nl/mtr/mtr-0.72.tar.gz

Patch it like the following:

% wget ftp://ftp.bitwizard.nl/mtr/mtr-0.72.tar.gz
% tar -zxvf mtr-0.72.tar.gz
% wget http://www.prolixium.com/files/code/mtr-patches/mtr-0.72-prox5.patch
% cd mtr-0.72
% patch -p1 < ../mtr-0.72-prox5.patch
% ./configure
% make
% sudo make install

To run, just use the -P option to change the protocol.  It still
uses ICMP by default.  Here's an example that highlights the
difference between a ICMP and UDP traceroute, since Cablevision's
routers filter ICMP echo's:

% mtr --report dax.prolixium.com
HOST: nat                         Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. 10.83.192.1                   0.0%    10    8.5   7.3   6.7   8.8   0.8
  2. dstswr2-vlan2.rh.pswynj.cv.n  0.0%    10    6.4   7.3   6.2   8.8   0.9
  3. ???                          100.0    10    0.0   0.0   0.0   0.0   0.0
  4. ???                          100.0    10    0.0   0.0   0.0   0.0   0.0
  5. ???                          100.0    10    0.0   0.0   0.0   0.0   0.0
  6. ???                          100.0    10    0.0   0.0   0.0   0.0   0.0
  7. 0.te6-4.tsr1.lga3.us.voxel.n  0.0%    10    9.6  16.2   9.3  68.7  18.5
  8. 0.te1-49.dsr1.lga6.us.voxel.  0.0%    10    9.7  11.0   8.9  19.3   3.1
  9. 0.ge0-1.esr2.b3.lga6.us.voxe  0.0%    10   12.9  11.8   9.4  14.4   1.5
 10. dax.prolixium.com             0.0%    10   10.0  11.6   9.2  17.3   3.0

% mtr -P udp --report dax.prolixium.com
HOST: nat                         Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. 10.83.192.1                   0.0%    10    6.9   7.3   5.9   9.2   1.0
  2. dstswr2-vlan2.rh.pswynj.cv.n  0.0%    10    6.9   9.1   6.2  20.5   4.3
  3. r3-ge1-1.mhe.prnynj.cv.net    0.0%    10   64.6  14.8   8.2  64.6  17.5
  4. rtr4-tg11-3.wan.prnynj.cv.ne  0.0%    10    8.2  10.1   7.7  14.2   2.4
  5. rtr1-tg11-1.in.nwrknjmd.cv.n  0.0%    10   11.5  10.7   9.0  13.1   1.5
  6. ???                          100.0    10    0.0   0.0   0.0   0.0   0.0
  7. 0.te6-4.tsr1.lga3.us.voxel.n  0.0%    10   10.1  12.8   9.6  18.4   2.7
  8. 0.te1-49.dsr1.lga6.us.voxel.  0.0%    10    9.7  14.0   9.5  35.4   7.8
  9. 0.ge0-1.esr2.b3.lga6.us.voxe  0.0%    10   14.9  15.3   9.5  42.7   9.9
 10. dax.prolixium.com             0.0%    10   10.9  12.8   9.8  22.7   3.9

Since this program typically installs as a setuid binary, please use
with care.  This patch is mostly _untested_ and could blow up your
computer, allow hackers to access your bank account, or cause your
girlfriend to leave you.  Seriously, there are probably a couple
buffer overflow conditions in there.  Hopefully I'll iron any of
them out in the next patch.

Also, there's another UDP patch that does things a little differently.