diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-09-23 08:52:17 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-01-25 17:12:30 +0100 |
commit | 1da567734ffdeccbde737df9044b8027adb0bdb9 (patch) | |
tree | 8f52d262f395bccd8a887b073f40e34f8c309caf /src/libipsec/ip_packet.c | |
parent | 69b58e347ee09fa3adf60552f5410dbb346d6f4f (diff) | |
download | strongswan-1da567734ffdeccbde737df9044b8027adb0bdb9.tar.bz2 strongswan-1da567734ffdeccbde737df9044b8027adb0bdb9.tar.xz |
libipsec: Fix Windows build via MinGW
Fixes #2118.
Diffstat (limited to 'src/libipsec/ip_packet.c')
-rw-r--r-- | src/libipsec/ip_packet.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 |