summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Nilsson <troglobit@gmail.com>2019-10-23 17:50:25 +0200
committerGitHub <noreply@github.com>2019-10-23 17:50:25 +0200
commit1996c815ad96faf778a15bca91a16b7517fbdafd (patch)
tree945d433eab193009d508082ad7ccf95930f5d2b8
parent18272df968235771fd2221a1a0e6d59d4421db23 (diff)
parent4403abd07bd7177540a4c203310c79bb4a95fff6 (diff)
downloadlibnet-1996c815ad96faf778a15bca91a16b7517fbdafd.tar.gz
Merge pull request #97 from ThomasHabets/types
Fix some non-standard types to build with -std=c18
-rw-r--r--configure.ac5
-rw-r--r--include/libnet/libnet-macros.h6
-rw-r--r--src/libnet_build_arp.c2
-rw-r--r--src/libnet_build_dns.c2
-rw-r--r--src/libnet_if_addr.c8
5 files changed, 17 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 43328d5..9e7da15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ LT_INIT([pic-only])
#
# Check for headers
#
-AC_CHECK_HEADERS([sys/sockio.h])
+AC_CHECK_HEADERS([sys/sockio.h net/if.h sys/ioctl.h])
AC_CHECK_FUNCS([gethostbyname2])
AC_CHECK_FUNCS([getifaddrs])
AC_TYPE_UINT16_T
@@ -180,6 +180,9 @@ AM_CONDITIONAL([ENABLE_SAMPLES], [test "$enable_samples" = "yes"])
# what (not) to do if the user disables shared libraries
AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
+# Enable some extra features.
+CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1"
+
# Check and set OS specific parameters
AS_CASE([$target_os],
[*linux*], [
diff --git a/include/libnet/libnet-macros.h b/include/libnet/libnet-macros.h
index 81901fe..276e611 100644
--- a/include/libnet/libnet-macros.h
+++ b/include/libnet/libnet-macros.h
@@ -170,9 +170,9 @@ if (payload_s) \
/* context queue macros and constants */
#define LIBNET_LABEL_SIZE 64
#define LIBNET_LABEL_DEFAULT "cardshark"
-#define CQ_LOCK_UNLOCKED (u_int)0x00000000
-#define CQ_LOCK_READ (u_int)0x00000001
-#define CQ_LOCK_WRITE (u_int)0x00000002
+#define CQ_LOCK_UNLOCKED (uint32_t)0x00000000
+#define CQ_LOCK_READ (uint32_t)0x00000001
+#define CQ_LOCK_WRITE (uint32_t)0x00000002
/**
* Provides an interface to iterate through the context queue of libnet
diff --git a/src/libnet_build_arp.c b/src/libnet_build_arp.c
index 7a0ee74..f066fd0 100644
--- a/src/libnet_build_arp.c
+++ b/src/libnet_build_arp.c
@@ -111,7 +111,7 @@ libnet_ptag_t
libnet_autobuild_arp(uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha,
const uint8_t *tpa, libnet_t *l)
{
- u_short hrd;
+ uint16_t hrd;
switch (l->link_type)
{
diff --git a/src/libnet_build_dns.c b/src/libnet_build_dns.c
index 5d42082..2e9e2dd 100644
--- a/src/libnet_build_dns.c
+++ b/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((u_short)(n - sizeof (dns_hdr.h_len)));
+ dns_hdr.h_len = htons((uint16_t)(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/src/libnet_if_addr.c b/src/libnet_if_addr.c
index 48906e0..18b0a33 100644
--- a/src/libnet_if_addr.c
+++ b/src/libnet_if_addr.c
@@ -36,6 +36,14 @@
#include <sys/sockio.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
#include "../include/ifaddrlist.h"
#define MAX_IPADDR 512