aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/test.sh2
-rw-r--r--src/libipsec/Makefile.am4
-rw-r--r--src/libipsec/esp_packet.c2
-rw-r--r--src/libipsec/ip_packet.c29
-rw-r--r--src/libstrongswan/utils/compat/windows.h7
5 files changed, 43 insertions, 1 deletions
diff --git a/scripts/test.sh b/scripts/test.sh
index a43d724ba..db24222c7 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -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"
diff --git a/src/libipsec/Makefile.am b/src/libipsec/Makefile.am
index 90b456114..a35aba2e5 100644
--- a/src/libipsec/Makefile.am
+++ b/src/libipsec/Makefile.am
@@ -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
diff --git a/src/libipsec/esp_packet.c b/src/libipsec/esp_packet.c
index 50bc8b4f7..2c521775c 100644
--- a/src/libipsec/esp_packet.c
+++ b/src/libipsec/esp_packet.c
@@ -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;
diff --git a/src/libipsec/ip_packet.c b/src/libipsec/ip_packet.c
index 0fdd5d340..78b4c407a 100644
--- a/src/libipsec/ip_packet.c
+++ b/src/libipsec/ip_packet.c
@@ -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
diff --git a/src/libstrongswan/utils/compat/windows.h b/src/libstrongswan/utils/compat/windows.h
index f7e6207a5..68e1dca80 100644
--- a/src/libstrongswan/utils/compat/windows.h
+++ b/src/libstrongswan/utils/compat/windows.h
@@ -114,6 +114,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
*/
#ifndef InetNtop