• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: icmp traceroute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: icmp traceroute


  • Subject: Re: icmp traceroute
  • From: Dalton Hamilton <email@hidden>
  • Date: Sun, 27 Aug 2006 20:04:39 +0200

Hi Josh and Peter -
Thanks to both of you for pointing out the IP header is copied in the reply.
Therefore, I've been trying to figure a way to set the ip_id in the IP Header. At first I thought it would be simple. I thought I could use the setsockopt() call and set the IP HEader ip_id field just as I use the setsockopt() call to set the IP Header ip_ttl. But this can't be done.


Now I'm investigating having to create the socket as a SOCK_RAW instead of SOCK_DGRAM and then use setsockopt ot set the IP_HDRINCL option.

However, I haven't seen any examples of any other traceroute program of other code that uses these options and creates an IP header.

What value are you setting in the IP Header and how? Again, setting the icmp_id and icmp_seq numbers will do no good for EXPIRED packets because there will be no ICMP header in the returned IP header.

However, I found an application called MTR. I downloaded the code and looked at it. Here is what it does and it acts as the EXPIRED response includes the original ICMP header immediately after the returned IP Header.

  if (header->type == echoreplytype) {
    if(header->id != (uint16)getpid())
      return;

    net_process_ping (header->sequence, (void *) fromaddress, now);
  } else if (header->type == timeexceededtype) {
    switch ( af ) {
    case AF_INET:

if ((size_t) num < sizeof(struct IPHeader) +
sizeof(struct ICMPHeader) +
sizeof (struct IPHeader) +
sizeof (struct ICMPHeader))
return;
header = (struct ICMPHeader *)(packet + sizeof (struct IPHeader) +
sizeof (struct ICMPHeader) +
sizeof (struct IPHeader));
break;
#ifdef ENABLE_IPV6
case AF_INET6:
if ( num < sizeof (struct ICMPHeader) +
sizeof (struct ip6_hdr) + sizeof (struct ICMPHeader) )
return;
header = (struct ICMPHeader *) ( packet +
sizeof (struct ICMPHeader) +
sizeof (struct ip6_hdr) );
break;
#endif
}


    if (header->id != (uint16)getpid())
      return;

    net_process_ping(header->sequence, (void *)fromaddress, now);
  }
}

Thanks
Dalton

On Aug 25, 2006, at 11:25 PM, Peter Sichel wrote:

I'm the developer of IPNetMonitorX which includes a fairly complete trace route tool.

The trick is when you get an ICMP time limit exceeded response, it
includes the IP header and first 64-bits (8 bytes) of the triggering
datagram. It's up to you to put the unique identifying information you
need in those first 8 bytes of the original UDP probe or ICMP echo
request. In my case I define a unique 16 bit identifier for each thread
running the tool and a unique sequence number for each probe sent out.
I collect this information in a table and then match it against any ICMP
responses that come back.





_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: icmp traceroute
      • From: "Peter Sichel" <email@hidden>
References: 
 >icmp traceroute (From: Dalton Hamilton <email@hidden>)
 >Re: icmp traceroute (From: "Peter Sichel" <email@hidden>)

  • Prev by Date: Re: icmp traceroute
  • Next by Date: Re: icmp traceroute
  • Previous by thread: Re: icmp traceroute
  • Next by thread: Re: icmp traceroute
  • Index(es):
    • Date
    • Thread