libipsec: Fix Windows build via MinGW

Fixes #2118.
This commit is contained in:
Tobias Brunner 2016-09-23 08:52:17 +02:00
parent 69b58e347e
commit 1da567734f
5 changed files with 43 additions and 1 deletions

View File

@ -56,7 +56,7 @@ win*)
--enable-constraints --enable-revocation --enable-pem --enable-pkcs1
--enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
--enable-eap-tnc --enable-eap-ttls --enable-eap-identity
--enable-updown --enable-ext-auth
--enable-updown --enable-ext-auth --enable-libipsec
--enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
--enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
--enable-pki --enable-swanctl --enable-socket-win"

View File

@ -16,6 +16,10 @@ ipsec_sa_mgr.c ipsec_sa_mgr.h
libipsec_la_LIBADD = \
$(top_builddir)/src/libstrongswan/libstrongswan.la
if USE_WINDOWS
libipsec_la_LIBADD += -lws2_32
endif
AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan

View File

@ -25,7 +25,9 @@
#include <bio/bio_reader.h>
#include <bio/bio_writer.h>
#ifndef WIN32
#include <netinet/in.h>
#endif
typedef struct private_esp_packet_t private_esp_packet_t;

View File

@ -20,11 +20,40 @@
#include <utils/debug.h>
#include <sys/types.h>
#ifndef WIN32
#include <netinet/in.h>
#include <netinet/ip.h>
#ifdef HAVE_NETINET_IP6_H
#include <netinet/ip6.h>
#endif
#else
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t ip_hl: 4;
uint8_t ip_v: 4;
#elif BYTE_ORDER == BIG_ENDIAN
uint8_t ip_v: 4;
uint8_t ip_hl: 4;
#endif
uint8_t ip_tos;
uint16_t ip_len;
uint16_t ip_id;
uint16_t ip_off;
uint8_t ip_ttl;
uint8_t ip_p;
uint16_t ip_sum;
struct in_addr ip_src, ip_dst;
} __attribute__((packed));
struct ip6_hdr {
uint32_t ip6_flow; /* 4 bit version, 8 bit TC, 20 bit flow label */
uint16_t ip6_plen;
uint8_t ip6_nxt;
uint8_t ip6_hlim;
struct in6_addr ip6_src, ip6_dst;
} __attribute__((packed));
#define HAVE_NETINET_IP6_H /* not really, but we only need the struct above */
#endif
/**
* TCP header, defined here because platforms disagree regarding member names

View File

@ -113,6 +113,13 @@ static inline char* strdup_windows(const char *src)
*/
char* strndup(const char *s, size_t n);
/**
* From winsock2.h
*/
#ifndef IPPROTO_IPIP
#define IPPROTO_IPIP IPPROTO_IPV4
#endif
/**
* Provided via ws2_32
*/