delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/04/24/17:46:04

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type
:content-transfer-encoding; q=dns; s=default; b=ZrBxDzq/UKxM+ovW
v34O9cdiZdvd3l5+0ebfQpApYvqlLJ6B70V2yVVZDOzDpPBKy8gfbUFbkHVHW3L9
w1jFBtna2mabxCvVWrzn3eBbOA8FFb2+Fij0SZWawvQnm6fblivyT9vzYtgqL3nu
6l4Q+fkYiRg+AhtDmYN02dDLCUs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type
:content-transfer-encoding; s=default; bh=DmsCVNIlUQsp2CfYTVfMdB
wvgsg=; b=LsJxbFgCm1W6iYxg6NxEPXO70KhKaMWoJqsQfekghxMPZ+I1dIxIsN
LCdX91fQhiNSSoba8IVsUGFv20bfHIxMXt4lUqbOgfxeXla4PclP4COPlIk9d0lK
lQv+2n5mm6TL6u+tyB+Jtgbji737ZUsEdkaZKWUoIJ0UiidMeWfDo=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1
MIME-Version: 1.0
X-Received: by 10.60.60.71 with SMTP id f7mr15062536oer.71.1366839947431; Wed, 24 Apr 2013 14:45:47 -0700 (PDT)
In-Reply-To: <51782672.10509@cygwin.com>
References: <CAEE3Wrm8MwsN2MMNTRGdLgJvSHPnusJN-TXZrJFL-26BtrW_ng AT mail DOT gmail DOT com> <20130424154409 DOT GX26397 AT calimero DOT vinschen DOT de> <CAEE3Wrm4iARi33g3gOqfbyJ_Jwc6phQ8xNZSQ6=Cknj-bUQ1-g AT mail DOT gmail DOT com> <CE9C056E12502146A72FD81290379E9A6095C4FA AT ENFIRHMBX1 DOT datcon DOT co DOT uk> <CAEE3Wr=cDmAKuJ5rDK0wYoW9hVYzdfTnXCvjVMUhe0qgC4kzGA AT mail DOT gmail DOT com> <20130424175107 DOT GZ26397 AT calimero DOT vinschen DOT de> <20130424175359 DOT GH5968 AT type DOT youpi DOT perso DOT aquilenet DOT fr> <20130424181248 DOT GA26397 AT calimero DOT vinschen DOT de> <51782672 DOT 10509 AT cygwin DOT com>
Date: Wed, 24 Apr 2013 23:45:47 +0200
Message-ID: <CAEE3Wr=WXVVZk9eV1M4dXYvRofaMcGFi6nF5n4F6i7PpEEA-iA@mail.gmail.com>
Subject: Re: Redefinition of `struct in6_addr'?
From: Max Balduino <max DOT balduino AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r3OLk03O010176

> On 4/24/2013 2:12 PM, Corinna Vinschen wrote:
>>
>> On Apr 24 19:53, Samuel Thibault wrote:
>>>
>>> Corinna Vinschen, le Wed 24 Apr 2013 19:51:07 +0200, a écrit :
>>>>>>
>>>>>> /usr/include/cygwin/in6.h:75:8: error: redefinition of ‘struct
>>>>>> in6_addr’
>>>>>>
>>>>>> /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/in6addr.h:17:16:
>>>>>> note: originally defined here
>>>>
>>>>
>>>> Don't know this file but this is a bug in config.h.  struct in6_addr
>>>> is defined in a system header, so it should not be gratuitously defined
>>>> in a project header, especially if the definition collides with the
>>>> right one from the system header.
>>>
>>>
>>> Mmm, but here it's w32api definition vs cygwin definition.
>>
>>
>> Maybe I didn't read it exactly, but the bottom line here is, when
>> building for Cygwin, either use the POSIX network headers (preferredly),
>> or use winsock.h.  Mixing them is not supported.
>
>
> Yeah, though this case is a bit buried, so it's not obvious.  Also the code
> is from 2008, so I expect it has suffered some bit rot over time with
> respect to Cygwin.  In any case, it looks like removing iphlpapi.h from
> sysdep.c solves the problem.


Hey, I got it! It's not cygwin fault...

It's the inclusion of <netinet/in.h> which is done for the first time
in sysdep.h, AFTER the inclusions of the winapi32, where struct
in6_addr is declared. Actually sysdep.c includes its header at the end
of the inclusion list and sysdep.h in its turn has an inclusion for
<netinet/in.h> . The solution is in the following patch:

--- //ioxp/cygwin/usr/src/vpnc-0.5.3/sysdep.c    mer nov 19 21:02:39 2008
+++ //ioxp/cygwin/usr/src/vpnc-0.5.3.1/sysdep.c    mer apr 24 21:53:29 2013
@@ -28,6 +28,7 @@

 #include <sys/socket.h>
 #include <net/if.h>
+#include <netinet/in.h>

 #ifdef __sun__
 #include <ctype.h>
@@ -38,7 +39,6 @@
 #include <sys/sockio.h>
 #include <signal.h>
 #include <stropts.h>
-#include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>

Basically the #include <netinet/in.h> has to be moved up a few lines
to get it out of the

#ifdef __sun__
...
#endif

directive. This way the winapi32 headers don't declare struct
in6_addr, I didn't check, but I guess they do so only #ifndef
_CYGWIN_IN6_H, am I right?

For ease of reading, here are the inclusions in sysdep.c as patched by me:


#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/ioctl.h>
#include <errno.h>

#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>

#ifdef __sun__
#include <ctype.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <signal.h>
#include <stropts.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#endif

#if defined(__CYGWIN__)
#include <io.h>
#include <w32api/windef.h>
#include <w32api/winbase.h>
#include <w32api/winnt.h>
#include <w32api/winioctl.h>
#include <w32api/iphlpapi.h>
#include <w32api/iptypes.h>
#include <w32api/winreg.h>
#include <sys/cygwin.h>
#endif

#if defined(__DragonFly__)
#include <net/tun/if_tun.h>
#elif defined(__linux__)
#include <linux/if_tun.h>
#elif defined(__APPLE__)
/* no header for tun */
#elif defined(__CYGWIN__)
#include "tap-win32.h"
#else
#include <net/if_tun.h>
#endif

#include "sysdep.h"

#if !defined(HAVE_VASPRINTF) || !defined(HAVE_ASPRINTF) || !defined(HAVE_ERROR)
#include <stdarg.h>
#endif

#if defined(__sun__)
extern char **environ;
static int ip_fd = -1, muxid;
#endif

OK, so that's it, vpnc-0.5.3 will then compile like a charm. Ah, by
the way, you must have perl installed and run ./enum2debug.pl isakmp.h
 >vpnc-debug.c 2>vpnc-debug.h right before to make.

Thanks to all for attention, and once again sorry if I dared to post
in the wrong mailing list. You must be patient I'm just a newcomer...
Didn't mean to bother!!

:-)

BR,
Max

--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019