summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libnet/configure.ac13
-rw-r--r--libnet/src/libnet_raw.c6
2 files changed, 18 insertions, 1 deletions
diff --git a/libnet/configure.ac b/libnet/configure.ac
index 2688469..9108740 100644
--- a/libnet/configure.ac
+++ b/libnet/configure.ac
@@ -30,6 +30,19 @@ AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
+AC_MSG_CHECKING(for socklen_t)
+AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [ socklen_t x; ],
+ have_socklen_t=yes,
+ have_socklen_t=no)
+if test "x$have_socklen_t" = "xyes"; then
+ AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
+fi
+AC_MSG_RESULT($have_socklen_t)
+
dnl
dnl And some custom things
dnl
diff --git a/libnet/src/libnet_raw.c b/libnet/src/libnet_raw.c
index c8cfe16..98917f7 100644
--- a/libnet/src/libnet_raw.c
+++ b/libnet/src/libnet_raw.c
@@ -32,6 +32,10 @@
#include "common.h"
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t
+#endif
+
/* TODO this doesn't make any sense, the code in the #else branch is littered
with conditionals on __WIN32__ that are never reachable, what happened?
*/
@@ -63,7 +67,7 @@ libnet_close_raw6(libnet_t *l)
int
libnet_open_raw4(libnet_t *l)
{
- int len; /* now supposed to be socklen_t, but maybe old systems used int? */
+ socklen_t len;
#if !(__WIN32__)
int n = 1;