X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Message-ID: <4D80EA1E.9000502@cwilson.fastmail.fm> Date: Wed, 16 Mar 2011 12:49:34 -0400 From: Charles Wilson Reply-To: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: mtr compilation problem References: <20110316100937 DOT GB26391 AT calimero DOT vinschen DOT de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 instance). This is what FPing does (http://www.kwakkelflap.com/fping.html, not to be confused with http://fping.sourceforge.net/). 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 http://msdn.microsoft.com/en-us/library/ms907315.aspx I found this page: http://www.sockets.com/ms_icmp.htm 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 http://tangentsoft.net/wskfaq/examples/dllping.html explicitly placed in the public domain http://serious-code.net/moin.cgi/ICMP seems to be a c++ wrapper around the sockets.com impl no licensing info http://www.hackchina.com/en/r/13544/pingi.c__html 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 http://msdn.com/.... 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+ http://www.okob.net/wp/index.php/2009/04/30/icmp-over-raw-sockets-under-windows-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 http://msdn.microsoft.com/en-us/library/ee309610%28v=vs.85%29.aspx but unfortunately does not define the actual numerical VALUES. Sigh. ======================================= -- Chuck -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple