diff options
-rw-r--r-- | libnet/include/libnet.h.in | 1 | ||||
-rw-r--r-- | libnet/include/libnet/libnet-functions.h | 8 | ||||
-rw-r--r-- | libnet/include/win32/libnet.h | 6 | ||||
-rw-r--r-- | libnet/src/libnet_asn1.c | 2 | ||||
-rw-r--r-- | libnet/src/libnet_build_dns.c | 2 | ||||
-rw-r--r-- | libnet/src/libnet_checksum.c | 10 | ||||
-rw-r--r-- | libnet/src/libnet_init.c | 2 | ||||
-rw-r--r-- | libnet/src/libnet_version.c | 23 |
8 files changed, 14 insertions, 40 deletions
diff --git a/libnet/include/libnet.h.in b/libnet/include/libnet.h.in index 04dbd64..a063cc6 100644 --- a/libnet/include/libnet.h.in +++ b/libnet/include/libnet.h.in @@ -88,7 +88,6 @@ extern "C" { # include <ws2tcpip.h> # include <windows.h> # include <winsock2.h> -# include <win32/in_systm.h> #endif /* __WIN32__ */ #if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__) && !(__GNU__) diff --git a/libnet/include/libnet/libnet-functions.h b/libnet/include/libnet/libnet-functions.h index c067798..7f6f512 100644 --- a/libnet/include/libnet/libnet-functions.h +++ b/libnet/include/libnet/libnet-functions.h @@ -2310,19 +2310,11 @@ LIBNET_API int libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size); -#if ((__WIN32__) && !(__CYGWIN__)) -/* - * [Internal] - */ -SOCKET -libnet_open_raw4(libnet_t *l); -#else /* * [Internal] */ int libnet_open_raw4(libnet_t *l); -#endif /* * [Internal] diff --git a/libnet/include/win32/libnet.h b/libnet/include/win32/libnet.h index 9b8cc77..18a5d6c 100644 --- a/libnet/include/win32/libnet.h +++ b/libnet/include/win32/libnet.h @@ -58,7 +58,6 @@ extern "C" { library users don't (and they have negative side effects).
*/
/* Some UNIX to Win32 conversions */
-#define STDOUT_FILENO stdout
#define snprintf _snprintf
#define strdup _strdup
#define write _write
@@ -75,17 +74,22 @@ extern "C" { #define __FUNCTION__ __FILE__
#endif
+/* the following is only supported by MSVC and not by MinGW/MSys environements */
+#ifdef _MSC_VER
#pragma comment (lib,"ws2_32") /* Winsock 2 */
#pragma comment (lib,"iphlpapi") /* IP Helper */
#pragma comment (lib,"wpcap") /* Winpcap */
#pragma comment (lib,"packet")
+#endif
/* FIXME this needs manual update during release packaging. */
#define LIBNET_VERSION "1.1.6"
/* To use Win32 native versions */
#define WPCAP 1
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
diff --git a/libnet/src/libnet_asn1.c b/libnet/src/libnet_asn1.c index 9a01855..2445715 100644 --- a/libnet/src/libnet_asn1.c +++ b/libnet/src/libnet_asn1.c @@ -265,7 +265,7 @@ libnet_build_asn1_length(uint8_t *data, int *datalen, int len) *data++ = (uint8_t)((len >> 8) & 0xFF); *data++ = (uint8_t)(len & 0xFF); } - *datalen -= (data - start_data); + *datalen -= (int)(data - start_data); return (data); } diff --git a/libnet/src/libnet_build_dns.c b/libnet/src/libnet_build_dns.c index 26c6f3a..308124c 100644 --- a/libnet/src/libnet_build_dns.c +++ b/libnet/src/libnet_build_dns.c @@ -77,7 +77,7 @@ libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags, * anyway. */ memset(&dns_hdr, 0, sizeof(dns_hdr)); - dns_hdr.h_len = htons(n - sizeof (dns_hdr.h_len)); + dns_hdr.h_len = htons((u_short)(n - sizeof (dns_hdr.h_len))); dns_hdr.id = htons(id); dns_hdr.flags = htons(flags); dns_hdr.num_q = htons(num_q); diff --git a/libnet/src/libnet_checksum.c b/libnet/src/libnet_checksum.c index 01a1dd4..69ccfea 100644 --- a/libnet/src/libnet_checksum.c +++ b/libnet/src/libnet_checksum.c @@ -231,7 +231,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const struct libnet_tcp_hdr *tcph_p = (struct libnet_tcp_hdr *)(iphdr + ip_hl); - h_len = end - (uint8_t*) tcph_p; /* ignore h_len, sum the packet we've coalesced */ + h_len = (int)(end - (uint8_t*) tcph_p); /* ignore h_len, sum the packet we've coalesced */ CHECK_IP_PAYLOAD_SIZE(); @@ -285,7 +285,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const struct libnet_udp_hdr *udph_p = (struct libnet_udp_hdr *)(iphdr + ip_hl); - h_len = end - (uint8_t*) udph_p; /* ignore h_len, sum the packet we've coalesced */ + h_len = (int)(end - (uint8_t*) udph_p); /* ignore h_len, sum the packet we've coalesced */ CHECK_IP_PAYLOAD_SIZE(); @@ -308,7 +308,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const struct libnet_icmpv4_hdr *icmph_p = (struct libnet_icmpv4_hdr *)(iphdr + ip_hl); - h_len = end - (uint8_t*) icmph_p; /* ignore h_len, sum the packet we've coalesced */ + h_len = (int)(end - (uint8_t*) icmph_p); /* ignore h_len, sum the packet we've coalesced */ CHECK_IP_PAYLOAD_SIZE(); @@ -330,7 +330,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const struct libnet_icmpv6_hdr *icmph_p = (struct libnet_icmpv6_hdr *)(iphdr + ip_hl); - h_len = end - (uint8_t*) icmph_p; /* ignore h_len, sum the packet we've coalesced */ + h_len = (int)(end - (uint8_t*) icmph_p); /* ignore h_len, sum the packet we've coalesced */ CHECK_IP_PAYLOAD_SIZE(); @@ -349,7 +349,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const struct libnet_igmp_hdr *igmph_p = (struct libnet_igmp_hdr *)(iphdr + ip_hl); - h_len = end - (uint8_t*) igmph_p; /* ignore h_len, sum the packet we've coalesced */ + h_len = (int)(end - (uint8_t*) igmph_p); /* ignore h_len, sum the packet we've coalesced */ CHECK_IP_PAYLOAD_SIZE(); diff --git a/libnet/src/libnet_init.c b/libnet/src/libnet_init.c index c00f5a9..10b8de7 100644 --- a/libnet/src/libnet_init.c +++ b/libnet/src/libnet_init.c @@ -168,7 +168,7 @@ libnet_getfd(libnet_t *l) return (-1); } - return (l->fd); + return (int)(l->fd); } const char * diff --git a/libnet/src/libnet_version.c b/libnet/src/libnet_version.c index 7631a7b..cf62c4b 100644 --- a/libnet/src/libnet_version.c +++ b/libnet/src/libnet_version.c @@ -2,7 +2,7 @@ * $Id: libnet_version.c,v 1.7 2004/11/09 07:05:07 mike Exp $ * * libnet - * libnet_version.c - dummy version function to define version info + * libnet_version.c - version function to return version info * * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> * All rights reserved. @@ -32,32 +32,11 @@ #include "common.h" -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif - static const char banner[] = "libnet version " LIBNET_VERSION ""; -#if 0 -/* FIXME can find no sign this is used anywhere */ -void -__libnet_print_vers(void) -{ - /* - * We don't check for error cos we really don't care. - */ -#if defined (__WIN32__) - fprintf(stdout, "%s", banner); -#else - (void)write(STDOUT_FILENO, banner, sizeof(banner) - 1); -#endif -} -#endif - const char * libnet_version(void) { return (banner); } -/* EOF */ |