Nmap Development mailing list archives

[PATCH] nping: Fix "Next-Hop MTU" in icmp "Fragmentation required" response


From: Sławomir Demeszko <s.demeszko () wireless-instruments com>
Date: Tue, 2 Feb 2016 17:08:16 +0100

Hi.

When I execute a command to check MTU, for example:
        nping --icmp -c 1 --df --data-length=1400   8.8.8.8
where one router on the path has set MTU=1300 I get response:
        RCVD (0.2126s) ICMP [*.*.*.* > *.*.*.* Fragmentation required (type=3/code=4) Next-Hop-MTU=1428] IP [ttl=64 
id=31483 iplen=576 ]

The "Next-Hop-MTU=1428" is invalid here. It is always 28 bytes greater than length of send data and not router MTU.
I checked in Wireshark and it shows proper value in response packet. MTU value is 6 and 7 byte in ICMP header,
but icmppkt->data is already 4 bytes offset. Following patch resolves this. It applies to version 7.01.


Signed-off-by: Sławomir Demeszko <s.demeszko () wireless-instruments com>
---
 libnetutil/netutil.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc
index 72d9eb2..b9757c9 100644
--- a/libnetutil/netutil.cc
+++ b/libnetutil/netutil.cc
@@ -2821,7 +2821,7 @@ const char *ippackethdrinfo(const u8 *packet, u32 len, int detail) {
 
           case 4:
             strcpy(icmptype, "Fragmentation required");
-            nextmtu = (u16 *)(&(icmppkt->data[6]));
+            nextmtu = (u16 *)(&(icmppkt->data[2]));
             Snprintf(icmpfields, sizeof(icmpfields), "Next-Hop-MTU=%hu", (unsigned short) ntohs(*nextmtu));
             break;
 
-- 
2.5.0

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: