This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mtr compilation problem

On 3/16/2011 10:59 AM, Olivier Lefevre wrote:
> Re. raw sockets and the need for elevated privilege,
> can't you use the RunAs trick to get around it?

Maybe.  Or you could recode the underlying implementation to use,
instead of the cygwin/posix socket interface, the Win32 ICMP dll
services, just like MS's own ping and tracert executables -- at least, when
	#if defined _WIN32 || defined __CYGWIN__
This allows to send ICMP packets as a regular user, but you don't have
as much flexibility in composing those packets (you can't set TTL, for

This is what FPing does (, not to
be confused with  However, FPing is
free-as-in-beer, but not free-as-in-speech (no source available).

The ICMP dll interface is technically undocumented for desktop systems,
but MS does provide documentation for the WinCE implementations.  It is
likely that the interface is the same.
"ICMP Reference" Windows CE .NET

I found this page:
which provides
	ms_icmp.h: ICMP API declarations, but apparently derived from
                   the documentation, not the MS SDK header. Also
	           (re)defines various constants (which cygwin w32api
	           provides in ipinfoid.h).  No copyright information on
	           this file -- but that's ok, it can be completely
	           re-written using the docu reference above.

	ms_icmp.c: implements 'ping' and 'traceroute' using these
	           functions. "Copyright by Bob Quinn, 1997" but with
	           no associated license information.  You'll need to
	           contact Bob directly (contact info at the webpage)
	           for explicit licensing info, if you want to use his
	           source code as the basis for a patch to mtr.

There are other references out there for "using ICMP API", some with
explicit licensing info
	explicitly placed in the public domain
	seems to be a c++ wrapper around the impl
	no licensing info
	no licensing info

but they all either assume you are using the Windows SDK IcmpAPI.h, or
provide their own declarations of the functions/structs without saying
how they determined what they were (did they copy from IcmpAPI.h?).  So,
in order to use /those/ implementations as a basis for developing a
patch for mtr, you'll need to get the ICMP API stuff integrated into
cygwin's w32api using the procedure below.

FYI: IcmpAPI.h from the windows SDK has no corresponding element in
cygwin's w32api.  To correct this, one would need to propose a patch
upstream to mingw-users AT lists DOT sourceforge DOT net...and be
prepared to show that your patch derives from and
NOT from "I looked at the MS Windows SDK IcmpAPI.h file and..."  That's
why I gave the direct msdn link, above.

I also found this, applicable for receiving unfiltered packets (e.g.
Destination Unreachable, or TTL Expired) on Vista+

but that doesn't help for sending raw packets. It uses a couple of
constants in a WSAIoctl() call [RCVALL_IPLEVEL, SIO_RCVALL] which are
not currently defined in cygwin's w32api.

These are documented here
but unfortunately does not define the actual numerical VALUES. Sigh.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]