Nmap Development mailing list archives
Re: [PATCH] nping: Fix "Next-Hop MTU" in icmp "Fragmentation required" response
From: Daniel Miller <bonsaiviking () gmail com>
Date: Thu, 11 Feb 2016 23:44:42 -0600
Sławomir, Thanks for catching this! I was able to confirm the issue and your fix, and I committed a simplification in r35623. I chose to directly extract and add the byte values instead of the existing complication with pointers and ntohs, but your offset calculation was correct. Dan On Tue, Feb 2, 2016 at 10:08 AM, Sławomir Demeszko < s.demeszko () wireless-instruments com> wrote:
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/
_______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [PATCH] nping: Fix "Next-Hop MTU" in icmp "Fragmentation required" response Sławomir Demeszko (Feb 02)
- Re: [PATCH] nping: Fix "Next-Hop MTU" in icmp "Fragmentation required" response Daniel Miller (Feb 11)