patch for icmp.h

Christopher Faylor
Wed Mar 30 19:25:00 GMT 2011

On Wed, Mar 30, 2011 at 11:37:31AM -0700, John Paul Morrison wrote:
>This patch adds missing icmp types and definitions needs for source 
>compatibility, and it seems to work for raw icmp sockets.
>My only changes is renaming __USE_BSD which is used by Linux. It doesn't 
>look like cygwin has an equivalent and didn't want to add a potentially 
>conflicting #define. The other option would be removing the #ifdef 
>1. programs that include <netinet/ip_icmp.h> should now compile without 
>2. I compiled and ran a test program myping.c 
> and verified with wireshark.
>- when using the Windows XP SP3 machine's correct source IP, myping.c 
>sends a ping on the wire.
>- other fragments are put on the wire but this appears to be a bug in 
>the test program
>- with a spoofed IP address, myping.c errors with sendto() error: 
>Interrupted system call. Seems like a windows issue unrelated to icmp.h
>I understand that raw/icmp sockets may be undocumented in Windows; 
>Cygwin and/or windows and/or the myping.c test program may be buggy etc.
>The test program was able to put a valid ICMP echo request on the wire 
>with correct ip and icmp headers in the correct endianness , so at least 
>some raw socket functions are working
>     2011-03-28    John Paul Morrison <>
>             * icmp.h: add missing definitions for icmp
>--- snap/usr/include/cygwin/icmp.h    2011-03-27 12:31:43.000000000 -0700
>+++ /usr/include/cygwin/icmp.h    2011-03-28 16:02:20.842491500 -0700
>@@ -1 +1,291 @@
>  /* icmp.h */
>+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 99 Free Software Foundation, 
>+   This file is part of the GNU C Library.
>+   The GNU C Library is free software; you can redistribute it and/or
>+   modify it under the terms of the GNU Lesser General Public
>+   License as published by the Free Software Foundation; either
>+   version 2.1 of the License, or (at your option) any later version.
>+   The GNU C Library is distributed in the hope that it will be useful,
>+   but WITHOUT ANY WARRANTY; without even the implied warranty of
>+   Lesser General Public License for more details.
>+   You should have received a copy of the GNU Lesser General Public
>+   License along with the GNU C Library; if not, write to the Free
>+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
>+   02111-1307 USA.  */
>+#ifndef __CYGWIN_H
>+#define __CYGWIN_H    1

AFAIK, We can't just add GPLed code to Cygwin although recent comments
from RMS regarding header files may have made that murkier.

Regardless, this isn't the right name for this multiple-inclusion
protection define.  The name of the file isn't "cygwin.h".

I am amazed that this would all work without any code changes to Cygwin
itself though.


More information about the Cygwin-patches mailing list