From 4403abd07bd7177540a4c203310c79bb4a95fff6 Mon Sep 17 00:00:00 2001 From: Thomas Habets Date: Mon, 21 Oct 2019 17:30:15 +0100 Subject: Fix some non-standard types to build with -std=c18 --- configure.ac | 5 ++++- include/libnet/libnet-macros.h | 6 +++--- src/libnet_build_arp.c | 2 +- src/libnet_build_dns.c | 2 +- src/libnet_if_addr.c | 8 ++++++++ 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 #endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + #include "../include/ifaddrlist.h" #define MAX_IPADDR 512 -- cgit v1.2.1